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
-2
@@ -186,6 +186,20 @@ public:
|
||||
*/
|
||||
static IRelayListener* getRelayListener();
|
||||
|
||||
// ── 队列访问器(解决 M3: 封装 public static 成员)──
|
||||
/**
|
||||
* @brief 获取事件分发队列句柄。
|
||||
* 外部模块(OtaCoordinator / BLE)通过 getter 访问,不再直接引用静态成员。
|
||||
* @return dispatchQueue 句柄,未初始化时为 NULL。
|
||||
*/
|
||||
static QueueHandle_t getDispatchQueue();
|
||||
|
||||
/**
|
||||
* @brief 获取结果回传队列句柄。
|
||||
* @return resultQueue 句柄,未初始化时为 NULL。
|
||||
*/
|
||||
static QueueHandle_t getResultQueue();
|
||||
|
||||
// ── Flash 操作已迁移至 Gd32FlashStore(storage/gd32_flash_store.h)──
|
||||
|
||||
// ── 公开状态成员 ──
|
||||
@@ -194,8 +208,6 @@ public:
|
||||
static uint32_t relayTotalPackets; ///< 本次中继总包数
|
||||
static volatile bool gd32AppAlive; ///< GD32 APP 存活标志
|
||||
static gd32_version_t gd32Version; ///< GD32 固件版本信息
|
||||
static QueueHandle_t dispatchQueue; ///< 事件分发队列
|
||||
static QueueHandle_t resultQueue; ///< 结果回传队列
|
||||
static TaskHandle_t taskHandle; ///< OTA 中继任务句柄
|
||||
static IRelayListener *s_relayListener; ///< 中继事件监听器(解决 H4)
|
||||
|
||||
@@ -230,6 +242,10 @@ public:
|
||||
static constexpr size_t GD32_CHALLENGE_RESPONSE_LEN = 36;
|
||||
|
||||
private:
|
||||
// ── 队列(M3: 由 getter 访问,外部不再直接引用)──
|
||||
static QueueHandle_t dispatchQueue; ///< 事件分发队列
|
||||
static QueueHandle_t resultQueue; ///< 结果回传队列
|
||||
|
||||
OtaRelay() = default;
|
||||
~OtaRelay() = default;
|
||||
OtaRelay(const OtaRelay&) = delete;
|
||||
|
||||
Reference in New Issue
Block a user