-
Notifications
You must be signed in to change notification settings - Fork 25
/
Debug.h
47 lines (35 loc) · 1.11 KB
/
Debug.h
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#ifndef _DEBUG_h
#define _DEBUG_h
//DEBUG printing
#define REMOTE_DEBUGGING_ENABLED
#define DEBUGGING_ENABLED
#ifdef DEBUGGING_ENABLED
#ifdef REMOTE_DEBUGGING_ENABLED
#include <RemoteDebug.h> //https://github.com/JoaoLopesF/RemoteDebug
extern RemoteDebug Debug;
#define debugPrintf(fmt, ...) \
Debug.isRunning() ? Debug.printf( fmt, __VA_ARGS__) : Serial.printf( fmt, __VA_ARGS__)
#define debugPrint(prnt) \
Debug.isRunning() ? Debug.print(prnt) : Serial.print(prnt)
#define debugPrintBase(prnt, base) \
Debug.isRunning() ? Debug.print(prnt, base) : Serial.print(prnt, base)
#define debugPrintln(prnt) \
Debug.isRunning() ? Debug.println(prnt) : Serial.println(prnt)
#else
#define debugPrintf(fmt, ...) \
Serial.printf( fmt, __VA_ARGS__)
#define debugPrint(prnt) \
Serial.print(prnt)
#define debugPrintBase(prnt) \
Serial.print(prnt,base)
#define debugPrintln(prnt) \
Serial.println(prnt)
#endif
#else
#define debugPrintf(fmt, ...)
#define debugPrint(prnt)
#define debugPrintBase(prnt, base)
#define debugPrintln(prnt)
#endif // DEBUGGING_ENABLED
#endif