Add ESP32 OTA firmware update with rollback confirmation.

Stream application binaries to the inactive OTA slot via POST /api/system/ota,
validate the esp_app_desc project name in core, and cancel rollback after a
healthy network boot through OtaService::confirmBoot().

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-07 09:41:29 +02:00
co-authored by Cursor
parent cc4a03168e
commit b0cff8369e
20 changed files with 862 additions and 13 deletions
+1 -1
View File
@@ -3,5 +3,5 @@ idf_component_register(
"main.cpp"
"hardware_bootstrap.cpp"
INCLUDE_DIRS "."
REQUIRES core net secure_store adau1701 si4684 tuner audio bt1035 bluetooth station integration eeprom24aa
REQUIRES core net secure_store adau1701 si4684 tuner audio bt1035 bluetooth station integration ota eeprom24aa
)
+8
View File
@@ -15,6 +15,7 @@
#include "bluetooth/BluetoothService.hpp"
#include "integration/IntegrationService.hpp"
#include "net/NetBootstrap.hpp"
#include "ota/OtaService.hpp"
#include "secure_store/NvsSecureStore.hpp"
#include "station/StationService.hpp"
#include "tuner/TunerService.hpp"
@@ -78,6 +79,8 @@ extern "C" void app_main()
static bluetooth::BluetoothService bluetoothService(
hardware::HardwareBootstrap::bt1035Driver());
static ota::OtaService otaService;
auto netResult = net::NetBootstrap::start(
store,
tunerService,
@@ -85,6 +88,7 @@ extern "C" void app_main()
bluetoothService,
stationService,
integration,
otaService,
hardware::HardwareBootstrap::companionChipStatus(),
hardware::HardwareBootstrap::deviceIdentity());
if (!netResult) {
@@ -94,6 +98,10 @@ extern "C" void app_main()
static net::NetBootstrap net = std::move(netResult.value());
if (auto confirmed = ota::OtaService::confirmBoot(); !confirmed) {
ESP_LOGW(kTag, "OTA rollback confirm failed");
}
if (xTaskCreate(heartbeatTask, "heartbeat", 2048, nullptr, 5, nullptr)
!= pdPASS) {
ESP_LOGE(kTag, "heartbeat task create failed");