From d6af9fd0ee98aef111714e90be859b1514230218 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 7 Jun 2015 09:07:47 +1000 Subject: [PATCH] HAL_PX4: prevent uavcan motor spin up while booting --- libraries/AP_HAL_PX4/RCOutput.cpp | 13 ++++++++++++- libraries/AP_HAL_PX4/RCOutput.h | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/libraries/AP_HAL_PX4/RCOutput.cpp b/libraries/AP_HAL_PX4/RCOutput.cpp index 23a5270104..64cce64b78 100644 --- a/libraries/AP_HAL_PX4/RCOutput.cpp +++ b/libraries/AP_HAL_PX4/RCOutput.cpp @@ -297,6 +297,12 @@ void PX4RCOutput::_publish_actuators(void) { struct actuator_direct_s actuators; + if (_esc_pwm_min == 0 || + _esc_pwm_max == 0) { + // not initialised yet + return; + } + actuators.nvalues = _max_channel; if (actuators.nvalues > actuators.NUM_ACTUATORS_DIRECT) { actuators.nvalues = actuators.NUM_ACTUATORS_DIRECT; @@ -307,9 +313,14 @@ void PX4RCOutput::_publish_actuators(void) if (actuators.nvalues > 8) { actuators.nvalues = 8; } + bool armed = hal.util->get_soft_armed(); actuators.timestamp = hrt_absolute_time(); for (uint8_t i=0; i