From 7f5f7b55aac03d387e2929ccc5b1f785e7cb95ed Mon Sep 17 00:00:00 2001 From: Sebastien Date: Sat, 28 Sep 2019 13:23:41 -0400 Subject: [PATCH] Minor changes to OTA and status --- components/squeezelite-ota/squeezelite-ota.c | 9 ++++++--- components/wifi-manager/wifi_manager.c | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/components/squeezelite-ota/squeezelite-ota.c b/components/squeezelite-ota/squeezelite-ota.c index 33721184..2b1ee964 100644 --- a/components/squeezelite-ota/squeezelite-ota.c +++ b/components/squeezelite-ota/squeezelite-ota.c @@ -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"); } diff --git a/components/wifi-manager/wifi_manager.c b/components/wifi-manager/wifi_manager.c index 2b9c8c7a..4be69d6e 100644 --- a/components/wifi-manager/wifi_manager.c +++ b/components/wifi-manager/wifi_manager.c @@ -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