更新电机工作流程

This commit is contained in:
sunbeam 2024-01-06 17:05:59 +08:00
parent 9d3b9313c9
commit 46c6538c8b
2 changed files with 30 additions and 10 deletions

File diff suppressed because one or more lines are too long

View File

@ -37,6 +37,8 @@ void setMotorState(uint8_t motorid,uint8_t act)
#define MOTOR_DELAY_TIME_8S (800)
#define MOTOR_DELAY_TIME_6S (600)
#define MOTOR_DELAY_TIME_15S (1500)
#define MOTOR_DELAY_TIME_17S (1700)
void MotorCtrl(void)//10ms
{
static uint16_t MotorRunCount;
@ -49,10 +51,19 @@ void MotorCtrl(void)//10ms
break;
case ACT_XQ:
MotorRunCount++;
MotorStateReal[MOTOR1] = ACT_XQ;
if (MotorRunCount > MOTOR_DELAY_TIME_15S)
{
MotorRunCount = MOTOR_DELAY_TIME_15S;
MotorStateReal[MOTOR1] = ACT_NOACT;
}
else
{
MotorStateReal[MOTOR1] = ACT_XQ;
}
if (MotorRunCount > MOTOR_DELAY_TIME_6S)
{
MotorRunCount = MOTOR_DELAY_TIME_6S;
//MotorRunCount = MOTOR_DELAY_TIME_6S;
MotorStateReal[MOTOR2] = ACT_XQ;
}
else
@ -64,10 +75,19 @@ void MotorCtrl(void)//10ms
case ACT_XH:
MotorRunCount++;
MotorStateReal[MOTOR2] = ACT_XH;
if (MotorRunCount > MOTOR_DELAY_TIME_17S)
{
MotorRunCount = MOTOR_DELAY_TIME_17S;
MotorStateReal[MOTOR2] = ACT_NOACT;
}
else
{
MotorStateReal[MOTOR2] = ACT_XH;
}
if (MotorRunCount > MOTOR_DELAY_TIME_8S)
{
MotorRunCount = MOTOR_DELAY_TIME_8S;
//MotorRunCount = MOTOR_DELAY_TIME_8S;
MotorStateReal[MOTOR1] = ACT_XH;
}
else