فهرست منبع

速度控制模式判断是否停止调制修改

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 2 سال پیش
والد
کامیت
1d28f0c25f
1فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 3 3
      Applications/foc/motor/motor.c

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

@@ -1415,8 +1415,8 @@ static bool mc_can_stop_foc(void) {
 	if (motor.mode == CTRL_MODE_CURRENT) {
 		return false;
 	}
-	if (motor.mode == CTRL_MODE_SPD && motor.s_target_speed != MAX_S16) {
-		return false;
+	if (!motor.b_cruise && !motor.b_epm && motor.mode == CTRL_MODE_SPD && (motor.s_target_speed == MAX_S16 || motor.s_target_speed == 0)) {
+		return true;
 	}
 	if (mc_throttle_released() && PMSM_FOC_GetSpeed() == 0.0f) {
 		if (!PMSM_FOC_AutoHoldding() && motor.epm_dir == EPM_Dir_None) {
@@ -1435,7 +1435,7 @@ static bool mc_can_restart_foc(void) {
 	if (!foc_observer_is_encoder() && !foc_observer_sensorless_stable()){
 		can_start = false;
 	}
-	if (motor.mode == CTRL_MODE_SPD && motor.s_target_speed != MAX_S16) {
+	if (!motor.b_cruise && !motor.b_epm && motor.mode == CTRL_MODE_SPD && (motor.s_target_speed != MAX_S16 && motor.s_target_speed != 0)) {
 		can_start = true;
 	}
 	return can_start;