Prechádzať zdrojové kódy

解决turbo挡位不正常的问题

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 3 rokov pred
rodič
commit
1c569316a3

+ 2 - 2
Applications/foc/core/thro_torque.c

@@ -15,7 +15,7 @@ void thro_torque_reset(void) {
 	_torque.thro_filted = 0.0f;
 	_torque.thro_ration = _torque.thro_ration_last = 0.0f;
 	_torque.torque_req = _torque.torque_real = 0.0f;
-	_torque.gear = mc_get_gear();
+	_torque.gear = mc_get_internal_gear();
 }
 
 void thro_torque_init(void) {
@@ -166,7 +166,7 @@ void thro_torque_process(u8 run_mode, float f_throttle) {
 	thro_torque_filter(f_throttle);
 
 	float thro_r = thro_ration(_torque.thro_filted);
-	u8    n_gear = mc_get_gear();
+	u8    n_gear = mc_get_internal_gear();
 
 	if (thro_r > _torque.thro_ration) {
 		if (!_torque.accl) {

+ 1 - 1
Applications/foc/core/torque_unused.c

@@ -31,7 +31,7 @@ void torque_reset(void) {
 }
 
 float torque_max_from_gear_rpm(void) {
-	u8 gear = mc_get_gear();
+	u8 gear = mc_get_internal_gear();
 	if (gear > 4) {
 		gear = 0;
 	}

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

@@ -371,6 +371,10 @@ u8 mc_get_gear(void) {
 	return motor.n_gear + 1;
 }
 
+u8 mc_get_internal_gear(void) {
+	return motor.n_gear;
+}
+
 bool mc_enable_cruise(bool enable) {
 	if (enable == motor.b_cruise) {
 		return true;

+ 1 - 0
Applications/foc/motor/motor.h

@@ -87,6 +87,7 @@ void mc_need_update(void);
 bool mc_is_start(void);
 bool mc_set_gear(u8 gear);
 u8 mc_get_gear(void);
+u8 mc_get_internal_gear(void);
 void mc_set_critical_error(u8 err);
 void mc_clr_critical_error(u8 err);
 u32 mc_get_critical_error(void);