refactor(main): 移除ota_mutex.h全局变量并重构ESP32 OTA互斥锁管理
- 将全局变量g_esp32OtaMutex和g_esp32OtaOccupied内聚到Esp32OtaCore类中 - 通过Esp32OtaCore::initMutex()方法初始化互斥锁替代原main.cpp中的全局初始化 - 重构HealthMonitor中WiFi连接状态管理,推送连接状态到本地成员而非直接查询 - 优化OtaCoordinator中const方法的线程安全实现,移除不必要的const_cast转换 - 封装OtaRelay的队列访问器,提供getDispatchQueue()和getResultQueue()方法 - 解决BLE与WiFi之间的横向耦合问题,通过OtaCoordinator进行射频共存管理 - 移除transport/spi_master.cpp中的CANFD接口实现到独立的canfd_bridge模块 - 优化BLE OTA中ESP32会话的幂等性和新会话处理逻辑 BREAKING CHANGE: 移除了ota_mutex.h全局头文件,相关功能迁移至Esp32OtaCore类中管理
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
|
||||
#include "health_monitor.h"
|
||||
#include "debug_log.h"
|
||||
#include "server/wifi_ota.h"
|
||||
|
||||
// ============================================================
|
||||
// 单例
|
||||
@@ -247,7 +246,7 @@ health_status_t HealthMonitor::checkBeforeOta()
|
||||
DEBUG_WARN("HEALTH", "OTA 前检查: SYS_WARNING,继续传输但需注意");
|
||||
}
|
||||
|
||||
if (!WifiOta::isConnected()) {
|
||||
if (!m_wifiConnected) {
|
||||
DEBUG_WARN("HEALTH", "OTA 前检查: WiFi 未连接");
|
||||
return HEALTH_MON_CRITICAL;
|
||||
}
|
||||
@@ -312,6 +311,18 @@ health_status_t HealthMonitor::checkBeforeOtaRelay()
|
||||
return status;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// WiFi 连接状态推送(由 WiFi 事件回调调用)
|
||||
// ============================================================
|
||||
/**
|
||||
* @brief 由 WiFi 事件回调推送连接状态。
|
||||
* @param connected true=已连接,false=断开。
|
||||
*/
|
||||
void HealthMonitor::setWifiConnected(bool connected)
|
||||
{
|
||||
m_wifiConnected = connected;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// WiFi RSSI 更新
|
||||
// ============================================================
|
||||
|
||||
Reference in New Issue
Block a user