|
@@ -26,13 +26,12 @@ static __INLINE float gear_rpm_torque(u8 trq, s16 max) {
|
|
|
return (float)trq/100.0f * max;
|
|
return (float)trq/100.0f * max;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static float thro_torque_gear_map(void) {
|
|
|
|
|
|
|
+float thro_torque_gear_map(s16 rpm) {
|
|
|
mc_gear_t *_current_gear = mc_get_gear_config();
|
|
mc_gear_t *_current_gear = mc_get_gear_config();
|
|
|
if (_current_gear == NULL) {
|
|
if (_current_gear == NULL) {
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- s16 rpm = (s16)_torque.spd_filted;
|
|
|
|
|
if (rpm > _current_gear->n_max_speed) {
|
|
if (rpm > _current_gear->n_max_speed) {
|
|
|
rpm = _current_gear->n_max_speed;
|
|
rpm = _current_gear->n_max_speed;
|
|
|
}
|
|
}
|
|
@@ -75,7 +74,7 @@ float thro_ration_to_voltage(float r) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static float thro_torque_for_accelerate(void) {
|
|
static float thro_torque_for_accelerate(void) {
|
|
|
- float max_torque = thro_torque_gear_map();
|
|
|
|
|
|
|
+ float max_torque = thro_torque_gear_map((s16)_torque.spd_filted);
|
|
|
float acc_r = 1.0f;
|
|
float acc_r = 1.0f;
|
|
|
if (_torque.thro_ration_last < 1.0f) {
|
|
if (_torque.thro_ration_last < 1.0f) {
|
|
|
acc_r = (_torque.thro_ration - _torque.thro_ration_last)/ (1.0f - _torque.thro_ration_last);
|
|
acc_r = (_torque.thro_ration - _torque.thro_ration_last)/ (1.0f - _torque.thro_ration_last);
|