From 89892d0d17c815e469defad5e32fc86ecf52a08a Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Tue, 30 Nov 2021 14:19:46 +0100 Subject: [PATCH] px4io: discover PWM_MAIN_TRIMx parameters right away --- src/drivers/px4io/px4io.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index 88df4b6717..2b7673beba 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -916,7 +916,7 @@ void PX4IO::update_params() } // PWM_MAIN_TRIMx - if (_mixing_output.mixers()) { + { int16_t values[8] {}; for (unsigned i = 0; i < _max_actuators; i++) { @@ -928,8 +928,10 @@ void PX4IO::update_params() } } - // copy the trim values to the mixer offsets - _mixing_output.mixers()->set_trims(values, _max_actuators); + if (_mixing_output.mixers()) { + // copy the trim values to the mixer offsets + _mixing_output.mixers()->set_trims(values, _max_actuators); + } } }