7 * Debug logging macros. Define DEBUG_LOG or DEBUG_LOG_VERBOSE to enable logging,
8 * verbose adds overwhelming detail. All macros start with DBG or DBGV (for verbose)
9 * DBGCR / DBGVCR - Print newline (Serial.println())
10 * DBG / DBGV - Print messag with optional format specifier (Serial.printf(x, ...))
11 * DBGLN / DBGVLN - Same as DBG except also includes newline
12 * DBGW / DBGVW - Write a single byte to logging (Serial.write(x))
14 * Set LOGGING_UART define to Serial instance to use if not Serial
17 // DEBUG_LOG_VERBOSE and DEBUG_RX_SCOREBOARD implies DEBUG_LOG
18 #if !defined(DEBUG_LOG)
19 #if defined(DEBUG_LOG_VERBOSE) || defined(DEBUG_RX_SCOREBOARD)
25 #define LOGGING_UART Serial
28 // #define LOG_USE_PROGMEM
30 extern void debugPrintf(const char* fmt
, ...);
32 #if defined(CRSF_RCVR_NO_SERIAL) && !defined(DEBUG_LOG)
33 #define INFOLN(msg, ...)
36 #define INFOLN(msg, ...) { \
37 debugPrintf(msg, ##__VA_ARGS__); \
38 LOGGING_UART.println(); \
41 #define ERRLN(msg, ...) IFNE(__VA_ARGS__)({ \
42 LOGGING_UART.print("ERROR: "); \
43 debugPrintf(msg, ##__VA_ARGS__); \
44 LOGGING_UART.println(); \
45 })(LOGGING_UART.println("ERROR: " msg))
48 #if defined(DEBUG_LOG)
49 #define DBGCR LOGGING_UART.println()
50 #define DBGW(c) LOGGING_UART.write(c)
51 #ifndef LOG_USE_PROGMEM
52 #define DBG(msg, ...) debugPrintf(msg, ##__VA_ARGS__)
53 #define DBGLN(msg, ...) { \
54 debugPrintf(msg, ##__VA_ARGS__); \
55 LOGGING_UART.println(); \
58 #define DBG(msg, ...) debugPrintf(PSTR(msg), ##__VA_ARGS__)
59 #define DBGLN(msg, ...) { \
60 debugPrintf(PSTR(msg), ##__VA_ARGS__); \
61 LOGGING_UART.println(); \
65 // Verbose logging is for spammy stuff
66 #if defined(DEBUG_LOG_VERBOSE)
68 #define DBGVW(c) DBGW(c)
69 #define DBGV(...) DBG(__VA_ARGS__)
70 #define DBGVLN(...) DBGLN(__VA_ARGS__)