From 8e638e388428820ae142c44a6833bf9b96b8dfdb Mon Sep 17 00:00:00 2001 From: Liam <45283486+Mitoax@users.noreply.github.com> Date: Sun, 4 May 2025 18:25:50 +0800 Subject: [PATCH] =?UTF-8?q?OTA=20checkversion=E5=A2=9E=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E4=B8=80=E4=BA=9Blog,=20=E4=BE=BF=E4=BA=8E=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E8=B0=83=E8=AF=95=E8=87=AA=E5=B7=B1=E7=9A=84?= =?UTF-8?q?OTA=E6=8E=A5=E5=8F=A3=20(#568)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(ota): add logging for missing sections in Ota::CheckVersion Add detailed logging to inform when specific sections (activation, mqtt, websocket, server_time, firmware) are not found during the OTA version check. This improves debugging and visibility into the OTA process. * 恢复提示词 --------- Co-authored-by: loadingxv --- main/idf_component.yml | 2 +- main/ota.cc | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/main/idf_component.yml b/main/idf_component.yml index 61d0f8a9..5712a8fa 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -15,7 +15,7 @@ dependencies: 78/xiaozhi-fonts: "~1.3.2" espressif/led_strip: "^2.4.1" espressif/esp_codec_dev: "~1.3.2" - espressif/esp-sr: "^2.0.5" + espressif/esp-sr: "==2.0.3" espressif/button: "^3.3.1" espressif/knob: "^1.0.0" espressif/esp_lcd_touch_ft5x06: "~1.0.6" diff --git a/main/ota.cc b/main/ota.cc index 22998248..12e4f308 100644 --- a/main/ota.cc +++ b/main/ota.cc @@ -107,6 +107,8 @@ bool Ota::CheckVersion() { return false; } + ESP_LOGI(TAG, "OTA request success: %s", check_version_url_.c_str()); + has_activation_code_ = false; has_activation_challenge_ = false; cJSON *activation = cJSON_GetObjectItem(root, "activation"); @@ -129,6 +131,8 @@ bool Ota::CheckVersion() { if (timeout_ms != NULL) { activation_timeout_ms_ = timeout_ms->valueint; } + } else { + ESP_LOGW(TAG, "No activation code found !"); } has_mqtt_config_ = false; @@ -144,6 +148,8 @@ bool Ota::CheckVersion() { } } has_mqtt_config_ = true; + } else { + ESP_LOGW(TAG, "No mqtt section found !"); } has_websocket_config_ = false; @@ -159,6 +165,8 @@ bool Ota::CheckVersion() { } } has_websocket_config_ = true; + } else { + ESP_LOGW(TAG, "No websocket section found!"); } has_server_time_ = false; @@ -182,6 +190,8 @@ bool Ota::CheckVersion() { settimeofday(&tv, NULL); has_server_time_ = true; } + } else { + ESP_LOGW(TAG, "No server_time section found!"); } has_new_version_ = false; @@ -210,7 +220,10 @@ bool Ota::CheckVersion() { has_new_version_ = true; } } + } else { + ESP_LOGW(TAG, "No firmware section found!"); } + cJSON_Delete(root); return true; }