From 219d429929c1f774310caec7477c5e035b3816c1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 11 May 2018 16:05:01 +1000 Subject: [PATCH] HAL_PX4: fixed oneshot125 on non-alt outputs --- libraries/AP_HAL_PX4/RCOutput.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libraries/AP_HAL_PX4/RCOutput.cpp b/libraries/AP_HAL_PX4/RCOutput.cpp index 6aad126f18..e44418f03e 100644 --- a/libraries/AP_HAL_PX4/RCOutput.cpp +++ b/libraries/AP_HAL_PX4/RCOutput.cpp @@ -356,10 +356,13 @@ void PX4RCOutput::write(uint8_t ch, uint16_t period_us) } if (_output_mode == MODE_PWM_ONESHOT125) { - // we treat oneshot125 very simply on HAL_PX4, with 1us - // resolution. Correctly handling it would use a 125 nsec - // step size, to give the full 1000 steps - period_us /= 8; + if (((ch < _servo_count) && ((1U<= _servo_count) && ((1U<<(ch-_servo_count)) & _rate_mask_alt))) { + // we treat oneshot125 very simply on HAL_PX4, with 1us + // resolution. Correctly handling it would use a 125 nsec + // step size, to give the full 1000 steps + period_us /= 8; + } } // keep unscaled value