Add verbose option

This commit is contained in:
dlktdr
2021-12-10 22:46:42 +01:00
committed by Risto
parent 8a7ba1bd96
commit 99253efd75
4 changed files with 18 additions and 6 deletions
+4 -4
View File
@@ -57,12 +57,12 @@ Bluetooth bluetooth;
void Bluetooth::write(const uint8_t * data, uint8_t length)
{
if (btTxFifo.hasSpace(length)) {
BLUETOOTH_TRACE("BT>");
BLUETOOTH_TRACE_VERBOSE("BT>");
for (int i = 0; i < length; i++) {
BLUETOOTH_TRACE(" %02X", data[i]);
BLUETOOTH_TRACE_VERBOSE(" %02X", data[i]);
btTxFifo.push(data[i]);
}
BLUETOOTH_TRACE(CRLF);
BLUETOOTH_TRACE_VERBOSE(CRLF);
}
else {
BLUETOOTH_TRACE("[BT] TX fifo full!" CRLF);
@@ -95,7 +95,7 @@ char * Bluetooth::readline(bool error_reset)
return nullptr;
}
BLUETOOTH_TRACE("%02X ", byte);
BLUETOOTH_TRACE_VERBOSE("%02X ", byte);
#if 0
if (error_reset && byte == 'R' && bufferIndex == 4 && memcmp(buffer, "ERRO", 4)) {
+8
View File
@@ -58,8 +58,16 @@ enum BluetoothStates {
#else
#if defined(DEBUG_BLUETOOTH)
#define BLUETOOTH_TRACE(...) TRACE_NOCRLF(__VA_ARGS__);
#define BLUETOOTH_TRACE_TIMESTAMP(f_, ...) debugPrintf((TRACE_TIME_FORMAT f_), TRACE_TIME_VALUE, ##__VA_ARGS__)
#if defined(DEBUG_BLUETOOTH_VERBOSE)
#define BLUETOOTH_TRACE_VERBOSE(...) TRACE_NOCRLF(__VA_ARGS__);
#else
#define BLUETOOTH_TRACE_VERBOSE(...)
#endif
#else
#define BLUETOOTH_TRACE(...)
#define BLUETOOTH_TIMESTAMP(f_, ...)
#define BLUETOOTH_TRACE_VERBOSE(...)
#endif
#endif
+5 -1
View File
@@ -143,7 +143,11 @@ if(DEBUG_LATENCY STREQUAL END_TO_END)
endif()
if(DEBUG_BLUETOOTH)
add_definitions(-DDEBUG_BLUETOOTH)
add_definitions(-DDEBUG_BLUETOOTH)
option(DEBUG_BLUETOOTH_VERBOSE "Debug Bluetooth Verbose" OFF)
if(DEBUG_BLUETOOTH_VERBOSE)
add_definitions(-DDEBUG_BLUETOOTH_VERBOSE)
endif()
endif()
if(CLI)
@@ -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);
BLUETOOTH_TRACE("BT %02X", byte);
BLUETOOTH_TRACE_VERBOSE("BT %02X" CRLF, byte);
#if defined(BLUETOOTH_PROBE)
if (!btChipPresent) {
// This is to differentiate X7 and X7S and X-Lite with/without BT