Minor changes to OTA and status

This commit is contained in:
Sebastien
2019-09-28 13:23:41 -04:00
parent f36a41e892
commit 7f5f7b55aa
2 changed files with 7 additions and 4 deletions

View File

@@ -206,6 +206,7 @@ void ota_task(void *pvParameter)
init_config(&config,ota_status.current_url);
FREE_RESET(pvParameter);
snprintf(ota_status.status_text,sizeof(ota_status.status_text)-1,"Checking for redirect...");
check_http_redirect();
if(ota_status.bRedirectFound && ota_status.redirected_url== NULL){
@@ -217,6 +218,8 @@ void ota_task(void *pvParameter)
init_config(&ota_config,ota_status.bRedirectFound?ota_status.redirected_url:ota_status.current_url);
ota_status.bOTAStarted = true;
snprintf(ota_status.status_text,sizeof(ota_status.status_text)-1,"Starting OTA...");
// pause to let the system catch up
vTaskDelay(1500/ portTICK_RATE_MS);
esp_err_t err = esp_https_ota(&config);
if (err == ESP_OK) {
snprintf(ota_status.status_text,sizeof(ota_status.status_text)-1,"Success!");
@@ -265,10 +268,10 @@ void start_ota(const char * bin_url)
}
nvs_close(nvs);
}
ESP_LOGI(TAG, "Waiting for other processes to start");
vTaskDelay(2500/ portTICK_RATE_MS);
ESP_LOGI(TAG, "Starting ota: %s", urlPtr);
ret=xTaskCreate(&ota_task, "ota_task", 1024*10,(void *) urlPtr, 3, NULL);
ret=xTaskCreate(&ota_task, "ota_task", 1024*10,(void *) urlPtr, 4, NULL);
if (ret != pdPASS) {
ESP_LOGI(TAG, "create thread %s failed", "ota_task");
}

View File

@@ -414,7 +414,7 @@ void wifi_manager_generate_ip_info_json(update_reason_code_t update_reason_code)
wifi_config_t *config = wifi_manager_get_wifi_sta_config();
if(config){
#if RECOVERY_APPLICATION
const char ip_info_json_format[] = ",\"ip\":\"%s\",\"netmask\":\"%s\",\"gw\":\"%s\",\"urc\":%d,\"project_name\":\"%s\",\"version\":\"%s\", \"ota_dsc\":\"%s\", \"ota_pct\":%d}\n";
const char ip_info_json_format[] = ",\"ip\":\"%s\",\"netmask\":\"%s\",\"gw\":\"%s\",\"urc\":%d,\"project_name\":\"%s\",\"version\":\"%s\", \"ota_dsc\":\"%s\", \"ota_pct\":%u}\n";
#else
const char ip_info_json_format[] = ",\"ip\":\"%s\",\"netmask\":\"%s\",\"gw\":\"%s\",\"urc\":%d,\"project_name\":\"%s\",\"version\":\"%s\"}\n";
#endif