OTA checkversion增加了一些log, 便于三方开发调试自己的OTA接口 (#568)

* 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 <loadingvx@gmail.com>
This commit is contained in:
Liam
2025-05-04 18:25:50 +08:00
committed by GitHub
parent f590e49f2d
commit 8e638e3884
2 changed files with 14 additions and 1 deletions

View File

@@ -15,7 +15,7 @@ dependencies:
78/xiaozhi-fonts: "~1.3.2" 78/xiaozhi-fonts: "~1.3.2"
espressif/led_strip: "^2.4.1" espressif/led_strip: "^2.4.1"
espressif/esp_codec_dev: "~1.3.2" 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/button: "^3.3.1"
espressif/knob: "^1.0.0" espressif/knob: "^1.0.0"
espressif/esp_lcd_touch_ft5x06: "~1.0.6" espressif/esp_lcd_touch_ft5x06: "~1.0.6"

View File

@@ -107,6 +107,8 @@ bool Ota::CheckVersion() {
return false; return false;
} }
ESP_LOGI(TAG, "OTA request success: %s", check_version_url_.c_str());
has_activation_code_ = false; has_activation_code_ = false;
has_activation_challenge_ = false; has_activation_challenge_ = false;
cJSON *activation = cJSON_GetObjectItem(root, "activation"); cJSON *activation = cJSON_GetObjectItem(root, "activation");
@@ -129,6 +131,8 @@ bool Ota::CheckVersion() {
if (timeout_ms != NULL) { if (timeout_ms != NULL) {
activation_timeout_ms_ = timeout_ms->valueint; activation_timeout_ms_ = timeout_ms->valueint;
} }
} else {
ESP_LOGW(TAG, "No activation code found !");
} }
has_mqtt_config_ = false; has_mqtt_config_ = false;
@@ -144,6 +148,8 @@ bool Ota::CheckVersion() {
} }
} }
has_mqtt_config_ = true; has_mqtt_config_ = true;
} else {
ESP_LOGW(TAG, "No mqtt section found !");
} }
has_websocket_config_ = false; has_websocket_config_ = false;
@@ -159,6 +165,8 @@ bool Ota::CheckVersion() {
} }
} }
has_websocket_config_ = true; has_websocket_config_ = true;
} else {
ESP_LOGW(TAG, "No websocket section found!");
} }
has_server_time_ = false; has_server_time_ = false;
@@ -182,6 +190,8 @@ bool Ota::CheckVersion() {
settimeofday(&tv, NULL); settimeofday(&tv, NULL);
has_server_time_ = true; has_server_time_ = true;
} }
} else {
ESP_LOGW(TAG, "No server_time section found!");
} }
has_new_version_ = false; has_new_version_ = false;
@@ -210,7 +220,10 @@ bool Ota::CheckVersion() {
has_new_version_ = true; has_new_version_ = true;
} }
} }
} else {
ESP_LOGW(TAG, "No firmware section found!");
} }
cJSON_Delete(root); cJSON_Delete(root);
return true; return true;
} }