فهرست منبع

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

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 3 سال پیش
والد
کامیت
5cab0e7091
1فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  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(); //需要加速,暂停定速巡航