From 8d8474adb2c8fb3994714a04954244001b9bb7de Mon Sep 17 00:00:00 2001 From: sunbeam Date: Thu, 21 Mar 2024 15:12:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DBUG:1.=E8=BF=90=E5=8A=A8?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E5=90=8E=E9=9C=80=E8=A6=81=E6=8C=892?= =?UTF-8?q?=E6=AC=A1=E8=AE=B0=E5=BF=86=E6=8C=89=E9=94=AE;2.=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=8F=96=E6=B6=88=E8=AE=B0=E5=BF=86=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=8C=E8=B0=83=E6=95=B4=E8=B6=85=E6=97=B6=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E4=B8=BA3S?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BCZT/user/MotorCtrl.c | 14 ++++++++++---- BCZT/user/appTask.c | 3 ++- 2 files changed, 12 insertions(+), 5 deletions(-) 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; }