refactor(device): 重构SPI命令处理为模块化架构
- 将原有的 monolithic app_spi_command.cpp 拆分为多个专门的命令处理器文件 - 新增 spi_command_handler.h 定义命令处理器接口和上下文结构 - 新增 app_spi_command_defs.h 提取公共协议常量定义 - 新增多个具体命令处理器实现文件: - app_spi_cmd_boot_request.cpp (进入Bootloader命令) - app_spi_cmd_ota_wait.cpp (OTA等待响应命令) - app_spi_cmd_ping.cpp (APP心跳ping命令) - app_spi_cmd_can_bridge.cpp (SPI到CAN桥接命令) - 修改 app_spi_command.cpp 仅负责SPI链路管理和命令路由逻辑 - 更新配置文件添加新源文件到项目编译列表 - 调整全局实例为对象实例(AppSpiCommandBus),移除静态方法依赖 - 更新README文档说明新的SPI命令总线拆分架构 - 微调版本号(patch: 0 -> 1, build: 2 -> 0)
This commit is contained in:
@@ -125,9 +125,9 @@
|
||||
/** @brief APP 次版本号。 */
|
||||
#define APP_FW_VERSION_MINOR 0U
|
||||
/** @brief APP 补丁版本号。 */
|
||||
#define APP_FW_VERSION_PATCH 0U
|
||||
#define APP_FW_VERSION_PATCH 1U
|
||||
/** @brief APP 构建编号。 */
|
||||
#define APP_FW_VERSION_BUILD 2U
|
||||
#define APP_FW_VERSION_BUILD 0U
|
||||
|
||||
/* ============================================================
|
||||
* BOOT 版本在 OTA 配置页中的 Flash 存储地址
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* @file cpp_stubs.cpp
|
||||
* @brief C++ runtime stubs for bare-metal microlib.
|
||||
*
|
||||
* microlib 的 aeabi_atexit.o 需要两个外部符号:
|
||||
* - _atexit_init(void) : 初始化 atexit 互斥量(裸机无 RTOS,空实现)
|
||||
* - _atexit_mutex (int) : 互斥量变量,aeabi_atexit 用它做线程安全守卫
|
||||
*
|
||||
* 嵌入式常驻程序不存在 exit-time 析构,这里提供最小空实现让链接通过。
|
||||
*/
|
||||
|
||||
extern "C" {
|
||||
|
||||
void _atexit_init(void)
|
||||
{
|
||||
/* 裸机无 RTOS,互斥量不需要真正初始化 */
|
||||
}
|
||||
|
||||
/* aeabi_atexit.o 将此符号当作 int 变量读写,不是函数。 */
|
||||
int _atexit_mutex = 0;
|
||||
|
||||
} // extern "C"
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* @file initial.cpp
|
||||
* @brief 应用启动初始化实现。
|
||||
*/
|
||||
@@ -37,7 +37,7 @@ void AppInitializer::init()
|
||||
printf("[APP] init: OtaBootRequest...\r\n");
|
||||
OtaBootRequest::init();
|
||||
printf("[APP] init: AppSpiCommand...\r\n");
|
||||
AppSpiCommand::init();
|
||||
AppSpiCommandBus.init();
|
||||
printf("[APP] init: TaskManager...\r\n");
|
||||
TaskManager::init();
|
||||
printf("[APP] init: SchedulerTimer...\r\n");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* @file task_runner.cpp
|
||||
* @brief 任务执行器实现。
|
||||
*/
|
||||
@@ -307,5 +307,5 @@ void TaskRunner::runPending()
|
||||
if(pending & (1UL << TASK_STATUS_LED)) taskStatusLed();
|
||||
if(pending & (1UL << TASK_HEARTBEAT)) taskHeartbeat();
|
||||
if(pending & (1UL << TASK_DIAGNOSTIC_PRINT)) taskDiagnosticPrint();
|
||||
if(pending & (1UL << TASK_SPI_LOG)) AppSpiCommand::poll();
|
||||
if(pending & (1UL << TASK_SPI_LOG)) AppSpiCommandBus.poll();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user