Prusa-MMU-Private
PrusaMultiMaterialUpgradev3firmwareforMK3SMK4
debug.h
Go to the documentation of this file.
1 #pragma once
3 #include <stdint.h>
4 #include "config/config.h"
5 
7 //#define DEBUG_LOGIC
8 
10 //#define DEBUG_MODULES
11 
13 //#define DEBUG_HAL
14 
15 // workaround non-standard PSTR definition on non-AVR platforms
16 #ifndef __AVR__
17 #define PSTR(x) x
18 #endif
19 
21 namespace debug {
22 
23 #if defined(DEBUG_LOGIC) && defined(__AVR__)
24 extern const char logic[];
25 #define dbg_logic(x) debug::dbg_usb(debug::logic, x)
26 #define dbg_logic_P(x) debug::dbg_usb_P(debug::logic, x)
27 #define dbg_logic_fP(fmt, ...) debug::dbg_usb_fP(debug::logic, fmt, __VA_ARGS__)
28 #else
29 #define dbg_logic(x) /* */
30 #define dbg_logic_P(x) /* */
31 #define dbg_logic_fP(fmt, ...) /* */
32 #endif
33 
34 #if defined(DEBUG_MODULES) && defined(__AVR__)
35 extern const char modules[];
36 #define dbg_modules(x) debug::dbg_usb(debug::modules, x)
37 #define dbg_modules_P(x) debug::dbg_usb_P(debug::modules, x)
38 #define dbg_modules_fP(fmt, ...) debug::dbg_usb_fP(debug::modules, fmt, __VA_ARGS__)
39 #else
40 #define dbg_modules(x) /* */
41 #define dbg_modules_P(x) /* */
42 #define dbg_modules_fP(fmt, ...) /* */
43 #endif
44 
45 #if defined(DEBUG_HAL) && defined(__AVR__)
46 extern const char hal[];
47 #define dbg_hal(x) debug::dbg_usb(debug::hal, x)
48 #define dbg_hal_P(x) debug::dbg_usb_P(debug::hal, x)
49 #define dbg_hal_fP(fmt, ...) debug::dbg_usb_fP(debug::hal, fmt, __VA_ARGS__)
50 #else
51 #define dbg_hal(x) /* */
52 #define dbg_hal_P(x) /* */
53 #define dbg_hal_fP(fmt, ...) /* */
54 #endif
55 
56 #if defined(DEBUG_LOGIC) || defined(DEBUG_MODULES) || defined(DEBUG_HAL)
60 void dbg_usb(const char *layer_P, const char *s);
61 
65 void dbg_usb_P(const char *layer_P, const char *s_P);
66 
71 void dbg_usb_fP(const char *layer_P, const char *fmt_P, ...);
72 #endif
73 
74 } // namespace debug
Debugging macros and tools.
Definition: debug.h:21
The logic namespace handles the application logic on top of the modules.
Definition: application.h:8
The modules namespace contains models of MMU's components.
Definition: command_base.h:8