From db85cb342f6a68150b36fa4dd1ef4d03e2f90d18 Mon Sep 17 00:00:00 2001 From: Sebastien Date: Wed, 13 Nov 2019 10:48:24 -0500 Subject: [PATCH] Troubleshooting config + OTA crash --- components/cmd_system/cmd_system.c | 4 ++-- components/squeezelite-ota/squeezelite-ota.c | 5 +++-- main/config.c | 9 +++++++-- main/esp_app_main.c | 1 + 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/components/cmd_system/cmd_system.c b/components/cmd_system/cmd_system.c index 8a365718..2928bf61 100644 --- a/components/cmd_system/cmd_system.c +++ b/components/cmd_system/cmd_system.c @@ -6,7 +6,7 @@ software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ - +#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE #include #include #include @@ -116,7 +116,7 @@ esp_err_t guided_boot(esp_partition_subtype_t partition_subtype) { partition = (esp_partition_t *) esp_partition_get(it); if(partition != NULL){ - ESP_LOGI(TAG, "Found application partition sub type %u",partition_subtype); + ESP_LOGI(TAG, "Found application partition %s sub type %u", partition->label,partition_subtype); err=esp_ota_set_boot_partition(partition); if(err!=ESP_OK){ ESP_LOGE(TAG,"Unable to set partition as active for next boot. %s",esp_err_to_name(err)); diff --git a/components/squeezelite-ota/squeezelite-ota.c b/components/squeezelite-ota/squeezelite-ota.c index 2fa2e688..8001250e 100644 --- a/components/squeezelite-ota/squeezelite-ota.c +++ b/components/squeezelite-ota/squeezelite-ota.c @@ -6,7 +6,7 @@ software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ -//#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE +#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_system.h" @@ -338,7 +338,8 @@ esp_err_t process_recovery_ota(const char * bin_url){ #define OTA_CORE 1 #endif ESP_LOGI(TAG, "Starting ota on core %u for : %s", OTA_CORE,urlPtr); - ret=xTaskCreatePinnedToCore(&ota_task, "ota_task", 1024*20, (void *)urlPtr, ESP_TASK_MAIN_PRIO+1, NULL, OTA_CORE); + //ret=xTaskCreatePinnedToCore(&ota_task, "ota_task", 1024*20, (void *)urlPtr, ESP_TASK_MAIN_PRIO+2, NULL, OTA_CORE); + ret=xTaskCreate(&ota_task, "ota_task", 1024*20, (void *)urlPtr, ESP_TASK_MAIN_PRIO+2, NULL); if (ret != pdPASS) { ESP_LOGI(TAG, "create thread %s failed", "ota_task"); return ESP_FAIL; diff --git a/main/config.c b/main/config.c index 2ba2617e..8a693538 100644 --- a/main/config.c +++ b/main/config.c @@ -18,7 +18,7 @@ * along with this program. If not, see . * */ -//#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE +#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE #include "config.h" #include "nvs_utilities.h" @@ -560,11 +560,16 @@ void config_delete_key(const char *key){ else { ESP_LOGE(TAG, "Error opening nvs: %s. Unable to delete nvs key [%s].",esp_err_to_name(err),key); } + char * struc_str = cJSON_PrintUnformatted(nvs_json); + if(struc_str!=NULL){ + ESP_LOGV(TAG, "Structure before delete \n%s", struc_str); + free(struc_str); + } cJSON * entry = cJSON_GetObjectItemCaseSensitive(nvs_json, key); if(entry !=NULL){ ESP_LOGI(TAG, "Removing config key [%s]", entry->string); cJSON_Delete(entry); - char * struc_str = cJSON_PrintUnformatted(nvs_json); + struc_str = cJSON_PrintUnformatted(nvs_json); if(struc_str!=NULL){ ESP_LOGV(TAG, "Structure after delete \n%s", struc_str); free(struc_str); diff --git a/main/esp_app_main.c b/main/esp_app_main.c index b805cdbb..1c30c23a 100644 --- a/main/esp_app_main.c +++ b/main/esp_app_main.c @@ -18,6 +18,7 @@ * along with this program. If not, see . * */ +#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE #include "platform_esp32.h" #include "led.h" #include