diff --git a/esp32_device/main/ota.c b/esp32_device/main/ota.c index f33b930..efd7af1 100644 --- a/esp32_device/main/ota.c +++ b/esp32_device/main/ota.c @@ -3,6 +3,9 @@ #include "esp_ota_ops.h" #include "ota.h" +#include "storage.h" + +#include 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 ")", 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) return false; } \ No newline at end of file