mixer_module: check for motor test after topic update

Otherwise if a module restricts the update rate via setMaxTopicUpdateRate()
and then motor_test is used, the module might run faster than expected.
This commit is contained in:
Beat Küng 2021-08-10 17:06:39 +02:00 committed by Daniel Agar
parent a6d88cad18
commit 61e3ec53b0

View File

@ -351,21 +351,6 @@ bool MixingOutput::update()
}
}
// check for motor test
if (!_armed.armed && !_armed.manual_lockdown) {
unsigned num_motor_test = motorTest();
if (num_motor_test > 0) {
if (_interface.updateOutputs(false, _current_output_value, num_motor_test, 1)) {
actuator_outputs_s actuator_outputs{};
setAndPublishActuatorOutputs(num_motor_test, actuator_outputs);
}
handleCommands();
return true;
}
}
if (_param_mot_slew_max.get() > FLT_EPSILON) {
updateOutputSlewrateMultirotorMixer();
}
@ -396,6 +381,21 @@ bool MixingOutput::update()
}
}
// check for motor test (after topic updates)
if (!_armed.armed && !_armed.manual_lockdown) {
unsigned num_motor_test = motorTest();
if (num_motor_test > 0) {
if (_interface.updateOutputs(false, _current_output_value, num_motor_test, 1)) {
actuator_outputs_s actuator_outputs{};
setAndPublishActuatorOutputs(num_motor_test, actuator_outputs);
}
handleCommands();
return true;
}
}
/* do mixing */
float outputs[MAX_ACTUATORS] {};
const unsigned mixed_num_outputs = _mixers->mix(outputs, _max_num_outputs);