mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-25 09:13:57 -04:00
SRV_Channel: prevent FPE with SERVOn_MIN==SERVOn_MAX
This commit is contained in:
parent
4a7f663cad
commit
a74d087fd8
@ -616,6 +616,9 @@ void SRV_Channels::adjust_trim(SRV_Channel::Aux_servo_function_t function, float
|
||||
}
|
||||
float change = c.reversed?-v:v;
|
||||
uint16_t new_trim = c.servo_trim;
|
||||
if (c.servo_max <= c.servo_min) {
|
||||
continue;
|
||||
}
|
||||
float trim_scaled = float(c.servo_trim - c.servo_min) / (c.servo_max - c.servo_min);
|
||||
if (change > 0 && trim_scaled < 0.6f) {
|
||||
new_trim++;
|
||||
|
Loading…
Reference in New Issue
Block a user