As i Understand the rollback feature is supposed to get implemented and the app is supposed to get into Diagnosis mode as soon as i enable APP_ROLLBACK_ENABLE Feature, yet my app is not going into diagnosis state. The state is mentioned in code :
As it can be seen here that my state is supposedly not ESP_VERIFY
esp_partition_get_sha256(esp_ota_get_running_partition(), sha_256);
print_sha256(sha_256, "SHA-256 for current firmware: ");
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) {
ESP_LOGI(TAG, "Get State Partition was Successfull");
if (ota_state == ESP_OTA_IMG_PENDING_VERIFY) {
// run diagnostic function ...
bool diagnostic_is_ok = true;
if (diagnostic_is_ok) {
ESP_LOGI(TAG, "Diagnostics completed successfully! Continuing execution ...");
esp_ota_mark_app_valid_cancel_rollback();
} else {
ESP_LOGE(TAG, "Diagnostics failed! Start rollback to the previous version ...");
esp_ota_mark_app_invalid_rollback_and_reboot();
}
}
}
EXPECTED: App Diagnosis should occur ACTUAL: App Diagnosis code is not getting state :ESP_OTA_IMG_PENDING_VERIFY