Browse Source

解决速度不更新导致的停车时间bug,这里速度应该是静态变量

paint_robot_new-v1.5
Lizongdi 2 weeks ago
parent
commit
cef919640e
  1. 5
      project/paint_robot_new/paint_robot_new.c
  2. 10
      project/paint_robot_new/paint_robot_new_motors.c

5
project/paint_robot_new/paint_robot_new.c

@ -394,6 +394,10 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg)
g_Paint_State = 0;
MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_CMD_PAINTGUN, &g_Paint_State, sizeof(int));
}
else
{
log_w("cannot open paint with 0 move speed !");
}
}
CH13_S2_Value = g_stMK32.CH13_S2;
}
@ -449,7 +453,6 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg)
if ((g_stPV.RunMode == 2 || g_stPV.RunMode == 3) && 0 == iPaint)
{
MsgCenter_SendTo(MODULE_NAME_MOTOR, MOTOR_CMD_STOP_AFTER, NULL, 0);
log_e("MOTOR_CMD_STOP_AFTER");
}
else
{

10
project/paint_robot_new/paint_robot_new_motors.c

@ -20,6 +20,7 @@
#include "motor_manager.h"
#include "msp_motor_leisai.h"
#include "msg_center.h"
#include "lua_base.h"
/*----------------------------------------------*
* 外部变量说明 *
@ -61,7 +62,7 @@ static void Motor_ModuleHandler(const Msg_t *pstMsg)
return;
}
int iSpeed = 1;
static int iSpeed = 1;
static uint32_t uiLastTime = 0;
switch (pstMsg->m_uiMsgID)
{
@ -136,6 +137,13 @@ static void Motor_ModuleHandler(const Msg_t *pstMsg)
{
memset(g_aiMotorSpeed, 0, sizeof(g_aiMotorSpeed));
uiLastTime = Rd_GetTime();
g_iLastVehicleMove = 0;
break;
}
case COMMON_CMD_SHOW_INFO:
{
lua_print("iSpeed = %d\nuiLastTime = %d\ng_isMotorInit = %d\ng_iLastVehicleMove = %d\n",
iSpeed, uiLastTime, g_isMotorInit, g_iLastVehicleMove);
break;
}
default:

Loading…
Cancel
Save