添加了SPI链接V2支持文件,重构OTA协调器的存储准备流程,

统一WiFi/BLE传输路径的收尾处理逻辑。
feat(ota): 优化OTA性能并增强系统监控功能

- 修改RSSI警告阈值从-75dBm调整为-80dBm,更新相关文档说明
- 增加HTTP服务器任务栈大小至10240字节,解决栈溢出问题
- 将OTA块大小从4096字节降至2048字节以降低峰值堆内存占用
- 实现按需擦除机制替代预擦除,在GD32 OTA中按扇区动态擦除
- 添加任务栈水位主动巡检功能,监控栈使用情况并告警
- 集成FreeRTOS栈溢出钩子,提供栈溢出检测和告警
- 优化ESP32 OTA实现使用顺序写入模式,消除长时间擦除阻塞
- 改进堆内存不足告警机制,添加限流避免刷屏
- 移除不必要的调试日志输出,精简健康监控模块
This commit is contained in:
小龙虾
2026-07-13 03:12:21 +08:00
parent 0b363492ed
commit 76782349a9
32 changed files with 2245 additions and 788 deletions
+46
View File
@@ -0,0 +1,46 @@
/*
* task_stack_check.cpp - 任务栈水位指标收集(共享)
*
* 实现 collectTaskStackMetrics():复用 http_handlers 旧版 task_metrics[] 任务表,
* 供 health_monitor 主动巡检与 /system/status 被动报告共用。
*/
#include "task_stack_check.h"
#include "app_config.h"
#include "health_monitor.h"
#include "ota_relay.h"
#include "wifi_ota.h"
#include "ble_ota.h"
size_t collectTaskStackMetrics(TaskStackMetric* out, size_t max)
{
if (!out || max == 0) return 0;
size_t n = 0;
// httpd 由 esp_http_server 创建,无公开句柄;按任务名取。
// httpd 任务在 httpd_start() 后才存在,未启动时 xTaskGetHandle 返回 NULL。
if (n < max) {
out[n++] = { "http_server", xTaskGetHandle("httpd"), HTTP_SERVER_STACK_SIZE };
}
if (n < max) {
out[n++] = { "health_mon", HealthMonitor::instance().getTaskHandle(), 4096 };
}
if (n < max) {
out[n++] = { "ota_relay", OtaRelay::getTaskHandle(), 6144 };
}
if (n < max) {
out[n++] = { "wifi_ota", WifiOta::instance().getTaskHandle(), 8192 };
}
if (n < max) {
out[n++] = { "wifi_reconnect", WifiOta::instance().m_reconnectTask, 4096 };
}
if (n < max) {
out[n++] = { "ble_ota", BleOta::instance().getTaskHandle(), 4096 };
}
if (n < max) {
out[n++] = { "ble_ota_worker", BleOta::instance().getWorkerTaskHandle(), 4096 };
}
return n;
}