|
|
|
@ -46,6 +46,7 @@ static uint32_t g_uiMotorModuleID = 0; |
|
|
|
static int g_aiMotorSpeed[MOTOR_INSTANCE_MAX] = {0}; |
|
|
|
static int g_isMotorInit = -1; // -1表示还在等待遥控器初始化完毕,0表示可以进行电机初始化,1表示电机初始化完毕,运行电机主循环
|
|
|
|
static int g_iLastVehicleMove = 0; |
|
|
|
static int g_iInitOnce = 0; // 防止重复初始化标志
|
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
|
* 常量定义 * |
|
|
|
@ -195,7 +196,7 @@ void MotorTask(void *argument) |
|
|
|
// 处理消息
|
|
|
|
MsgCenter_ProcessWait(g_uiMotorModuleID, 2); |
|
|
|
|
|
|
|
if (0 == g_isMotorInit) |
|
|
|
if (0 == g_isMotorInit && 0 == g_iInitOnce) |
|
|
|
{ |
|
|
|
HAL_GPIO_WritePin(OUT_0_GPIO_Port, OUT_0_Pin, 0); |
|
|
|
// 初始化FDCAN1,使用雷赛电机的回调
|
|
|
|
@ -243,6 +244,7 @@ void MotorTask(void *argument) |
|
|
|
MotorMgr_SpeedModeInit(g_apstMotors[0]); |
|
|
|
MotorMgr_SpeedModeInit(g_apstMotors[1]); |
|
|
|
g_isMotorInit = 1; |
|
|
|
g_iInitOnce = 1; |
|
|
|
} |
|
|
|
else if (g_isMotorInit > 0) |
|
|
|
{ |
|
|
|
|