fix-module/cmd/example

This commit is contained in:
yxming66 2026-01-03 17:58:31 +08:00
parent 66b55f9e99
commit cb2c372a21

View File

@ -6,7 +6,7 @@
#include "cmd.h" #include "cmd.h"
/* ========================================================================== */ /* ========================================================================== */
/* 配置示例 */ /* config示例 */
/* ========================================================================== */ /* ========================================================================== */
/* 默认配置 */ /* 默认配置 */
@ -37,35 +37,58 @@
// /* CMD上下文 */ // /* CMD上下文 */
// static CMD_t g_cmd_ctx; // static CMD_t g_cmd_ctx;
/* ========================================================================== */
/* 队列创建示例 */
/* ========================================================================== */
// #if CMD_RCTypeTable_Index == 0
// task_runtime.msgq.cmd.rc= osMessageQueueNew(3u, sizeof(DR16_t), NULL);
// #elif CMD_RCTypeTable_Index == 1
// task_runtime.msgq.cmd.rc= osMessageQueueNew(3u, sizeof(AT9S_t), NULL);
// #endif
/* ========================================================================== */ /* ========================================================================== */
/* 任务示例 */ /* 任务示例 */
/* ========================================================================== */ /* ========================================================================== */
/* // #if CMD_RCTypeTable_Index == 0
* // DR16_t cmd_dr16;
*/ // #elif CMD_RCTypeTable_Index == 1
// void Example_CMD_Init(void) { // AT9S_t cmd_at9s;
// CMD_Init(&g_cmd_ctx, &g_cmd_config); // #endif
// } // Shoot_CMD_t *cmd_for_shoot;
// Chassis_CMD_t *cmd_for_chassis;
// Gimbal_CMD_t *cmd_for_gimbal;
// /* // static CMD_t cmd;
// * 任务循环示例
// */ // void Task_cmd() {
// void Example_CMD_Task(void) {
// /* 一键更新 */ // CMD_Init(&cmd, &Config_GetRobotParam()->cmd_param);
// CMD_Update(&g_cmd_ctx);
// while (1) {
// #if CMD_RCTypeTable_Index == 0
// osMessageQueueGet(task_runtime.msgq.cmd.rc, &cmd_dr16, NULL, 0);
// #elif CMD_RCTypeTable_Index == 1
// osMessageQueueGet(task_runtime.msgq.cmd.rc, &cmd_at9s, NULL, 0);
// #endif
// CMD_Update(&cmd);
// /* 获取命令发送到各模块 */ // /* 获取命令发送到各模块 */
// Chassis_CMD_t *chassis_cmd = CMD_GetChassisCmd(&g_cmd_ctx); // cmd_for_chassis = CMD_GetChassisCmd(&cmd);
// Gimbal_CMD_t *gimbal_cmd = CMD_GetGimbalCmd(&g_cmd_ctx); // cmd_for_gimbal = CMD_GetGimbalCmd(&cmd);
// Shoot_CMD_t *shoot_cmd = CMD_GetShootCmd(&g_cmd_ctx); // cmd_for_shoot = CMD_GetShootCmd(&cmd);
// osMessageQueueReset(task_runtime.msgq.gimbal.cmd);
// /* 使用命令... */ // osMessageQueuePut(task_runtime.msgq.gimbal.cmd, cmd_for_gimbal, 0, 0);
// (void)chassis_cmd; // osMessageQueueReset(task_runtime.msgq.shoot.cmd);
// (void)gimbal_cmd; // osMessageQueuePut(task_runtime.msgq.shoot.cmd, cmd_for_shoot, 0, 0);
// (void)shoot_cmd; // osMessageQueueReset(task_runtime.msgq.chassis.cmd);
// osMessageQueuePut(task_runtime.msgq.chassis.cmd, cmd_for_chassis, 0, 0);
// } // }
// }
/* ========================================================================== */ /* ========================================================================== */
/* 架构说明 */ /* 架构说明 */
/* ========================================================================== */ /* ========================================================================== */