Determine firmware download URL
This commit is contained in:
		@@ -3,6 +3,9 @@
 | 
				
			|||||||
#include "esp_ota_ops.h"
 | 
					#include "esp_ota_ops.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "ota.h"
 | 
					#include "ota.h"
 | 
				
			||||||
 | 
					#include "storage.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char *TAG = "ota";
 | 
					const char *TAG = "ota";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -21,6 +24,16 @@ bool ota_perform_update(const char *version)
 | 
				
			|||||||
    ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08" PRIx32 ")",
 | 
					    ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08" PRIx32 ")",
 | 
				
			||||||
             running->type, running->subtype, running->address);
 | 
					             running->type, running->subtype, running->address);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Determine firmware download URL
 | 
				
			||||||
 | 
					    char *secure_url = calloc(256, 1);
 | 
				
			||||||
 | 
					    assert(secure_url != NULL);
 | 
				
			||||||
 | 
					    assert(storage_get_secure_origin(secure_url) > 0);
 | 
				
			||||||
 | 
					    strcat(secure_url, "/devices_api/ota/Wt32-Eth01/");
 | 
				
			||||||
 | 
					    strcat(secure_url, version);
 | 
				
			||||||
 | 
					    ESP_LOGI(TAG, "Firmware URL: %s", secure_url);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    free(secure_url);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // TODO (from native example)
 | 
					    // TODO (from native example)
 | 
				
			||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user