-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.cpp
More file actions
28 lines (24 loc) · 868 Bytes
/
debug.cpp
File metadata and controls
28 lines (24 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "debug.h"
void debug_println(String x, int debug_level) {
//a function to print debug messages only if they are ob=ver the DEBUG_LEVEL
if (debug_level <= DEBUG_LEVEL) {
if (debug_level == DEBUG_WARNING) {
Serial.print("\033[33m"); // Set text color to yellow
} else if (debug_level == DEBUG_ERROR) {
Serial.print("\033[31m"); // Set text color to red
}
Serial.print(x);
Serial.println("\033[0m"); // Reset text color
}
}
void debug_print(String x, int debug_level) {
if (debug_level <= DEBUG_LEVEL) {
if (debug_level == DEBUG_WARNING) {
Serial.print("\033[33m"); // Set text color to yellow
} else if (debug_level == DEBUG_ERROR) {
Serial.print("\033[31m"); // Set text color to red
}
Serial.print(x);
Serial.print("\033[0m"); // Reset text color
}
}