Преглед изворни кода

定速巡航和能量回收的时候,mc_process_throttle_torque 不处理转把释放的情况

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui пре 2 година
родитељ
комит
61b5c17d76
1 измењених фајлова са 13 додато и 0 уклоњено
  1. 13 0
      Applications/foc/motor/motor.c

+ 13 - 0
Applications/foc/motor/motor.c

@@ -1486,6 +1486,19 @@ static void mc_motor_runstop(void) {
 }
 static void mc_process_throttle_torque(float vol) {
 	float torque = throttle_get_torque(&motor.controller, vol);
+
+	if (mc_throttle_released()) {
+#ifdef CONFIG_CRUISE_ENABLE_ACCL
+		if (mc_is_cruise_enabled()) {
+			return;
+		}
+#endif
+		if (mot_contrl_energy_recovery(&motor.controller, true)) {
+			return;
+		}
+
+	}
+
 	if (motor.controller.mode_running == CTRL_MODE_TRQ) {
 		throttle_set_torque(&motor.controller, torque);
 	}else if (motor.controller.mode_running == CTRL_MODE_SPD) {