mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-11 05:57:05 +03:00
Minor changes to OTA and status
This commit is contained in:
@@ -206,6 +206,7 @@ void ota_task(void *pvParameter)
|
|||||||
init_config(&config,ota_status.current_url);
|
init_config(&config,ota_status.current_url);
|
||||||
|
|
||||||
FREE_RESET(pvParameter);
|
FREE_RESET(pvParameter);
|
||||||
|
|
||||||
snprintf(ota_status.status_text,sizeof(ota_status.status_text)-1,"Checking for redirect...");
|
snprintf(ota_status.status_text,sizeof(ota_status.status_text)-1,"Checking for redirect...");
|
||||||
check_http_redirect();
|
check_http_redirect();
|
||||||
if(ota_status.bRedirectFound && ota_status.redirected_url== NULL){
|
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);
|
init_config(&ota_config,ota_status.bRedirectFound?ota_status.redirected_url:ota_status.current_url);
|
||||||
ota_status.bOTAStarted = true;
|
ota_status.bOTAStarted = true;
|
||||||
snprintf(ota_status.status_text,sizeof(ota_status.status_text)-1,"Starting OTA...");
|
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);
|
esp_err_t err = esp_https_ota(&config);
|
||||||
if (err == ESP_OK) {
|
if (err == ESP_OK) {
|
||||||
snprintf(ota_status.status_text,sizeof(ota_status.status_text)-1,"Success!");
|
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);
|
nvs_close(nvs);
|
||||||
}
|
}
|
||||||
|
ESP_LOGI(TAG, "Waiting for other processes to start");
|
||||||
|
vTaskDelay(2500/ portTICK_RATE_MS);
|
||||||
ESP_LOGI(TAG, "Starting ota: %s", urlPtr);
|
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) {
|
if (ret != pdPASS) {
|
||||||
ESP_LOGI(TAG, "create thread %s failed", "ota_task");
|
ESP_LOGI(TAG, "create thread %s failed", "ota_task");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
wifi_config_t *config = wifi_manager_get_wifi_sta_config();
|
||||||
if(config){
|
if(config){
|
||||||
#if RECOVERY_APPLICATION
|
#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
|
#else
|
||||||
const char ip_info_json_format[] = ",\"ip\":\"%s\",\"netmask\":\"%s\",\"gw\":\"%s\",\"urc\":%d,\"project_name\":\"%s\",\"version\":\"%s\"}\n";
|
const char ip_info_json_format[] = ",\"ip\":\"%s\",\"netmask\":\"%s\",\"gw\":\"%s\",\"urc\":%d,\"project_name\":\"%s\",\"version\":\"%s\"}\n";
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user