From 012fcae38870fd116c5760b247f30d06aeeb1cba Mon Sep 17 00:00:00 2001 From: Tatsuya Yamaguchi Date: Fri, 7 Jun 2019 14:34:40 +0900 Subject: [PATCH] AP_ServoRelayEvents: allow DO_SET_SERVO commands while rc pass-thru --- .../AP_ServoRelayEvents.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/libraries/AP_ServoRelayEvents/AP_ServoRelayEvents.cpp b/libraries/AP_ServoRelayEvents/AP_ServoRelayEvents.cpp index aa08edb37e..b930f2d5de 100644 --- a/libraries/AP_ServoRelayEvents/AP_ServoRelayEvents.cpp +++ b/libraries/AP_ServoRelayEvents/AP_ServoRelayEvents.cpp @@ -32,7 +32,13 @@ bool AP_ServoRelayEvents::do_set_servo(uint8_t _channel, uint16_t pwm) if (c == nullptr) { return false; } - if (c->get_function() != SRV_Channel::k_none) { + switch(c->get_function()) + { + case SRV_Channel::k_none: + case SRV_Channel::k_manual: + case SRV_Channel::k_rcin1 ... SRV_Channel::k_rcin16: // rc pass-thru + break; + default: gcs().send_text(MAV_SEVERITY_INFO, "ServoRelayEvent: Channel %d is already in use", _channel); return false; } @@ -42,6 +48,7 @@ bool AP_ServoRelayEvents::do_set_servo(uint8_t _channel, uint16_t pwm) repeat = 0; } c->set_output_pwm(pwm); + c->ignore_small_rcin_changes(); return true; } @@ -72,7 +79,13 @@ bool AP_ServoRelayEvents::do_repeat_servo(uint8_t _channel, uint16_t _servo_valu if (c == nullptr) { return false; } - if (c->get_function() != SRV_Channel::k_none) { + switch(c->get_function()) + { + case SRV_Channel::k_none: + case SRV_Channel::k_manual: + case SRV_Channel::k_rcin1 ... SRV_Channel::k_rcin16: // rc pass-thru + break; + default: gcs().send_text(MAV_SEVERITY_INFO, "ServoRelayEvent: Channel %d is already in use", _channel); return false; } @@ -121,6 +134,7 @@ void AP_ServoRelayEvents::update_events(void) c->set_output_pwm(c->get_trim()); } else { c->set_output_pwm(servo_value); + c->ignore_small_rcin_changes(); } } break;