feat(ota): 添加GD32 OTA转发进度追踪和重发机制

- 升级固件版本从0.2.10到0.2.11
- 新增全局变量g_relay_seq和g_relay_total_packets用于跟踪转发进度
- 实现OTA转发过程中的包重发逻辑,解决GD32 Flash缓冲区满时的问题
- 添加重试计数器,超过3次重发限制时标记为GD32错误
- 在system_status_handler中暴露转发序列号和总包数到API接口
- 优化前端UI显示,添加分阶段进度指示器(EPS32 OTA、GD32上传、GD32转发)
- 实现详细的转发进度百分比计算和状态反馈
- 移除未使用的AES解密函数以减少代码体积
- 修复注释中的标点符号错误(->替换为→)
- 更新CSS样式以支持新的进度显示需求
This commit is contained in:
小龙虾
2026-05-31 01:45:53 +08:00
parent 6f4be9189c
commit 56f26fa0d1
7 changed files with 196 additions and 60 deletions
+5 -3
View File
@@ -1201,9 +1201,9 @@ static esp_err_t system_status_handler(httpd_req_t *req)
memset(&meta, 0, sizeof(meta));
meta_load(&meta);
char resp[700];
char resp[800];
int len = snprintf(resp, sizeof(resp),
"{\"version\": \"%s\", \"health\": %d, \"free_heap\": %lu, \"min_free_heap\": %lu, \"temperature\": %.1f, \"uptime_sec\": %lu, \"wifi\": {\"mode\": \"%s\", \"ip\": \"%s\", \"rssi\": %d, \"connected\": %s}, \"ota\": {\"total_size\": %lu, \"stored_size\": %lu, \"storage_done\": %s, \"relay_state\": %d}}",
"{\"version\": \"%s\", \"health\": %d, \"free_heap\": %lu, \"min_free_heap\": %lu, \"temperature\": %.1f, \"uptime_sec\": %lu, \"wifi\": {\"mode\": \"%s\", \"ip\": \"%s\", \"rssi\": %d, \"connected\": %s}, \"ota\": {\"total_size\": %lu, \"stored_size\": %lu, \"storage_done\": %s, \"relay_state\": %d, \"relay_seq\": %lu, \"relay_total_packets\": %lu}}",
FW_VERSION,health_get_current(),
(unsigned long)esp_get_free_heap_size(),
(unsigned long)esp_get_minimum_free_heap_size(),
@@ -1216,7 +1216,9 @@ static esp_err_t system_status_handler(httpd_req_t *req)
(unsigned long)meta.total_size,
(unsigned long)meta.stored_size,
s_gd32_storage_done ? "true" : "false",
g_relay_state);
g_relay_state,
(unsigned long)g_relay_seq,
(unsigned long)g_relay_total_packets);
httpd_resp_set_type(req, "application/json");
httpd_resp_send(req, resp, len);