px4io: don't output on disabled PWM pins

Same logic as on the FMU PWM updateOutputs() in PWMOut.cpp
This commit is contained in:
Matthias Grob 2024-02-26 11:38:48 +01:00
parent bcbae86b9f
commit 999a71c4dd
1 changed files with 7 additions and 0 deletions

View File

@ -364,6 +364,13 @@ PX4IO::~PX4IO()
bool PX4IO::updateOutputs(bool stop_motors, uint16_t outputs[MAX_ACTUATORS],
unsigned num_outputs, unsigned num_control_groups_updated)
{
for (size_t i = 0; i < num_outputs; i++) {
if (!_mixing_output.isFunctionSet(i)) {
// do not run any signal on disabled channels
outputs[i] = 0;
}
}
if (!_test_fmu_fail) {
/* output to the servos */
io_reg_set(PX4IO_PAGE_DIRECT_PWM, 0, outputs, num_outputs);