修复BUG:1.运动结束后需要按2次记忆按键;2.增加取消记忆功能,调整超时时间为3S

This commit is contained in:
sunbeam 2024-03-21 15:12:04 +08:00
parent a39904dbff
commit 8d8474adb2
2 changed files with 12 additions and 5 deletions

View File

@ -141,8 +141,14 @@ void setMotorState(uint8_t motorid,uint8_t act)
uint16_t MotorTarget[6] = {0}; uint16_t MotorTarget[6] = {0};
void setMotorTarget(uint8_t motorid,uint16_t target) void setMotorTarget(uint8_t motorid,uint16_t target)
{ {
if (MotorHardStop1[motorid]!=0 && MotorHardStop2[motorid]!=0)
MotorTarget[motorid] = target; {
MotorTarget[motorid] = target;
}
else
{
MotorTarget[motorid] = 0;
}
} }
@ -379,7 +385,7 @@ void AutoCalCtrl(void)
wait2++; wait2++;
if (wait2 > 50) if (wait2 > 50)
{ {
MotorArr2state++; MotorArr2state++;
setMotorState(MOTOR4,ACT_XQ); setMotorState(MOTOR4,ACT_XQ);
autocalcounter[1] = 0; autocalcounter[1] = 0;
} }
@ -658,7 +664,7 @@ void MotorCtrl(void)//10ms
if (flagMotorMemoryKeyStart == 1) if (flagMotorMemoryKeyStart == 1)
{ {
countMotorMemoryKeyStart++; countMotorMemoryKeyStart++;
if (countMotorMemoryKeyStart > 500)//5S if (countMotorMemoryKeyStart > 300)//5S
{ {
flagMotorMemoryKeyStart = 0; flagMotorMemoryKeyStart = 0;
countMotorMemoryKeyStart = 0; countMotorMemoryKeyStart = 0;

View File

@ -231,7 +231,7 @@ void KeyPressLogic(uint8_t keyid)
break; break;
} }
} }
extern uint8_t flagMotorMemoryKeyStart;
void KeyReleaseLogic(uint8_t keyid) void KeyReleaseLogic(uint8_t keyid)
{ {
switch (keyid) switch (keyid)
@ -287,6 +287,7 @@ void KeyReleaseLogic(uint8_t keyid)
default: default:
break; break;
} }
flagMotorMemoryKeyStart = 0;
} }