Explorar el Código

每次进入定速巡航后,需要间隔一定时间才能使能转把加速功能

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui hace 3 años
padre
commit
5cab0e7091
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3 2
      Applications/foc/motor/motor.c

+ 3 - 2
Applications/foc/motor/motor.c

@@ -1026,9 +1026,10 @@ static void mc_process_curise(void) {
 			return;
 		}
 		if (PMSM_FOC_Is_CruiseEnabled()) {
-			if ((shark_get_seconds() - motor.cruise_time >= 3) && motor.cruise_torque == 0.0f) {
+			u32 cruise_time = shark_get_seconds() - motor.cruise_time;
+			if ((cruise_time >= 3) && motor.cruise_torque == 0.0f) {
 				motor.cruise_torque = PMSM_FOC_Get()->in.s_targetTorque;
-			}else if (motor.cruise_torque > 0.0f){
+			}else if ((cruise_time >= 3) && (motor.cruise_torque > 0.0f)){
 				float trq_req = get_thro_request_torque();
 				if (trq_req > motor.cruise_torque * 1.2f) {
 					PMSM_FOC_PauseCruise(); //需要加速,暂停定速巡航