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:
Beat Küng 2019-10-14 12:23:02 +02:00
parent 177da1f923
commit 72a8be538a

View File

@ -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 */
if (_armed.lockdown || _armed.manual_lockdown) {
for (size_t i = 0; i < mixed_num_outputs; i++) {
output_limited[i] = _disarmed_value[i];
}
}
bool 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]);
stop_motors = true;
}
/* apply _param_mot_ordering */