From 3264fd750b47fe3bb4f716b23e23557e5d351fab Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 31 Aug 2020 12:35:24 +1000 Subject: [PATCH] SRV_Channel: add k_min, m_trim and k_max to output min/trim/max values --- libraries/SRV_Channel/SRV_Channel.h | 3 +++ libraries/SRV_Channel/SRV_Channel_aux.cpp | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/libraries/SRV_Channel/SRV_Channel.h b/libraries/SRV_Channel/SRV_Channel.h index fab05e8949..de9d9152cb 100644 --- a/libraries/SRV_Channel/SRV_Channel.h +++ b/libraries/SRV_Channel/SRV_Channel.h @@ -158,6 +158,9 @@ public: k_ProfiLED_3 = 131, k_ProfiLED_Clock = 132, k_winch_clutch = 133, + k_min = 134, // always outputs SERVOn_MIN + k_trim = 135, // always outputs SERVOn_TRIM + k_max = 136, // always outputs SERVOn_MAX k_nr_aux_servo_functions ///< This must be the last enum value (only add new values _before_ this one) } Aux_servo_function_t; diff --git a/libraries/SRV_Channel/SRV_Channel_aux.cpp b/libraries/SRV_Channel/SRV_Channel_aux.cpp index e0c2199d7d..49cc5c5b2b 100644 --- a/libraries/SRV_Channel/SRV_Channel_aux.cpp +++ b/libraries/SRV_Channel/SRV_Channel_aux.cpp @@ -197,6 +197,19 @@ void SRV_Channels::enable_aux_servos() hal.rcout->enable_ch(c.ch_num); } + // output some servo functions before we fiddle with the + // parameter values: + if (c.function.get() == SRV_Channel::k_min) { + c.set_output_pwm(c.servo_min); + c.output_ch(); + } else if (c.function.get() == SRV_Channel::k_trim) { + c.set_output_pwm(c.servo_trim); + c.output_ch(); + } else if (c.function.get() == SRV_Channel::k_max) { + c.set_output_pwm(c.servo_max); + c.output_ch(); + } + /* for channels which have been marked as digital output then the MIN/MAX/TRIM values have no meaning for controlling output, as