Skip to content

Commit da94c6b

Browse files
committed
Use debug macros instead of using the longform access via instantiated object.
1 parent 086b772 commit da94c6b

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

Diff for: examples/Arduino_Debug_Advance/Arduino_Debug_Advance.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void setup() {
2424
int i = 0;
2525

2626
void loop() {
27-
Debug.print(DBG_VERBOSE, "i = %d", i);
27+
DBG_VERBOSE("i = %d", i);
2828
i++;
2929
delay(1000);
3030
}

Diff for: examples/Arduino_Debug_Basic/Arduino_Debug_Basic.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ void setup() {
88
int i = 0;
99

1010
void loop() {
11-
Debug.print(DBG_INFO, "i = %d", i);
11+
DBG_INFO("i = %d", i);
1212
i++;
1313
delay(1000);
1414
}

Diff for: src/Arduino_DebugUtils.h

+24
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,28 @@ class Arduino_DebugUtils {
9393

9494
extern Arduino_DebugUtils Debug;
9595

96+
/**************************************************************************************
97+
* DEFINE
98+
**************************************************************************************/
99+
100+
#ifndef DBG_ERROR
101+
# define DBG_ERROR(fmt, ...) Debug.print(DBG_ERROR, fmt, ## __VA_ARGS__)
102+
#endif
103+
104+
#ifndef DBG_WARNING
105+
# define DBG_WARNING(fmt, ...) Debug.print(DBG_WARNING, fmt, ## __VA_ARGS__)
106+
#endif
107+
108+
#ifndef DBG_INFO
109+
# define DBG_INFO(fmt, ...) Debug.print(DBG_INFO, fmt, ## __VA_ARGS__)
110+
#endif
111+
112+
#ifndef DBG_DEBUG
113+
# define DBG_DEBUG(fmt, ...) Debug.print(DBG_DEBUG, fmt, ## __VA_ARGS__)
114+
#endif
115+
116+
#ifndef DBG_VERBOSE
117+
# define DBG_VERBOSE(fmt, ...) Debug.print(DBG_VERBOSE, fmt, ## __VA_ARGS__)
118+
#endif
119+
96120
#endif /* ARDUINO_DEBUG_UTILS_H_ */

0 commit comments

Comments
 (0)