1、修改电机驱动PWM源为TIMER4 U;启用缓启动缓停止。
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "Debug.h"
|
||||
#include "main.h"
|
||||
#include "bsp.h"
|
||||
#include "dc_motor.h"
|
||||
|
||||
#if (USE_DEBUG != 0)
|
||||
#define DEBUG_CMD_CNT 8
|
||||
@@ -213,6 +214,7 @@ void DebugCmdHelp(int argc, char *argv[])
|
||||
DBG_LOG("Debug Cmd:\r\n\
|
||||
disp task on/off -->Open the task display.\r\n\
|
||||
help\
|
||||
dcmotor\
|
||||
");
|
||||
}
|
||||
|
||||
@@ -265,13 +267,49 @@ void DebugCmdHelp(int argc, char *argv[])
|
||||
// TimeSync(num);
|
||||
//}
|
||||
|
||||
extern uint8_t KeyASta;
|
||||
extern uint8_t KeyBSta;
|
||||
extern uint8_t RunSta;
|
||||
void MotorSwitch(int argc, char *argv[])
|
||||
{
|
||||
// 如果参数个数小于2,则返回
|
||||
if(argc < 2)
|
||||
return;
|
||||
// 如果第一个参数为?,则打印帮助信息
|
||||
if(strcmp(argv[1], "?") == 0)
|
||||
{
|
||||
DBG_LOG("DCMotor Cmd:\r\n\
|
||||
motor F/R/S -->Turn the motor on or off.\r\n");
|
||||
return;
|
||||
}
|
||||
// 如果第一个参数为on,则开启SonarWork
|
||||
if(strcmp(argv[1], "R") == 0)
|
||||
{
|
||||
KeyASta = true;
|
||||
Motor_Control(MOTOR_CMD_REVERSE);
|
||||
DBG_LOG("Motor FORWARD\r\n");
|
||||
}
|
||||
// 如果第一个参数为off,则关闭SonarWork
|
||||
else if(strcmp(argv[1], "F") == 0)
|
||||
{
|
||||
KeyBSta = true;
|
||||
Motor_Control(MOTOR_CMD_FORWARD);
|
||||
DBG_LOG("Motor REVERSE\r\n");
|
||||
}
|
||||
else if(strcmp(argv[1], "S") == 0)
|
||||
{
|
||||
KeyASta = false;
|
||||
KeyBSta = false;
|
||||
Motor_Control(MOTOR_CMD_STOP);
|
||||
DBG_LOG("Motor OFF\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
const DBGFunType DebugFun[DEBUG_CMD_CNT] = {
|
||||
"help", DebugCmdHelp,
|
||||
// "TimeSync", (void*)TimeSync,
|
||||
// "SetTime", SetTime,
|
||||
"motor", MotorSwitch,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user