From 917a406c0a6b9bcfd5bd462323937d76591c3abe Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Fri, 18 Oct 2019 17:35:13 +0530 Subject: [PATCH] Logging improvements in OTA example and component --- components/esp_https_ota/src/esp_https_ota.c | 2 +- .../ota/native_ota_example/main/native_ota_example.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/components/esp_https_ota/src/esp_https_ota.c b/components/esp_https_ota/src/esp_https_ota.c index d2ca501039..d5a69783ad 100644 --- a/components/esp_https_ota/src/esp_https_ota.c +++ b/components/esp_https_ota/src/esp_https_ota.c @@ -263,7 +263,7 @@ esp_err_t esp_https_ota_perform(esp_https_ota_handle_t https_ota_handle) handle->ota_upgrade_buf, handle->ota_upgrade_buf_size); if (data_read == 0) { - ESP_LOGI(TAG, "Connection closed, all data received"); + ESP_LOGI(TAG, "Connection closed"); } else if (data_read < 0) { ESP_LOGE(TAG, "Error: SSL data read error"); return ESP_FAIL; diff --git a/examples/system/ota/native_ota_example/main/native_ota_example.c b/examples/system/ota/native_ota_example/main/native_ota_example.c index 1c8ea033f7..ae885b1676 100644 --- a/examples/system/ota/native_ota_example/main/native_ota_example.c +++ b/examples/system/ota/native_ota_example/main/native_ota_example.c @@ -176,19 +176,20 @@ static void ota_example_task(void *pvParameter) binary_file_length += data_read; ESP_LOGD(TAG, "Written image length %d", binary_file_length); } else if (data_read == 0) { - ESP_LOGI(TAG, "Connection closed,all data received"); + ESP_LOGI(TAG, "Connection closed"); break; } } - ESP_LOGI(TAG, "Total Write binary data length : %d", binary_file_length); + ESP_LOGI(TAG, "Total Write binary data length: %d", binary_file_length); if (esp_http_client_is_complete_data_received(client) != true) { ESP_LOGE(TAG, "Error in receiving complete file"); http_cleanup(client); task_fatal_error(); } - if (esp_ota_end(update_handle) != ESP_OK) { - ESP_LOGE(TAG, "esp_ota_end failed!"); + err = esp_ota_end(update_handle); + if (err != ESP_OK) { + ESP_LOGE(TAG, "esp_ota_end failed (%s)!", esp_err_to_name(err)); http_cleanup(client); task_fatal_error(); }