main/updates.c

changeset 27
8bb63daa7b46
parent 26
8a3696620c0a
child 29
106464d4c727
equal deleted inserted replaced
26:8a3696620c0a 27:8bb63daa7b46
31 { 31 {
32 char temp[64]; 32 char temp[64];
33 esp_err_t err; 33 esp_err_t err;
34 const esp_partition_t *update_partition = NULL; 34 const esp_partition_t *update_partition = NULL;
35 esp_ota_handle_t update_handle = 0; 35 esp_ota_handle_t update_handle = 0;
36 int timeout = 600;
36 37
37 ESP_LOGI(TAG, "Update begin"); 38 ESP_LOGI(TAG, "Update begin");
38 update_running = 1; 39 update_running = 1;
39 screen_updating("Stop tests", NULL); 40 screen_updating("Stop tests", NULL);
41
42 for (;;) {
43 vTaskDelay(100 / portTICK_PERIOD_MS);
44 if (Main_Loop1 == ML1_DONE)
45 break;
46 if (timeout)
47 timeout--;
48 else {
49 ESP_LOGE(TAG, "Timout request stop");
50 goto updateerr;
51 }
52 }
53 screen_updating("Tests stopped", NULL);
54
55 screen_updating("Stop tests", "Start WiFi");
40 requestWiFi_user(true); 56 requestWiFi_user(true);
41 57 timeout = 600;
42 for (;;) { 58 for (;;) {
43 vTaskDelay(50 / portTICK_PERIOD_MS); 59 vTaskDelay(100 / portTICK_PERIOD_MS);
44 if (ready_WiFi() && Main_Loop1 == ML1_DONE) 60 if (ready_WiFi())
45 break; 61 break;
62 if (timeout)
63 timeout--;
64 else {
65 ESP_LOGE(TAG, "Timout request WiFi");
66 goto updateerr;
67 }
46 } 68 }
47 ESP_LOGI(TAG, "System is ready for update"); 69 ESP_LOGI(TAG, "System is ready for update");
48 screen_updating("Prepare update", NULL); 70 screen_updating("Prepare update", NULL);
49 71
50 const esp_partition_t *running = esp_ota_get_running_partition(); 72 const esp_partition_t *running = esp_ota_get_running_partition();

mercurial