diff --git a/libraries/AP_Notify/AP_BoardLED.cpp b/libraries/AP_Notify/AP_BoardLED.cpp index be8dc06190..51f970cbdc 100644 --- a/libraries/AP_Notify/AP_BoardLED.cpp +++ b/libraries/AP_Notify/AP_BoardLED.cpp @@ -16,9 +16,19 @@ #include "AP_Notify.h" -#if (defined(HAL_GPIO_A_LED_PIN) && defined(HAL_GPIO_B_LED_PIN) && \ +#if (defined(HAL_GPIO_A_LED_PIN) || defined(HAL_GPIO_B_LED_PIN) || \ defined(HAL_GPIO_C_LED_PIN)) +#ifndef HAL_GPIO_A_LED_PIN +#define HAL_GPIO_A_LED_PIN -1 +#endif +#ifndef HAL_GPIO_B_LED_PIN +#define HAL_GPIO_B_LED_PIN -1 +#endif +#ifndef HAL_GPIO_C_LED_PIN +#define HAL_GPIO_C_LED_PIN -1 +#endif + extern const AP_HAL::HAL& hal; bool AP_BoardLED::init(void) diff --git a/libraries/AP_Notify/AP_BoardLED2.cpp b/libraries/AP_Notify/AP_BoardLED2.cpp index 79fcfcc1db..333f36469b 100644 --- a/libraries/AP_Notify/AP_BoardLED2.cpp +++ b/libraries/AP_Notify/AP_BoardLED2.cpp @@ -19,7 +19,14 @@ // show all status on only 2 leds -#if defined(HAL_GPIO_A_LED_PIN) && defined(HAL_GPIO_B_LED_PIN) +#if defined(HAL_GPIO_A_LED_PIN) || defined(HAL_GPIO_B_LED_PIN) + +#ifndef HAL_GPIO_A_LED_PIN +#define HAL_GPIO_A_LED_PIN -1 +#endif +#ifndef HAL_GPIO_B_LED_PIN +#define HAL_GPIO_B_LED_PIN -1 +#endif extern const AP_HAL::HAL& hal; diff --git a/libraries/AP_Notify/AP_Notify.cpp b/libraries/AP_Notify/AP_Notify.cpp index 31b9c75e81..9c86f83aae 100644 --- a/libraries/AP_Notify/AP_Notify.cpp +++ b/libraries/AP_Notify/AP_Notify.cpp @@ -168,8 +168,10 @@ void AP_Notify::add_backends(void) #elif CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS # ifdef HAL_HAVE_PIXRACER_LED ADD_BACKEND(new PixRacerLED()); -# else +# elif (defined(HAL_GPIO_A_LED_PIN) && defined(HAL_GPIO_B_LED_PIN) && defined(HAL_GPIO_C_LED_PIN)) ADD_BACKEND(new AP_BoardLED()); +#else + ADD_BACKEND(new AP_BoardLED2()); # endif #ifdef HAL_BUZZER_PIN ADD_BACKEND(new Buzzer()); diff --git a/libraries/AP_Notify/PixRacerLED.cpp b/libraries/AP_Notify/PixRacerLED.cpp index 63c9171cae..dd9957dcda 100644 --- a/libraries/AP_Notify/PixRacerLED.cpp +++ b/libraries/AP_Notify/PixRacerLED.cpp @@ -18,6 +18,16 @@ #if CONFIG_HAL_BOARD == HAL_BOARD_PX4 && CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_PX4_V4 \ || CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS +#ifndef HAL_GPIO_A_LED_PIN +#define HAL_GPIO_A_LED_PIN -1 +#endif +#ifndef HAL_GPIO_B_LED_PIN +#define HAL_GPIO_B_LED_PIN -1 +#endif +#ifndef HAL_GPIO_C_LED_PIN +#define HAL_GPIO_C_LED_PIN -1 +#endif + extern const AP_HAL::HAL& hal; PixRacerLED::PixRacerLED() :