mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
mixer_module: more robust logic to set 'stop_motors' flag
Checking the first output_limited for a disarmed value is fragile. For example a disarmed value might be within the range of min/max output values and could then be triggered while armed.
This commit is contained in:
@@ -285,18 +285,15 @@ bool MixingOutput::update()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool stop_motors = mixed_num_outputs == 0 || !_throttle_armed;
|
||||||
|
|
||||||
/* overwrite outputs in case of lockdown or parachute triggering with disarmed values */
|
/* overwrite outputs in case of lockdown or parachute triggering with disarmed values */
|
||||||
if (_armed.lockdown || _armed.manual_lockdown) {
|
if (_armed.lockdown || _armed.manual_lockdown) {
|
||||||
for (size_t i = 0; i < mixed_num_outputs; i++) {
|
for (size_t i = 0; i < mixed_num_outputs; i++) {
|
||||||
output_limited[i] = _disarmed_value[i];
|
output_limited[i] = _disarmed_value[i];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool stop_motors = true;
|
stop_motors = true;
|
||||||
|
|
||||||
if (mixed_num_outputs > 0) {
|
|
||||||
/* assume if one (here the 1.) motor is disarmed, all of them should be stopped */
|
|
||||||
stop_motors = (output_limited[0] == _disarmed_value[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* apply _param_mot_ordering */
|
/* apply _param_mot_ordering */
|
||||||
|
|||||||
Reference in New Issue
Block a user