|
|
|
@ -18,7 +18,9 @@ |
|
|
|
******************************************************************************/ |
|
|
|
#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" |
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
|
* 外部变量说明 * |
|
|
|
@ -40,6 +42,8 @@ |
|
|
|
* 模块级变量 * |
|
|
|
*----------------------------------------------*/ |
|
|
|
static uint32_t g_uiCustomModuleID = 0; |
|
|
|
SP_MSP_MK32_Button g_stMK32; |
|
|
|
PV_struct_define g_stPV; |
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
|
* 常量定义 * |
|
|
|
@ -60,7 +64,42 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) |
|
|
|
{ |
|
|
|
case CUSTOM_GET_PV: |
|
|
|
{ |
|
|
|
//log_i("RBCORE_CMD_STOP_ALL");
|
|
|
|
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: |
|
|
|
@ -70,20 +109,10 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) |
|
|
|
|
|
|
|
void Custom_Task(void *argument) |
|
|
|
{ |
|
|
|
g_uiCustomModuleID = MsgCenter_Register(MODULE_NAME_CUSTOM, Custom_ModuleHandler); |
|
|
|
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); |
|
|
|
} |
|
|
|
|