Browse Source

增加错误码上报逻辑并在各个模块添加错误码置位

paint_robot_new-v1.5
Lizongdi 2 weeks ago
parent
commit
99e4ea7a35
  1. 1
      RBcore/TL720D.c
  2. 1
      RBcore/client_setting.c
  3. 2
      RBcore/drv_interface.c
  4. 1
      controller/msp_MK32.c
  5. 15
      project/paint_robot_new/paint_robot_new.c
  6. 8
      project/paint_robot_new/paint_robot_new_motors.c

1
RBcore/TL720D.c

@ -126,6 +126,7 @@ static void decode_TL720D(const char *buf, uint32_t _iSize)
uiLastSendTick = uiNowTick;
MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_GET_TL720D_ROLL, (void *)&g_stTL720D.RF_Angle_Roll, sizeof(int32_t));
MsgCenter_SendTo(MODULE_NAME_RBCORE, RBCORE_GET_TL720D_ROLL, (void *)&g_stTL720D.RF_Angle_Roll, sizeof(int32_t));
MsgCenter_SendTo(MODULE_NAME_DAEMON, DAEMON_SET_TL720D, NULL, 0);
}
}

1
RBcore/client_setting.c

@ -85,6 +85,7 @@ void decode_PV(const char *_pBuffer, uint32_t _iSize)
{
decoded_PV=decoded_PV_variable;
MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_GET_PV, (void *)&decoded_PV, sizeof(decoded_PV));
MsgCenter_SendTo(MODULE_NAME_DAEMON, DAEMON_SET_MK32_SERIAL, NULL, 0);
}
}
else if (*(_pBuffer + 2) == 0x02 && *(_pBuffer + 3) == 0x01) //设置PV

2
RBcore/drv_interface.c

@ -255,6 +255,7 @@ void SendIV_Init(void);
void TL720D_Init(void);
void RBcore_Init(void);
void controller_init(void);
void daemon_Init(void);
void Drv_InterfaceInit(void)
{
@ -304,4 +305,5 @@ void Drv_InterfaceInit(void)
(void)osThreadNew(Read_PV, NULL, &Read_PV_attributes);
TL720D_Init();
daemon_Init();
}

1
controller/msp_MK32.c

@ -116,6 +116,7 @@ void decode_MK32(const char *buf, uint32_t _iSize)
uiLastSendTick = uiNowTick;
MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_GET_MK32, (void *)&RB_MK32,
sizeof(RB_MK32));
MsgCenter_SendTo(MODULE_NAME_DAEMON, DAEMON_SET_MK32_SBUS, NULL, 0);
}
}

15
project/paint_robot_new/paint_robot_new.c

@ -51,6 +51,7 @@ static int g_RB_State = 0; // 机器人状态,1表示处于竖直行走模式
static int g_Paint_State = -1; // 喷枪状态,0表示打开,1表示关闭
static int angle_protect_lock = 0; // 为1表示角度异常,触发停车逻辑Move_Halt_AngleError
static int g_ipaintOffCount = 0; // Move_Halt_AngleError中的计时,即角度偏移超过多少时间触发停枪
static int Is_All_Button_Reset = 0; // 1表示按钮正常工作,0表示需要复位
/*----------------------------------------------*
* 常量定义 *
@ -262,6 +263,19 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg)
RD_MEMCPY(&g_stMK32, pstMsg->m_aucData, sizeof(g_stMK32));
}
if (Is_All_Button_Reset == 0)
{
if (g_stMK32.CH4_SA == 0 && g_stMK32.CH5_SB == 0 && g_stMK32.CH6_SC == 0
&& g_stMK32.CH7_SD == 0 && g_stMK32.IsOnline == 1)
{
Is_All_Button_Reset = 1;
}
}
else if (Is_All_Button_Reset == 1)
{
MsgCenter_SendTo(MODULE_NAME_DAEMON, DAEMON_SET_BUTTON_RESET, NULL, 0);
}
// 急停或者遥控器失联
if ((g_stMK32.CH8_SE == -1000 && g_stMK32.CH9_SF == -1000)
|| g_stMK32.IsOnline == 0 || g_stIV.Left_Motor_Err != 0 || g_stIV.Right_Motor_Err != 0)
@ -269,6 +283,7 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg)
MsgCenter_SendTo(MODULE_NAME_MOTOR, MOTOR_POWER_DISABLE, NULL, 0);
MsgCenter_SendTo(MODULE_NAME_RBCORE, RBCORE_CMD_STOP_ALL, NULL, 0);
g_RB_State = 0;
Is_All_Button_Reset = 0;
break;
}

8
project/paint_robot_new/paint_robot_new_motors.c

@ -113,6 +113,14 @@ static void decode_LeiSaiMotor(const char *_pBuffer, uint32_t _iSize)
// 调用电机管理模块解析响应
MotorMgr_ParseResponse(ucMotorID, (const uint8_t *)_pBuffer, _iSize);
if (1 == ucMotorID)
{
MsgCenter_SendTo(MODULE_NAME_DAEMON, DAEMON_SET_LEFT_MOTOR, NULL, 0);
}
else if (2 == ucMotorID)
{
MsgCenter_SendTo(MODULE_NAME_DAEMON, DAEMON_SET_RIGHT_MOTOR, NULL, 0);
}
}
void MotorTask(void *argument)

Loading…
Cancel
Save