diff --git a/radio/src/bluetooth.h b/radio/src/bluetooth.h index f764ea539..17fecfbc0 100644 --- a/radio/src/bluetooth.h +++ b/radio/src/bluetooth.h @@ -56,8 +56,11 @@ enum BluetoothStates { f_printf(&g_bluetoothFile, __VA_ARGS__); \ TRACE_NOCRLF(__VA_ARGS__); #else - #define BLUETOOTH_TRACE(...) \ - TRACE_NOCRLF(__VA_ARGS__); +#if defined(DEBUG_BLUETOOTH) + #define BLUETOOTH_TRACE(...) TRACE_NOCRLF(__VA_ARGS__); +#else + #define BLUETOOTH_TRACE(...) +#endif #endif class Bluetooth diff --git a/radio/src/targets/common/arm/CMakeLists.txt b/radio/src/targets/common/arm/CMakeLists.txt index be3c1e721..325462e22 100644 --- a/radio/src/targets/common/arm/CMakeLists.txt +++ b/radio/src/targets/common/arm/CMakeLists.txt @@ -23,6 +23,7 @@ option(DEBUG_LATENCY "Debug latency" OFF) option(DEBUG_USB_INTERRUPTS "Count individual USB interrupts" OFF) option(DEBUG_TASKS "Task switching statistics" OFF) option(DEBUG_TIMERS "Time critical parts of the code" OFF) +option(DEBUG_BLUETOOTH "Debug Bluetooth" OFF) # option to select the default internal module #set(DEFAULT_INTERNAL_MODULE NONE CACHE STRING "Default internal module") @@ -141,6 +142,10 @@ if(DEBUG_LATENCY STREQUAL END_TO_END) add_definitions(-DDEBUG_LATENCY_END_TO_END) endif() +if(DEBUG_BLUETOOTH) + add_definitions(-DDEBUG_BLUETOOTH) +endif() + if(CLI) add_definitions(-DCLI) set(FIRMWARE_SRC ${FIRMWARE_SRC} cli.cpp) diff --git a/radio/src/targets/common/arm/stm32/bluetooth_driver.cpp b/radio/src/targets/common/arm/stm32/bluetooth_driver.cpp index 3177c7049..09b43a66c 100644 --- a/radio/src/targets/common/arm/stm32/bluetooth_driver.cpp +++ b/radio/src/targets/common/arm/stm32/bluetooth_driver.cpp @@ -123,7 +123,7 @@ extern "C" void BT_USART_IRQHandler(void) USART_ClearITPendingBit(BT_USART, USART_IT_RXNE); uint8_t byte = USART_ReceiveData(BT_USART); btRxFifo.push(byte); - TRACE("BT %02X", byte); + BLUETOOTH_TRACE("BT %02X", byte); #if defined(BLUETOOTH_PROBE) if (!btChipPresent) { // This is to differentiate X7 and X7S and X-Lite with/without BT