From 1f1b4241c3f1698c4f970186182b95b0e0368c03 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 6 Jul 2017 14:12:21 +1000 Subject: [PATCH] SRV_Channel: added get/set for reversed and function these are needed in plane for auto-conversion of old elevon code --- libraries/SRV_Channel/SRV_Channel.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/libraries/SRV_Channel/SRV_Channel.h b/libraries/SRV_Channel/SRV_Channel.h index e0deb34c11..2896c2078f 100644 --- a/libraries/SRV_Channel/SRV_Channel.h +++ b/libraries/SRV_Channel/SRV_Channel.h @@ -166,6 +166,28 @@ public: // return true if function is for a multicopter motor static bool is_motor(SRV_Channel::Aux_servo_function_t function); + // return the function of a channel + SRV_Channel::Aux_servo_function_t get_function(void) const { + return (SRV_Channel::Aux_servo_function_t)function.get(); + } + + // set and save function for channel. Used in upgrade of parameters in plane + void function_set_and_save(SRV_Channel::Aux_servo_function_t f) { + function.set_and_save(int8_t(f)); + } + + // set and save function for reversed. Used in upgrade of parameters in plane + void reversed_set_and_save_ifchanged(bool r) { + reversed.set_and_save_ifchanged(r?1:0); + } + + // return true if the SERVOn_FUNCTION has been configured in + // either storage or a defaults file. This is used for upgrade of + // parameters in plane + bool function_configured(void) const { + return function.configured(); + } + private: AP_Int16 servo_min; AP_Int16 servo_max;