refactor(arch): 精简架构去除样板代码并修复BLE OTA虚假ACK问题
- 移除OtaCoordinator中重复的状态查询锁操作,改为单次取值后比较 - 将GD32存储wrapper函数改为inline实现并移入头文件,删除对应的cpp实现 - HTTP路由注册改为路由表+循环注册,消除复制粘贴的URI注册代码 - OtaRelay事件分发中提取通用拒绝逻辑到commonReject helper函数 - SpiMaster中折叠加锁/无锁镜像函数,通过内部Impl实现统一路径 - HealthMonitor使用RAII LockGuard替代重复的mutex操作代码 - 修复BLE OTA中ESP32路径的虚假ACK问题,窗口边界ACK仅在实际写入时触发 - 修复BLE OTA中GD32路径的重复包ACK问题,重复包静默跳过不发送ACK - 调整发送端首轮ACK超时从3000ms提升至5000ms,适配设备端flash写入速度 - 清理临时文件和无用的配置宏定义 - 在main.cpp中添加GD32版本探测逻辑
This commit is contained in:
+12
-8
@@ -107,6 +107,16 @@ static void esp32_reorder_free();
|
||||
static void ble_ota_data_worker_task(void *pvParameters);
|
||||
static void ble_gd32_relay_wait_task(void *pvParameters);
|
||||
|
||||
// 清空 s_otaDataQueue 中的残留批次并释放其 data 指针。
|
||||
// 仅用于纯清理场景;带计数/日志的清理请保留内联实现。
|
||||
static void drainOtaDataQueue()
|
||||
{
|
||||
BleOtaDataBatch stale;
|
||||
while (xQueueReceive(s_otaDataQueue, &stale, 0) == pdTRUE) {
|
||||
if (stale.data) free(stale.data);
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
/**
|
||||
* @brief 获取 BleOta 单例实例。
|
||||
@@ -1683,10 +1693,7 @@ static int ble_ota_gap_event(struct ble_gap_event *event, void *arg)
|
||||
|
||||
// ★ 断开时清空数据队列,丢弃属于旧会话的残留包
|
||||
if (s_otaDataQueue) {
|
||||
BleOtaDataBatch stale;
|
||||
while (xQueueReceive(s_otaDataQueue, &stale, 0) == pdTRUE) {
|
||||
free(stale.data);
|
||||
}
|
||||
drainOtaDataQueue();
|
||||
}
|
||||
|
||||
BleOta::instance().m_bleConnected = false;
|
||||
@@ -2018,10 +2025,7 @@ esp_err_t BleOta::suspendStack()
|
||||
m_suspendedForWifiOta = true;
|
||||
|
||||
if (s_otaDataQueue) {
|
||||
BleOtaDataBatch drop;
|
||||
while (xQueueReceive(s_otaDataQueue, &drop, 0) == pdTRUE) {
|
||||
free(drop.data);
|
||||
}
|
||||
drainOtaDataQueue();
|
||||
}
|
||||
|
||||
return ESP_OK;
|
||||
|
||||
Reference in New Issue
Block a user