forked from espressif/arduino-esp32
Add option to skip image verification after OTA (#6779)
Fixes: https://github.com/espressif/arduino-esp32/issues/5871
This commit is contained in:
@ -200,9 +200,14 @@ void initVariant() {}
|
|||||||
void init() __attribute__((weak));
|
void init() __attribute__((weak));
|
||||||
void init() {}
|
void init() {}
|
||||||
|
|
||||||
|
#ifdef CONFIG_APP_ROLLBACK_ENABLE
|
||||||
bool verifyOta() __attribute__((weak));
|
bool verifyOta() __attribute__((weak));
|
||||||
bool verifyOta() { return true; }
|
bool verifyOta() { return true; }
|
||||||
|
|
||||||
|
bool verifyRollbackLater() __attribute__((weak));
|
||||||
|
bool verifyRollbackLater() { return false; }
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_BT_ENABLED
|
#ifdef CONFIG_BT_ENABLED
|
||||||
//overwritten in esp32-hal-bt.c
|
//overwritten in esp32-hal-bt.c
|
||||||
bool btInUse() __attribute__((weak));
|
bool btInUse() __attribute__((weak));
|
||||||
@ -212,15 +217,17 @@ bool btInUse(){ return false; }
|
|||||||
void initArduino()
|
void initArduino()
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_APP_ROLLBACK_ENABLE
|
#ifdef CONFIG_APP_ROLLBACK_ENABLE
|
||||||
const esp_partition_t *running = esp_ota_get_running_partition();
|
if(!verifyRollbackLater()){
|
||||||
esp_ota_img_states_t ota_state;
|
const esp_partition_t *running = esp_ota_get_running_partition();
|
||||||
if (esp_ota_get_state_partition(running, &ota_state) == ESP_OK) {
|
esp_ota_img_states_t ota_state;
|
||||||
if (ota_state == ESP_OTA_IMG_PENDING_VERIFY) {
|
if (esp_ota_get_state_partition(running, &ota_state) == ESP_OK) {
|
||||||
if (verifyOta()) {
|
if (ota_state == ESP_OTA_IMG_PENDING_VERIFY) {
|
||||||
esp_ota_mark_app_valid_cancel_rollback();
|
if (verifyOta()) {
|
||||||
} else {
|
esp_ota_mark_app_valid_cancel_rollback();
|
||||||
log_e("OTA verification failed! Start rollback to the previous version ...");
|
} else {
|
||||||
esp_ota_mark_app_invalid_rollback_and_reboot();
|
log_e("OTA verification failed! Start rollback to the previous version ...");
|
||||||
|
esp_ota_mark_app_invalid_rollback_and_reboot();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user