diff --git a/drivers/serial.h b/drivers/serial.h index fb91b136e7..1ed1ffcd3d 100644 --- a/drivers/serial.h +++ b/drivers/serial.h @@ -31,7 +31,10 @@ bool soft_serial_transaction(int sstd_index); #ifdef SERIAL_DEBUG # include # include -# define serial_dprintf(...) dprintf(__VA_ARGS__) +# define serial_dprintf(fmt, ...) \ + do { \ + if (debug_config.serial) xprintf(fmt, ##__VA_ARGS__); \ + } while (0) #else # define serial_dprintf(...) \ do { \ diff --git a/quantum/action.c b/quantum/action.c index e9bb91ceb7..06998d757c 100644 --- a/quantum/action.c +++ b/quantum/action.c @@ -317,7 +317,7 @@ void process_record_handler(keyrecord_t *record) { action_t action = store_or_get_action(record->event.pressed, record->event.key); #endif ac_dprintf("ACTION: "); - debug_action(action); + debug_action_fn(action); #ifndef NO_ACTION_LAYER ac_dprintf(" layer_state: "); layer_debug(); @@ -1215,7 +1215,7 @@ void debug_record(keyrecord_t record) { * * FIXME: Needs documentation. */ -void debug_action(action_t action) { +void debug_action_fn(action_t action) { switch (action.kind.id) { case ACT_LMODS: ac_dprintf("ACT_LMODS"); diff --git a/quantum/action.h b/quantum/action.h index 9f3a19df61..69f8969aa5 100644 --- a/quantum/action.h +++ b/quantum/action.h @@ -143,7 +143,10 @@ uint16_t get_record_keycode(keyrecord_t *record, bool update_layer_cache); #ifdef ACTION_DEBUG # include "debug.h" # include "print.h" -# define ac_dprintf(...) dprintf(__VA_ARGS__) +# define ac_dprintf(fmt, ...) \ + do { \ + if (debug_config.action) xprintf(fmt, ##__VA_ARGS__); \ + } while (0) #else # define ac_dprintf(...) \ do { \ @@ -153,7 +156,7 @@ uint16_t get_record_keycode(keyrecord_t *record, bool update_layer_cache); /* debug */ void debug_event(keyevent_t event); void debug_record(keyrecord_t record); -void debug_action(action_t action); +void debug_action_fn(action_t action); #ifdef __cplusplus } diff --git a/quantum/logging/debug.c b/quantum/logging/debug.c index ca7654eda2..0490b201bd 100644 --- a/quantum/logging/debug.c +++ b/quantum/logging/debug.c @@ -17,9 +17,12 @@ along with this program. If not, see . #include "debug.h" debug_config_t debug_config = { - .enable = false, // - .matrix = false, // - .keyboard = false, // - .mouse = false, // - .reserved = 0 // + .enable = false, + .matrix = false, + .keyboard = false, + .mouse = false, + .pointing = false, + .action = false, + .serial = false, + .quantum_painter = false, }; diff --git a/quantum/logging/debug.h b/quantum/logging/debug.h index b0d9b9a10e..5ff6a8f639 100644 --- a/quantum/logging/debug.h +++ b/quantum/logging/debug.h @@ -34,7 +34,12 @@ typedef union { bool matrix : 1; bool keyboard : 1; bool mouse : 1; - uint8_t reserved : 4; + bool pointing :1; + bool action : 1; + bool serial: 1; + bool quantum_painter : 1; + // bool backing_store : 1; + // bool wear_leveling : 1; }; uint8_t raw; } debug_config_t; @@ -50,7 +55,10 @@ extern debug_config_t debug_config; #define debug_matrix (debug_config.matrix) #define debug_keyboard (debug_config.keyboard) #define debug_mouse (debug_config.mouse) - +#define debug_pointing (debug_config.pointing) +#define debug_action (debug_config.action) +#define debug_serial (debug_config.serial) +#define debug_quantum_painter (debug_config.quantum_painter) /* * Debug print utils */ diff --git a/quantum/painter/qp_internal.h b/quantum/painter/qp_internal.h index e7a6d113c5..d45f39becc 100644 --- a/quantum/painter/qp_internal.h +++ b/quantum/painter/qp_internal.h @@ -19,7 +19,10 @@ #ifdef QUANTUM_PAINTER_DEBUG # include # include -# define qp_dprintf(...) dprintf(__VA_ARGS__) +# define qp_dprintf(fmt, ...) \ + do { \ + if (debug_config.quantum_painter) xprintf(fmt, ##__VA_ARGS__); \ + } while (0) #else # define qp_dprintf(...) \ do { \ diff --git a/quantum/pointing_device_internal.h b/quantum/pointing_device_internal.h index ef649407ca..94983460c1 100644 --- a/quantum/pointing_device_internal.h +++ b/quantum/pointing_device_internal.h @@ -6,7 +6,10 @@ #ifdef POINTING_DEVICE_DEBUG # include "debug.h" # include "print.h" -# define pd_dprintf(...) dprintf(__VA_ARGS__) +# define pd_dprintf(fmt, ...) \ + do { \ + if (debug_config.pointing) xprintf(fmt, ##__VA_ARGS__); \ + } while (0) #else # define pd_dprintf(...) \ do { \