diff -r 8a3696620c0a -r 8bb63daa7b46 main/updates.c --- a/main/updates.c Fri Nov 08 22:40:15 2019 +0100 +++ b/main/updates.c Sun Nov 10 20:53:01 2019 +0100 @@ -33,16 +33,38 @@ esp_err_t err; const esp_partition_t *update_partition = NULL; esp_ota_handle_t update_handle = 0; + int timeout = 600; ESP_LOGI(TAG, "Update begin"); update_running = 1; screen_updating("Stop tests", NULL); - requestWiFi_user(true); for (;;) { - vTaskDelay(50 / portTICK_PERIOD_MS); - if (ready_WiFi() && Main_Loop1 == ML1_DONE) + vTaskDelay(100 / portTICK_PERIOD_MS); + if (Main_Loop1 == ML1_DONE) break; + if (timeout) + timeout--; + else { + ESP_LOGE(TAG, "Timout request stop"); + goto updateerr; + } + } + screen_updating("Tests stopped", NULL); + + screen_updating("Stop tests", "Start WiFi"); + requestWiFi_user(true); + timeout = 600; + for (;;) { + vTaskDelay(100 / portTICK_PERIOD_MS); + if (ready_WiFi()) + break; + if (timeout) + timeout--; + else { + ESP_LOGE(TAG, "Timout request WiFi"); + goto updateerr; + } } ESP_LOGI(TAG, "System is ready for update"); screen_updating("Prepare update", NULL);