feat(esp32): 添加多电机OTA中继功能并优化调试日志系统
- 新增多电机状态、版本和OTA中继监控模块(monitor/motor_state.cpp, monitor/motor_version.cpp, monitor/motor_ota_relay.cpp) - 在CAN反馈任务中添加0xC5/0xC6/0xD2类型消息处理,支持多电机状态推送 - 重构调试日志系统,将一次性JSON分配改为512B栈缓冲流式发送,降低内存峰值 - 调试UART波特率从115200提升至30000 - 修改版本管理方式,从自动生version.h改为手动维护 - 更新VSCode设置以支持ESP-IDF开发环境配置 - 在OTA协调器中添加电机OTA互斥机制,防止并发冲突 - 完善中继状态机异常处理,添加远程取消通知机制
This commit is contained in:
@@ -22,6 +22,9 @@
|
||||
#include "monitor/debug_log.h"
|
||||
#include "monitor/can_feedback_task.h"
|
||||
#include "monitor/gd32_adc_feedback.h"
|
||||
#include "monitor/motor_state.h"
|
||||
#include "monitor/motor_version.h"
|
||||
#include "monitor/motor_ota_relay.h"
|
||||
#include "app_config.h"
|
||||
#include "esp_system.h"
|
||||
|
||||
@@ -33,6 +36,9 @@ constexpr uint32_t kWaitRingMs = 500U; ///< 单次等待 GD32 按铃超
|
||||
constexpr uint32_t kPauseDelayMs = 100U; ///< 暂停时的轮询间隔
|
||||
constexpr uint8_t kSpiCanFeedbackType = 0xC1U;
|
||||
constexpr uint8_t kSpiAdcFeedbackType = 0xC4U; ///< GD32 ADC 调试反馈
|
||||
constexpr uint8_t kSpiMotorStateType = 0xC5U; ///< GD32 多电机状态推送
|
||||
constexpr uint8_t kSpiMotorVersionType = 0xC6U; ///< GD32 多电机版本推送(事件驱动)
|
||||
constexpr uint8_t kSpiMotorOtaStatusType = 0xD2U; ///< GD32 电机 OTA relay 进度推送
|
||||
constexpr size_t kRingPayloadMax = SPI_OTA_FRAME_MAX; ///< 与变长读一致,避免截断
|
||||
constexpr const char *kTag = "CAN_FB";
|
||||
|
||||
@@ -102,6 +108,24 @@ static void taskLoop(void *)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* 0xC5 多电机状态推送:GD32 250ms 分页推送,ESP32 解析入缓存 */
|
||||
if (ring_type == kSpiMotorStateType) {
|
||||
(void)onMotorStateEvent(ring_payload, ring_len);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* 0xC6 多电机版本推送:GD32 收到电机版本应答(0x00FF)后事件驱动推送 */
|
||||
if (ring_type == kSpiMotorVersionType) {
|
||||
(void)onMotorVersionEvent(ring_payload, ring_len);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* 0xD2 电机 OTA relay 进度推送 */
|
||||
if (ring_type == kSpiMotorOtaStatusType) {
|
||||
onMotorOtaStatusPush(ring_payload, ring_len);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ring_type != kSpiCanFeedbackType || ring_len < 28U) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user