From a088ddc5b8f56b9ccdef370c9cd2dcb33649f26f Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 12 Oct 2024 16:10:07 +0200 Subject: [PATCH] Determine firmware download URL --- esp32_device/main/ota.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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