mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-02 05:58:30 -04:00
SITL: panic if we attempt to filter out-of-range servo index
This commit is contained in:
parent
c5c2b18a0b
commit
09ba017b5b
@ -799,6 +799,11 @@ float Aircraft::filtered_idx(float v, uint8_t idx)
|
||||
}
|
||||
const float cutoff = 1.0f / (2 * M_PI * sitl->servo_speed);
|
||||
servo_filter[idx].set_cutoff_frequency(cutoff);
|
||||
|
||||
if (idx >= ARRAY_SIZE(servo_filter)) {
|
||||
AP_HAL::panic("Attempt to filter invalid servo at offset %u", (unsigned)idx);
|
||||
}
|
||||
|
||||
return servo_filter[idx].apply(v, frame_time_us * 1.0e-6f);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user