You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

93 lines
2.7 KiB

/******************************************************************************
版权所有 (C), 2018-2099, Radkil
******************************************************************************
文 件 名 : paint_robot_new.c
版 本 号 : 初稿
作 者 : radkil
生成日期 : 2026年7月14日
最近修改 :
功能描述 : 新版喷漆主逻辑
修改历史 :
1.日 期 : 2026年7月14日
作 者 : radkil
修改内容 : 创建文件
******************************************************************************/
#include "BHBF.h"
#include "msg_center.h"
#include "Protobuf/PSource/bsp_PV.pb.h"
/*----------------------------------------------*
* 外部变量说明 *
*----------------------------------------------*/
/*----------------------------------------------*
* 外部函数原型说明 *
*----------------------------------------------*/
/*----------------------------------------------*
* 内部函数原型说明 *
*----------------------------------------------*/
/*----------------------------------------------*
* 全局变量 *
*----------------------------------------------*/
/*----------------------------------------------*
* 模块级变量 *
*----------------------------------------------*/
static uint32_t g_uiCustomModuleID = 0;
/*----------------------------------------------*
* 常量定义 *
*----------------------------------------------*/
/*----------------------------------------------*
* 宏定义 *
*----------------------------------------------*/
static void Custom_ModuleHandler(const Msg_t *pstMsg)
{
if (NULL == pstMsg)
{
return;
}
switch (pstMsg->m_uiMsgID)
{
case CUSTOM_GET_PV:
{
//log_i("RBCORE_CMD_STOP_ALL");
Motor_CmdData_t tMotor_CmdData_t = {0};
tMotor_CmdData_t.m_ucMotorIndex = 1;
tMotor_CmdData_t.m_iValue = (int32_t)pstMsg->m_aucData;
MsgCenter_SendTo(MODULE_NAME_MOTOR, MOTOR_CMD_SET_SPEED, (void *)&tMotor_CmdData_t, sizeof(Motor_CmdData_t));
break;
}
default:
break;
}
}
void Custom_Task(void *argument)
{
while(1)
{
MsgCenter_ProcessWait(g_uiCustomModuleID, 2);
}
}
void Custom_Init(void)
{
g_uiCustomModuleID = MsgCenter_Register(MODULE_NAME_CUSTOM, Custom_ModuleHandler);
const osThreadAttr_t Custom_attributes = {
.name = MODULE_NAME_CUSTOM,
.stack_size = 1024,
.priority = (osPriority_t) osPriorityRealtime,
};
(void)osThreadNew(Custom_Task, NULL, &Custom_attributes);
}