From d54d3351de09742969c5368a14cf5e25be3cbc4d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 2 Apr 2018 11:16:44 +1000 Subject: [PATCH] SRV_Channel: check for rcout serial for blheli support --- libraries/SRV_Channel/SRV_Channel.h | 2 ++ libraries/SRV_Channel/SRV_Channel_aux.cpp | 4 +++- libraries/SRV_Channel/SRV_Channels.cpp | 13 +++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/libraries/SRV_Channel/SRV_Channel.h b/libraries/SRV_Channel/SRV_Channel.h index 17659bf38b..e66681c760 100644 --- a/libraries/SRV_Channel/SRV_Channel.h +++ b/libraries/SRV_Channel/SRV_Channel.h @@ -449,9 +449,11 @@ private: AP_SBusOut sbus; static AP_SBusOut *sbus_ptr; +#if HAL_SUPPORT_RCOUT_SERIAL // support for BLHeli protocol AP_BLHeli blheli; static AP_BLHeli *blheli_ptr; +#endif static uint16_t disabled_mask; SRV_Channel obj_channels[NUM_SERVO_CHANNELS]; diff --git a/libraries/SRV_Channel/SRV_Channel_aux.cpp b/libraries/SRV_Channel/SRV_Channel_aux.cpp index d7330dbfda..bae8bc08d7 100644 --- a/libraries/SRV_Channel/SRV_Channel_aux.cpp +++ b/libraries/SRV_Channel/SRV_Channel_aux.cpp @@ -166,8 +166,10 @@ void SRV_Channels::enable_aux_servos() hal.rcout->enable_ch(channels[i].ch_num); } } - + +#if HAL_SUPPORT_RCOUT_SERIAL blheli_ptr->update(); +#endif } /// enable output channels using a channel mask diff --git a/libraries/SRV_Channel/SRV_Channels.cpp b/libraries/SRV_Channel/SRV_Channels.cpp index 1a1ea1587c..5d2dd69048 100644 --- a/libraries/SRV_Channel/SRV_Channels.cpp +++ b/libraries/SRV_Channel/SRV_Channels.cpp @@ -28,7 +28,11 @@ SRV_Channel *SRV_Channels::channels; SRV_Channels *SRV_Channels::instance; AP_Volz_Protocol *SRV_Channels::volz_ptr; AP_SBusOut *SRV_Channels::sbus_ptr; + +#if HAL_SUPPORT_RCOUT_SERIAL AP_BLHeli *SRV_Channels::blheli_ptr; +#endif + uint16_t SRV_Channels::disabled_mask; bool SRV_Channels::disabled_passthrough; @@ -124,9 +128,11 @@ const AP_Param::GroupInfo SRV_Channels::var_info[] = { // @Path: ../AP_SBusOut/AP_SBusOut.cpp AP_SUBGROUPINFO(sbus, "_SBUS_", 20, SRV_Channels, AP_SBusOut), +#if HAL_SUPPORT_RCOUT_SERIAL // @Group: _BLH_ // @Path: ../AP_BLHeli/AP_BLHeli.cpp AP_SUBGROUPINFO(blheli, "_BLH_", 21, SRV_Channels, AP_BLHeli), +#endif AP_GROUPEND }; @@ -149,7 +155,9 @@ SRV_Channels::SRV_Channels(void) volz_ptr = &volz; sbus_ptr = &sbus; +#if HAL_SUPPORT_RCOUT_SERIAL blheli_ptr = &blheli; +#endif } /* @@ -217,4 +225,9 @@ void SRV_Channels::push() // give sbus library a chance to update sbus_ptr->update(); + +#if HAL_SUPPORT_RCOUT_SERIAL + // give blheli telemetry a chance to update + blheli_ptr->update_telemetry(); +#endif }