Skip to content

Commit

Permalink
feat: mute while charging on some Jumper radios (#5541)
Browse files Browse the repository at this point in the history
  • Loading branch information
3djc authored Sep 19, 2024
1 parent 18a2c32 commit 6563cd2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions radio/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,14 @@ if(TRACE_AUDIO)
endif()

if(DEBUG STREQUAL RTT)
set(DEBUG ON)
set(DEBUG_SEGGER_RTT ON)
add_definitions(-DDEBUG_SEGGER_RTT)
set(SRC ${SRC} ${THIRDPARTY_DIR}/Segger_RTT/RTT/SEGGER_RTT.c)
endif()

if(DEBUG STREQUAL RTT_NO_USB)
set(DEBUG ON)
set(DEBUG_SEGGER_RTT ON)
add_definitions(-DDEBUG_SEGGER_RTT)
add_definitions(-DDEBUG_DISABLE_USB)
Expand Down
7 changes: 6 additions & 1 deletion radio/src/targets/horus/board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,18 @@ void boardInit()
board_set_bor_level();
#endif

#if defined(FUNCTION_SWITCHES) && !defined(DEBUG_DISABLE_USB)
#if defined(FUNCTION_SWITCHES) && !defined(DEBUG)
// This is needed to prevent radio from starting when usb is plugged to charge
usbInit();
// prime debounce state...
usbPlugged();
if (usbPlugged()) {
delaysInit();
#if defined(AUDIO_MUTE_GPIO)
// Charging can make a buzzing noise
gpio_init(AUDIO_MUTE_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW);
gpio_set(AUDIO_MUTE_GPIO);
#endif
while (usbPlugged()) {
delay_ms(1000);
}
Expand Down
7 changes: 6 additions & 1 deletion radio/src/targets/taranis/board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,18 @@ void boardInit()
LL_APB1_GRP1_EnableClock(AUDIO_RCC_APB1Periph);
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SYSCFG);

#if defined(USB_CHARGE_LED) && !defined(DEBUG_DISABLE_USB)
#if defined(USB_CHARGE_LED) && !defined(DEBUG)
usbInit();
// prime debounce state...
usbPlugged();

if (usbPlugged()) {
delaysInit();
#if defined(AUDIO_MUTE_GPIO)
// Charging can make a buzzing noise
gpio_init(AUDIO_MUTE_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW);
gpio_set(AUDIO_MUTE_GPIO);
#endif
while (usbPlugged()) {
delay_ms(1000);
}
Expand Down

0 comments on commit 6563cd2

Please sign in to comment.