diff --git a/BCZT/user/MotorCtrl.c b/BCZT/user/MotorCtrl.c index 8039445..de793d9 100644 --- a/BCZT/user/MotorCtrl.c +++ b/BCZT/user/MotorCtrl.c @@ -141,8 +141,14 @@ void setMotorState(uint8_t motorid,uint8_t act) uint16_t MotorTarget[6] = {0}; void setMotorTarget(uint8_t motorid,uint16_t target) { - - MotorTarget[motorid] = target; + if (MotorHardStop1[motorid]!=0 && MotorHardStop2[motorid]!=0) + { + MotorTarget[motorid] = target; + } + else + { + MotorTarget[motorid] = 0; + } } @@ -379,7 +385,7 @@ void AutoCalCtrl(void) wait2++; if (wait2 > 50) { - MotorArr2state++; + MotorArr2state++; setMotorState(MOTOR4,ACT_XQ); autocalcounter[1] = 0; } @@ -658,7 +664,7 @@ void MotorCtrl(void)//10ms if (flagMotorMemoryKeyStart == 1) { countMotorMemoryKeyStart++; - if (countMotorMemoryKeyStart > 500)//5S + if (countMotorMemoryKeyStart > 300)//5S { flagMotorMemoryKeyStart = 0; countMotorMemoryKeyStart = 0; diff --git a/BCZT/user/appTask.c b/BCZT/user/appTask.c index 1863acd..826cde2 100644 --- a/BCZT/user/appTask.c +++ b/BCZT/user/appTask.c @@ -231,7 +231,7 @@ void KeyPressLogic(uint8_t keyid) break; } } - +extern uint8_t flagMotorMemoryKeyStart; void KeyReleaseLogic(uint8_t keyid) { switch (keyid) @@ -287,6 +287,7 @@ void KeyReleaseLogic(uint8_t keyid) default: break; } + flagMotorMemoryKeyStart = 0; }