@@ -200,9 +200,14 @@ void initVariant() {}
200
200
void init () __attribute__((weak ));
201
201
void init () {}
202
202
203
+ #ifdef CONFIG_APP_ROLLBACK_ENABLE
203
204
bool verifyOta () __attribute__((weak ));
204
205
bool verifyOta () { return true; }
205
206
207
+ bool verifyRollbackLater () __attribute__((weak ));
208
+ bool verifyRollbackLater () { return false; }
209
+ #endif
210
+
206
211
#ifdef CONFIG_BT_ENABLED
207
212
//overwritten in esp32-hal-bt.c
208
213
bool btInUse () __attribute__((weak ));
@@ -212,15 +217,17 @@ bool btInUse(){ return false; }
212
217
void initArduino ()
213
218
{
214
219
#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
+ }
224
231
}
225
232
}
226
233
}
0 commit comments