From a5be9d0f1810ded6f17dbfe5727071a6d33df53c Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 8 Apr 2022 17:20:57 +1000 Subject: [PATCH] SRV_Channel: allow RobotisServo protocol to be compiled out --- libraries/SRV_Channel/SRV_Channel.h | 4 +++- libraries/SRV_Channel/SRV_Channels.cpp | 21 ++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/libraries/SRV_Channel/SRV_Channel.h b/libraries/SRV_Channel/SRV_Channel.h index ed5a52e503..c3e30c38e3 100644 --- a/libraries/SRV_Channel/SRV_Channel.h +++ b/libraries/SRV_Channel/SRV_Channel.h @@ -585,11 +585,13 @@ private: // support for SBUS protocol AP_SBusOut sbus; static AP_SBusOut *sbus_ptr; +#endif // HAL_BUILD_AP_PERIPH +#if AP_ROBOTISSERVO_ENABLED // support for Robotis servo protocol AP_RobotisServo robotis; static AP_RobotisServo *robotis_ptr; -#endif // HAL_BUILD_AP_PERIPH +#endif #if HAL_SUPPORT_RCOUT_SERIAL // support for BLHeli protocol diff --git a/libraries/SRV_Channel/SRV_Channels.cpp b/libraries/SRV_Channel/SRV_Channels.cpp index dbe565f837..345913b7be 100644 --- a/libraries/SRV_Channel/SRV_Channels.cpp +++ b/libraries/SRV_Channel/SRV_Channels.cpp @@ -49,8 +49,11 @@ AP_Volz_Protocol *SRV_Channels::volz_ptr; #ifndef HAL_BUILD_AP_PERIPH AP_SBusOut *SRV_Channels::sbus_ptr; +#endif + +#if AP_ROBOTISSERVO_ENABLED AP_RobotisServo *SRV_Channels::robotis_ptr; -#endif // HAL_BUILD_AP_PERIPH +#endif #if AP_FETTEC_ONEWIRE_ENABLED AP_FETtecOneWire *SRV_Channels::fetteconwire_ptr; @@ -205,10 +208,13 @@ const AP_Param::GroupInfo SRV_Channels::var_info[] = { AP_SUBGROUPINFO(blheli, "_BLH_", 21, SRV_Channels, AP_BLHeli), #endif -#ifndef HAL_BUILD_AP_PERIPH +#if AP_ROBOTISSERVO_ENABLED // @Group: _ROB_ // @Path: ../AP_RobotisServo/AP_RobotisServo.cpp AP_SUBGROUPINFO(robotis, "_ROB_", 22, SRV_Channels, AP_RobotisServo), +#endif + +#ifndef HAL_BUILD_AP_PERIPH #if AP_FETTEC_ONEWIRE_ENABLED // @Group: _FTW_ @@ -269,8 +275,12 @@ SRV_Channels::SRV_Channels(void) #ifndef HAL_BUILD_AP_PERIPH sbus_ptr = &sbus; +#endif + +#if AP_ROBOTISSERVO_ENABLED robotis_ptr = &robotis; -#endif // HAL_BUILD_AP_PERIPH +#endif // AP_ROBOTISSERVO_ENABLED + #if HAL_SUPPORT_RCOUT_SERIAL blheli_ptr = &blheli; #endif @@ -398,11 +408,12 @@ void SRV_Channels::push() #ifndef HAL_BUILD_AP_PERIPH // give sbus library a chance to update sbus_ptr->update(); +#endif // HAL_BUILD_AP_PERIPH +#if AP_ROBOTISSERVO_ENABLED // give robotis library a chance to update robotis_ptr->update(); - -#endif // HAL_BUILD_AP_PERIPH +#endif #if HAL_SUPPORT_RCOUT_SERIAL // give blheli telemetry a chance to update