Determine firmware download URL

This commit is contained in:
Pierre HUBERT 2024-10-12 16:10:07 +02:00
parent 7e12e0df00
commit a088ddc5b8

View File

@ -3,6 +3,9 @@
#include "esp_ota_ops.h"
#include "ota.h"
#include "storage.h"
#include <string.h>
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;
}