mirror of
https://github.com/wled/WLED.git
synced 2025-11-11 12:01:34 +00:00
Compare commits
4 Commits
main
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aaad22acc6 | ||
|
|
d04c9dc90a | ||
|
|
6fe7fb677c | ||
|
|
9db6a44809 |
@@ -12,6 +12,10 @@
|
||||
#include "soc/rtc_cntl_reg.h"
|
||||
#endif
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
#include <esp_ota_ops.h>
|
||||
#endif
|
||||
|
||||
extern "C" void usePWMFixedNMI();
|
||||
|
||||
/*
|
||||
@@ -361,6 +365,26 @@ void WLED::setup()
|
||||
DEBUG_PRINTF_P(PSTR("---WLED %s %u INIT---\n"), versionString, VERSION);
|
||||
DEBUG_PRINTLN();
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
// Mark OTA app as valid IMMEDIATELY to prevent automatic rollback by ESP-IDF bootloader
|
||||
// This MUST happen as early as possible, before any potential crashes
|
||||
// Critical for OTA updates from 0.15 to 0.16+ on ESP32-C3 and other ESP32 variants
|
||||
const esp_partition_t* running = esp_ota_get_running_partition();
|
||||
esp_ota_img_states_t ota_state;
|
||||
if (esp_ota_get_state_partition(running, &ota_state) == ESP_OK) {
|
||||
if (ota_state == ESP_OTA_IMG_PENDING_VERIFY) {
|
||||
DEBUG_PRINTLN(F("*** OTA UPDATE DETECTED - Marking app as valid to prevent rollback ***"));
|
||||
if (esp_ota_mark_app_valid_cancel_rollback() == ESP_OK) {
|
||||
DEBUG_PRINTLN(F("OTA app marked valid successfully"));
|
||||
} else {
|
||||
DEBUG_PRINTLN(F("WARNING: Failed to mark OTA app as valid!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check IDF version for compatibility warnings
|
||||
const char* idf_ver = esp_get_idf_version();
|
||||
DEBUG_PRINTF_P(PSTR("ESP-IDF version: %s\n"), idf_ver);
|
||||
|
||||
DEBUG_PRINTF_P(PSTR("esp32 %s\n"), ESP.getSdkVersion());
|
||||
#if defined(ESP_ARDUINO_VERSION)
|
||||
DEBUG_PRINTF_P(PSTR("arduino-esp32 v%d.%d.%d\n"), int(ESP_ARDUINO_VERSION_MAJOR), int(ESP_ARDUINO_VERSION_MINOR), int(ESP_ARDUINO_VERSION_PATCH)); // available since v2.0.0
|
||||
|
||||
Reference in New Issue
Block a user