Explorar o código

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

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui %!s(int64=2) %!d(string=hai) anos
pai
achega
61b5c17d76
Modificáronse 1 ficheiros con 13 adicións e 0 borrados
  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) {