main/updates.c

changeset 40
4d8cca2d5b68
parent 29
106464d4c727
child 41
d327e0aff62f
equal deleted inserted replaced
39:c3fcc599a119 40:4d8cca2d5b68
27 /** 27 /**
28 * @brief Run binary update procedure 28 * @brief Run binary update procedure
29 */ 29 */
30 void bin_update(void) 30 void bin_update(void)
31 { 31 {
32 char temp[64];
33 esp_err_t err; 32 esp_err_t err;
34 const esp_partition_t *update_partition = NULL; 33 const esp_partition_t *update_partition = NULL;
35 esp_ota_handle_t update_handle = 0; 34 esp_ota_handle_t update_handle = 0;
36 int timeout = 600; 35 int timeout = 600;
37 36
166 ESP_LOGE(TAG, "esp_ota_begin failed (%s)", esp_err_to_name(err)); 165 ESP_LOGE(TAG, "esp_ota_begin failed (%s)", esp_err_to_name(err));
167 http_cleanup(client); 166 http_cleanup(client);
168 goto updateerr; 167 goto updateerr;
169 } 168 }
170 ESP_LOGI(TAG, "Continue upgrade application"); 169 ESP_LOGI(TAG, "Continue upgrade application");
170 screen_updating("Begin download", "New version");
171 } else { 171 } else {
172 ESP_LOGE(TAG, "Received package is not fit len"); 172 ESP_LOGE(TAG, "Received package is not fit len");
173 http_cleanup(client); 173 http_cleanup(client);
174 goto updateerr; 174 goto updateerr;
175 } 175 }
195 } 195 }
196 if (esp_ota_end(update_handle) != ESP_OK) { 196 if (esp_ota_end(update_handle) != ESP_OK) {
197 ESP_LOGE(TAG, "esp_ota_end failed!"); 197 ESP_LOGE(TAG, "esp_ota_end failed!");
198 goto updateerr; 198 goto updateerr;
199 } 199 }
200 snprintf(temp, 63, "Ok %d bytes", binary_file_length);
201 screen_updating("Begin download", temp);
202 200
203 /* 201 /*
204 * Here we have new version, install and boot it. 202 * Here we have new version, install and boot it.
205 */ 203 */
206 err = esp_ota_set_boot_partition(update_partition); 204 err = esp_ota_set_boot_partition(update_partition);

mercurial