Skip to content

Commit

Permalink
feat: allow for compile time user override of power LED color (#5922)
Browse files Browse the repository at this point in the history
  • Loading branch information
pfeerick authored Feb 19, 2025
1 parent 75d5809 commit b4bf1eb
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 5 deletions.
5 changes: 5 additions & 0 deletions radio/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ if(PCB STREQUAL X9D+ AND PCBREV STREQUAL 2019)
else()
option(USBJ_EX "Enable USB Joystick Extension" ON)
endif()
option(POWER_LED_BLUE "Override Power LED to be normally Blue" OFF)

# since we reset all default CMAKE compiler flags for firmware builds, provide an alternate way for user to specify additional flags.
set(FIRMWARE_C_FLAGS "" CACHE STRING "Additional flags for firmware target c compiler (note: all CMAKE_C_FLAGS[_*] are ignored for firmware/bootloader).")
Expand Down Expand Up @@ -434,6 +435,10 @@ if(USBJ_EX)
)
endif()

if(POWER_LED_BLUE)
add_definitions(-DPOWER_LED_BLUE)
endif()

foreach(FILE ${TARGET_SRC})
set(SRC targets/${TARGET_DIR}/${FILE} ${SRC})
endforeach()
Expand Down
8 changes: 4 additions & 4 deletions radio/src/edgetx.h
Original file line number Diff line number Diff line change
Expand Up @@ -598,10 +598,10 @@ constexpr uint8_t OPENTX_START_NO_CHECKS = 0x04;

#if defined(STATUS_LEDS)
#define LED_ERROR_BEGIN() ledRed()
// Green is preferred "ready to use" color for these radios
#if defined(MANUFACTURER_RADIOMASTER) || defined(MANUFACTURER_JUMPER) || defined(RADIO_COMMANDO8)
#define LED_ERROR_END() ledGreen()
#define LED_BIND() ledBlue()
// Green is preferred "ready to use" color for these radios, unless overridden by user
#if !defined(POWER_LED_BLUE) && (defined(MANUFACTURER_RADIOMASTER) || defined(MANUFACTURER_JUMPER) || defined(RADIO_COMMANDO8))
#define LED_ERROR_END() ledGreen()
#define LED_BIND() ledBlue()
#else
// Either green is not an option, or blue is preferred "ready to use" color
#define LED_ERROR_END() ledBlue()
Expand Down
3 changes: 3 additions & 0 deletions radio/src/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ static const char * const options[] = {
#endif
#if defined(ENABLE_SERIAL_PASSTHROUGH)
"passthrough",
#endif
#if defined(POWER_LED_BLUE)
"power_led_blue",
#endif
nullptr //sentinel
};
5 changes: 5 additions & 0 deletions radio/src/targets/horus/board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,12 @@ void boardInit()
rtcInit(); // RTC must be initialized before rambackupRestore() is called
#endif

#if !defined(POWER_LED_BLUE)
ledBlue();
#else
ledGreen();
#endif

#if !defined(LCD_VERTICAL_INVERT)
lcdSetInitalFrameBuffer(lcdFront->getData());
#elif defined(RADIO_F16)
Expand Down
4 changes: 4 additions & 0 deletions radio/src/targets/pl18/board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,11 @@ void boardInit()
rtcInit(); // RTC must be initialized before rambackupRestore() is called
#endif
#if defined(LED_STRIP_GPIO)
#if !defined(POWER_LED_BLUE)
ledBlue();
#else
ledGreen();
#endif
#endif

lcdSetInitalFrameBuffer(lcdFront->getData());
Expand Down
2 changes: 1 addition & 1 deletion radio/src/targets/taranis/board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void boardInit()

#if defined(STATUS_LEDS)
ledInit();
#if defined(MANUFACTURER_RADIOMASTER) || defined(MANUFACTURER_JUMPER) || defined(RADIO_COMMANDO8)
#if !defined(POWER_LED_BLUE) && (defined(MANUFACTURER_RADIOMASTER) || defined(MANUFACTURER_JUMPER) || defined(RADIO_COMMANDO8))
ledBlue();
#else
ledGreen();
Expand Down

0 comments on commit b4bf1eb

Please sign in to comment.