diff --git a/libraries/AP_Notify/AP_Notify.cpp b/libraries/AP_Notify/AP_Notify.cpp index 1a1b6d2158..3d7503f1ed 100644 --- a/libraries/AP_Notify/AP_Notify.cpp +++ b/libraries/AP_Notify/AP_Notify.cpp @@ -303,14 +303,14 @@ void AP_Notify::add_backends(void) #endif #endif // CONFIG_HAL_BOARD == HAL_BOARD_LINUX -#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_CHIBIOS_VRBRAIN_V51 || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_CHIBIOS_VRBRAIN_V52 || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_CHIBIOS_VRUBRAIN_V51 || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_CHIBIOS_VRCORE_V10 || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_CHIBIOS_VRBRAIN_V54 +#if AP_NOTIFY_EXTERNALLED_ENABLED ADD_BACKEND(new ExternalLED()); // despite the name this is a built in set of onboard LED's -#endif // CONFIG_HAL_BOARD_SUBTYPE == various CHIBIOS-VRBRAINs +#endif #if defined(HAL_HAVE_PIXRACER_LED) ADD_BACKEND(new PixRacerLED()); #elif (defined(HAL_GPIO_A_LED_PIN) && defined(HAL_GPIO_B_LED_PIN) && defined(HAL_GPIO_C_LED_PIN)) - #if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_CHIBIOS_VRBRAIN_V51 || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_CHIBIOS_VRBRAIN_V52 || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_CHIBIOS_VRUBRAIN_V51 || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_CHIBIOS_VRCORE_V10 || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_CHIBIOS_VRBRAIN_V54 + #if AP_NOTIFY_VRBOARD_LED_ENABLED ADD_BACKEND(new VRBoard_LED()); #else ADD_BACKEND(new AP_BoardLED()); diff --git a/libraries/AP_Notify/AP_Notify_config.h b/libraries/AP_Notify/AP_Notify_config.h index 7adcab2b62..fb702a8d1e 100644 --- a/libraries/AP_Notify/AP_Notify_config.h +++ b/libraries/AP_Notify/AP_Notify_config.h @@ -25,6 +25,14 @@ #define AP_NOTIFY_DSHOT_LED_ENABLED HAL_SUPPORT_RCOUT_SERIAL #endif +#ifndef AP_NOTIFY_VRBOARD_LED_ENABLED +#define AP_NOTIFY_VRBOARD_LED_ENABLED 0 +#endif + +#ifndef AP_NOTIFY_EXTERNALLED_ENABLED +#define AP_NOTIFY_EXTERNALLED_ENABLED 0 +#endif + #ifndef AP_NOTIFY_LP5562_ENABLED #define AP_NOTIFY_LP5562_ENABLED 1 #endif diff --git a/libraries/AP_Notify/ExternalLED.cpp b/libraries/AP_Notify/ExternalLED.cpp index 6085c054ac..beec54e3f6 100644 --- a/libraries/AP_Notify/ExternalLED.cpp +++ b/libraries/AP_Notify/ExternalLED.cpp @@ -12,6 +12,10 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "AP_Notify_config.h" + +#if AP_NOTIFY_EXTERNALLED_ENABLED + #include "ExternalLED.h" #include "AP_Notify.h" @@ -242,3 +246,5 @@ void ExternalLED::motor_led2(bool on_off) bool ExternalLED::init(void) {return true;} void ExternalLED::update(void) {return;} #endif + +#endif // AP_NOTIFY_EXTERNALLED_ENABLED diff --git a/libraries/AP_Notify/ExternalLED.h b/libraries/AP_Notify/ExternalLED.h index 404d300636..291ab98fa6 100644 --- a/libraries/AP_Notify/ExternalLED.h +++ b/libraries/AP_Notify/ExternalLED.h @@ -15,6 +15,10 @@ #pragma once +#include "AP_Notify_config.h" + +#if AP_NOTIFY_EXTERNALLED_ENABLED + #include "NotifyDevice.h" class ExternalLED: public NotifyDevice @@ -64,3 +68,5 @@ private: void motor_led1(bool on_off); void motor_led2(bool on_off); }; + +#endif // AP_NOTIFY_EXTERNALLED_ENABLED diff --git a/libraries/AP_Notify/VRBoard_LED.cpp b/libraries/AP_Notify/VRBoard_LED.cpp index 3edf6f7a7e..fbdf2b0213 100644 --- a/libraries/AP_Notify/VRBoard_LED.cpp +++ b/libraries/AP_Notify/VRBoard_LED.cpp @@ -16,13 +16,14 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "AP_Notify_config.h" + +#if AP_NOTIFY_VRBOARD_LED_ENABLED + #include "VRBoard_LED.h" #include -#if (defined(HAL_GPIO_A_LED_PIN) && defined(HAL_GPIO_B_LED_PIN) && \ - defined(HAL_GPIO_C_LED_PIN)) - #define VRBRAIN_LED_BRIGHT 1 // full brightness #define VRBRAIN_LED_MEDIUM 1 // medium brightness #define VRBRAIN_LED_DIM 1 // dim @@ -68,4 +69,4 @@ bool VRBoard_LED::hw_set_rgb(uint8_t r, uint8_t g, uint8_t b){ return true; } -#endif +#endif // AP_NOTIFY_VRBOARD_LED_ENABLED diff --git a/libraries/AP_Notify/VRBoard_LED.h b/libraries/AP_Notify/VRBoard_LED.h index eaee4eaa53..a3e2bd7b64 100644 --- a/libraries/AP_Notify/VRBoard_LED.h +++ b/libraries/AP_Notify/VRBoard_LED.h @@ -20,6 +20,10 @@ #pragma once +#include "AP_Notify_config.h" + +#if AP_NOTIFY_VRBOARD_LED_ENABLED + #include "RGBLed.h" #include "AP_BoardLED.h" @@ -31,3 +35,5 @@ public: protected: bool hw_set_rgb(uint8_t r, uint8_t g, uint8_t b) override; }; + +#endif // AP_NOTIFY_VRBOARD_LED_ENABLED