@@ -200,9 +200,14 @@ void initVariant() {}
200200void init () __attribute__((weak ));
201201void init () {}
202202
203+ #ifdef CONFIG_APP_ROLLBACK_ENABLE
203204bool verifyOta () __attribute__((weak ));
204205bool verifyOta () { return true; }
205206
207+ bool verifyRollbackLater () __attribute__((weak ));
208+ bool verifyRollbackLater () { return false; }
209+ #endif
210+
206211#ifdef CONFIG_BT_ENABLED
207212//overwritten in esp32-hal-bt.c
208213bool btInUse () __attribute__((weak ));
@@ -212,15 +217,17 @@ bool btInUse(){ return false; }
212217void initArduino ()
213218{
214219#ifdef CONFIG_APP_ROLLBACK_ENABLE
215- const esp_partition_t * running = esp_ota_get_running_partition ();
216- esp_ota_img_states_t ota_state ;
217- if (esp_ota_get_state_partition (running , & ota_state ) == ESP_OK ) {
218- if (ota_state == ESP_OTA_IMG_PENDING_VERIFY ) {
219- if (verifyOta ()) {
220- esp_ota_mark_app_valid_cancel_rollback ();
221- } else {
222- log_e ("OTA verification failed! Start rollback to the previous version ..." );
223- esp_ota_mark_app_invalid_rollback_and_reboot ();
220+ if (!verifyRollbackLater ()){
221+ const esp_partition_t * running = esp_ota_get_running_partition ();
222+ esp_ota_img_states_t ota_state ;
223+ if (esp_ota_get_state_partition (running , & ota_state ) == ESP_OK ) {
224+ if (ota_state == ESP_OTA_IMG_PENDING_VERIFY ) {
225+ if (verifyOta ()) {
226+ esp_ota_mark_app_valid_cancel_rollback ();
227+ } else {
228+ log_e ("OTA verification failed! Start rollback to the previous version ..." );
229+ esp_ota_mark_app_invalid_rollback_and_reboot ();
230+ }
224231 }
225232 }
226233 }
0 commit comments