uniq message for ESP OTA state
This commit is contained in:
parent
c85f69c545
commit
3764183944
@ -46,5 +46,10 @@
|
|||||||
#define LOG_SLEEP_CYCLE 102
|
#define LOG_SLEEP_CYCLE 102
|
||||||
#define LOG_MISSING_PUMP -4
|
#define LOG_MISSING_PUMP -4
|
||||||
#define LOG_BOOT_ERROR_DETECTION 10000
|
#define LOG_BOOT_ERROR_DETECTION 10000
|
||||||
|
#define LOG_BOOT_ERROR_IMG_UNDEFINED (LOG_BOOT_ERROR_DETECTION + 1)
|
||||||
|
#define LOG_BOOT_ERROR_IMG_NEW (LOG_BOOT_ERROR_DETECTION + 2)
|
||||||
|
#define LOG_BOOT_ERROR_IMG_INVALID (LOG_BOOT_ERROR_DETECTION + 3)
|
||||||
|
#define LOG_BOOT_ERROR_IMG_VALID (LOG_BOOT_ERROR_DETECTION + 4)
|
||||||
|
#define LOG_BOOT_ERROR_IMG_PENDING_VERIFY (LOG_BOOT_ERROR_DETECTION + 5)
|
||||||
#define LOG_SOLAR_CHARGER_MISSING 300
|
#define LOG_SOLAR_CHARGER_MISSING 300
|
||||||
#endif
|
#endif
|
||||||
|
@ -151,23 +151,23 @@ void finsihedCycleSucessfully()
|
|||||||
esp_ota_img_states_t ota_state;
|
esp_ota_img_states_t ota_state;
|
||||||
if (esp_ota_get_state_partition(running, &ota_state) == ESP_OK)
|
if (esp_ota_get_state_partition(running, &ota_state) == ESP_OK)
|
||||||
{
|
{
|
||||||
log(LOG_LEVEL_INFO, "Get State Partition was Successfull", LOG_BOOT_ERROR_DETECTION);
|
log(LOG_LEVEL_DEBUG, "Get State Partition was Successfull", LOG_BOOT_ERROR_DETECTION);
|
||||||
|
|
||||||
if(ota_state == ESP_OTA_IMG_UNDEFINED){
|
if(ota_state == ESP_OTA_IMG_UNDEFINED){
|
||||||
log(LOG_LEVEL_INFO, "ESP_OTA_IMG_UNDEFINED should not happen with rollback", LOG_BOOT_ERROR_DETECTION);
|
log(LOG_LEVEL_DEBUG, "ESP_OTA_IMG_UNDEFINED should not happen with rollback", LOG_BOOT_ERROR_IMG_UNDEFINED);
|
||||||
}
|
}
|
||||||
if(ota_state == ESP_OTA_IMG_NEW){
|
if(ota_state == ESP_OTA_IMG_NEW){
|
||||||
log(LOG_LEVEL_INFO, "ESP_OTA_IMG_NEW", LOG_BOOT_ERROR_DETECTION);
|
log(LOG_LEVEL_DEBUG, "ESP_OTA_IMG_NEW", LOG_BOOT_ERROR_IMG_NEW);
|
||||||
}
|
}
|
||||||
if(ota_state == ESP_OTA_IMG_INVALID){
|
if(ota_state == ESP_OTA_IMG_INVALID){
|
||||||
log(LOG_LEVEL_INFO, "ESP_OTA_IMG_INVALID", LOG_BOOT_ERROR_DETECTION);
|
log(LOG_LEVEL_DEBUG, "ESP_OTA_IMG_INVALID", LOG_BOOT_ERROR_IMG_INVALID);
|
||||||
}
|
}
|
||||||
if(ota_state == ESP_OTA_IMG_VALID){
|
if(ota_state == ESP_OTA_IMG_VALID){
|
||||||
log(LOG_LEVEL_INFO, "ESP_OTA_IMG_VALID", LOG_BOOT_ERROR_DETECTION);
|
log(LOG_LEVEL_DEBUG, "ESP_OTA_IMG_VALID", LOG_BOOT_ERROR_IMG_VALID);
|
||||||
}
|
}
|
||||||
if (ota_state == ESP_OTA_IMG_PENDING_VERIFY)
|
if (ota_state == ESP_OTA_IMG_PENDING_VERIFY)
|
||||||
{
|
{
|
||||||
log(LOG_LEVEL_INFO, "ESP_OTA_IMG_PENDING_VERIFY Diagnostics completed successfully! Marking as valid", LOG_BOOT_ERROR_DETECTION);
|
log(LOG_LEVEL_DEBUG, "ESP_OTA_IMG_PENDING_VERIFY Diagnostics completed successfully! Marking as valid", LOG_BOOT_ERROR_IMG_PENDING_VERIFY);
|
||||||
esp_ota_mark_app_valid_cancel_rollback();
|
esp_ota_mark_app_valid_cancel_rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -175,11 +175,11 @@ void finsihedCycleSucessfully()
|
|||||||
|
|
||||||
void espDeepSleep(bool afterPump = false)
|
void espDeepSleep(bool afterPump = false)
|
||||||
{
|
{
|
||||||
|
/* download mode or normal operation should restore device status*/
|
||||||
|
finsihedCycleSucessfully();
|
||||||
if (mDownloadMode)
|
if (mDownloadMode)
|
||||||
{
|
{
|
||||||
log(LOG_LEVEL_DEBUG, "abort deepsleep, DownloadMode active", LOG_DEBUG_CODE);
|
log(LOG_LEVEL_DEBUG, "abort deepsleep, DownloadMode active", LOG_DEBUG_CODE);
|
||||||
// if we manage to get to the download mode, the device can be restored
|
|
||||||
finsihedCycleSucessfully();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (aliveWasRead())
|
if (aliveWasRead())
|
||||||
@ -239,7 +239,6 @@ void espDeepSleep(bool afterPump = false)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
finsihedCycleSucessfully();
|
|
||||||
/* sleep always at least one second */
|
/* sleep always at least one second */
|
||||||
if (secondsToSleep < 0) {
|
if (secondsToSleep < 0) {
|
||||||
secondsToSleep = 1;
|
secondsToSleep = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user