mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
Plane: fixed int8_t wrap with FWD_BAT_VOLT_MAX
this could cause crazy throttle values when the ratio pushes us over 127
This commit is contained in:
parent
0cd1f605f6
commit
3ffef61aec
@ -430,8 +430,8 @@ void Plane::throttle_voltage_comp(int8_t &min_throttle, int8_t &max_throttle) co
|
|||||||
const float ratio = g2.fwd_thr_batt_voltage_max / batt_voltage_resting_estimate;
|
const float ratio = g2.fwd_thr_batt_voltage_max / batt_voltage_resting_estimate;
|
||||||
|
|
||||||
// Scale the throttle limits to prevent subsequent clipping
|
// Scale the throttle limits to prevent subsequent clipping
|
||||||
min_throttle = MAX((int8_t)(ratio * (float)min_throttle), -100);
|
min_throttle = int8_t(MAX((ratio * (float)min_throttle), -100));
|
||||||
max_throttle = MIN((int8_t)(ratio * (float)max_throttle), 100);
|
max_throttle = int8_t(MIN((ratio * (float)max_throttle), 100));
|
||||||
|
|
||||||
SRV_Channels::set_output_scaled(SRV_Channel::k_throttle,
|
SRV_Channels::set_output_scaled(SRV_Channel::k_throttle,
|
||||||
constrain_float(SRV_Channels::get_output_scaled(SRV_Channel::k_throttle) * ratio, -100, 100));
|
constrain_float(SRV_Channels::get_output_scaled(SRV_Channel::k_throttle) * ratio, -100, 100));
|
||||||
|
Loading…
Reference in New Issue
Block a user