|
|
|
|
/******************************************************************************
|
|
|
|
|
|
|
|
|
|
版权所有 (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 "lua_base.h"
|
|
|
|
|
#include "Protobuf/PSource/bsp_PV.pb.h"
|
|
|
|
|
#include "Protobuf/PSource/msp_MK32.pb.h"
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
|
|
* 外部变量说明 *
|
|
|
|
|
*----------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
|
|
* 外部函数原型说明 *
|
|
|
|
|
*----------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
|
|
* 内部函数原型说明 *
|
|
|
|
|
*----------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
|
|
* 全局变量 *
|
|
|
|
|
*----------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
|
|
* 模块级变量 *
|
|
|
|
|
*----------------------------------------------*/
|
|
|
|
|
static uint32_t g_uiCustomModuleID = 0;
|
|
|
|
|
SP_MSP_MK32_Button g_stMK32;
|
|
|
|
|
PV_struct_define g_stPV;
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
|
|
* 常量定义 *
|
|
|
|
|
*----------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
|
|
* 宏定义 *
|
|
|
|
|
*----------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
static void Custom_ModuleHandler(const Msg_t *pstMsg)
|
|
|
|
|
{
|
|
|
|
|
if (NULL == pstMsg)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (pstMsg->m_uiMsgID)
|
|
|
|
|
{
|
|
|
|
|
case CUSTOM_GET_PV:
|
|
|
|
|
{
|
|
|
|
|
if (pstMsg->m_uiDataLen >= sizeof(g_stPV))
|
|
|
|
|
{
|
|
|
|
|
RD_MEMCPY(&g_stPV, pstMsg->m_aucData, sizeof(g_stPV));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case CUSTOM_GET_MK32:
|
|
|
|
|
{
|
|
|
|
|
if (pstMsg->m_uiDataLen >= sizeof(g_stMK32))
|
|
|
|
|
{
|
|
|
|
|
RD_MEMCPY(&g_stMK32, pstMsg->m_aucData, sizeof(g_stMK32));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case LUA_SHOW_INFO:
|
|
|
|
|
{
|
|
|
|
|
lua_print("MK32 Info\nRxIndex:%d\tIsOnline:%d\n", g_stMK32.RxIndex, g_stMK32.IsOnline);
|
|
|
|
|
lua_print("CH0_RY_H\t%d\n", g_stMK32.CH0_RY_H);
|
|
|
|
|
lua_print("CH1_RY_V\t%d\n", g_stMK32.CH1_RY_V);
|
|
|
|
|
lua_print("CH2_LY_V\t%d\n", g_stMK32.CH2_LY_V);
|
|
|
|
|
lua_print("CH3_LY_H\t%d\n", g_stMK32.CH3_LY_H);
|
|
|
|
|
lua_print("CH4_SA \t%d\n", g_stMK32.CH4_SA);
|
|
|
|
|
lua_print("CH5_SB \t%d\n", g_stMK32.CH5_SB);
|
|
|
|
|
lua_print("CH6_SC \t%d\n", g_stMK32.CH6_SC);
|
|
|
|
|
lua_print("CH7_SD \t%d\n", g_stMK32.CH7_SD);
|
|
|
|
|
lua_print("CH8_SE \t%d\n", g_stMK32.CH8_SE);
|
|
|
|
|
lua_print("CH9_SF \t%d\n", g_stMK32.CH9_SF);
|
|
|
|
|
lua_print("CH10_LD1\t%d\n", g_stMK32.CH10_LD1);
|
|
|
|
|
lua_print("CH11_RD1\t%d\n", g_stMK32.CH11_RD1);
|
|
|
|
|
lua_print("CH12_S1 \t%d\n", g_stMK32.CH12_S1);
|
|
|
|
|
lua_print("CH13_S2 \t%d\n", g_stMK32.CH13_S2);
|
|
|
|
|
lua_print("CH14_LT \t%d\n", g_stMK32.CH14_LT);
|
|
|
|
|
lua_print("CH15_RT \t%d\n", g_stMK32.CH15_RT);
|
|
|
|
|
lua_print("PV Info\n");
|
|
|
|
|
lua_print("RunMode = %d\nRobotSpeed = %d\nVertical_Calibration = %d\nIV_IsRestart_Notified = %d\nTimeStamp = %d\n",
|
|
|
|
|
g_stPV.RunMode, g_stPV.RobotSpeed, g_stPV.Vertical_Calibration, g_stPV.IV_IsRestart_Notified, g_stPV.TimeStamp);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Custom_Task(void *argument)
|
|
|
|
|
{
|
|
|
|
|
g_uiCustomModuleID = MsgCenter_Register(MODULE_NAME_CUSTOM, Custom_ModuleHandler);
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
MsgCenter_ProcessWait(g_uiCustomModuleID, 2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|