-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathDebug.h
64 lines (53 loc) · 2.5 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//#ifndef DEBUG_H
//#define DEBUG_H
#ifdef _SKIP_THIS_NOT_
/*
***************************************************************************
** Program : Debug.h, part of DSMRloggerAPI
** Version : v2.0.1
**
** Copyright (c) 2020 .. 2022 Willem Aandewiel
** Met dank aan Erik
**
** TERMS OF USE: MIT License. See bottom of file.
***************************************************************************
*/
//============ Includes ====================
#include "arduinoGlue.h"
//============ Added by Convertor ==========
/*---- start macro's ------------------------------------------------------------------*/
//-- moved to arduinoGlue.h // #define Debug(...) ({ Serial.print(__VA_ARGS__); \
//-- moved to arduinoGlue.h // TelnetStream.print(__VA_ARGS__); \
//-- moved to arduinoGlue.h // })
//-- moved to arduinoGlue.h // #define Debugln(...) ({ Serial.println(__VA_ARGS__); \
//-- moved to arduinoGlue.h // TelnetStream.println(__VA_ARGS__); \
//-- moved to arduinoGlue.h // })
//-- moved to arduinoGlue.h // #define Debugf(...) ({ Serial.printf(__VA_ARGS__); \
//-- moved to arduinoGlue.h // TelnetStream.printf(__VA_ARGS__); \
//-- moved to arduinoGlue.h // })
//-- moved to arduinoGlue.h // #define DebugFlush() ({ Serial.flush(); \
//-- moved to arduinoGlue.h // TelnetStream.flush(); \
//-- moved to arduinoGlue.h // })
//-- moved to arduinoGlue.h // #define DebugT(...) ({ _debugBOL(__FUNCTION__, __LINE__); \
//-- moved to arduinoGlue.h // Debug(__VA_ARGS__); \
//-- moved to arduinoGlue.h // })
//-- moved to arduinoGlue.h // #define DebugTln(...) ({ _debugBOL(__FUNCTION__, __LINE__); \
//-- moved to arduinoGlue.h // Debugln(__VA_ARGS__); \
//-- moved to arduinoGlue.h // })
//-- moved to arduinoGlue.h // #define DebugTf(...) ({ _debugBOL(__FUNCTION__, __LINE__); \
//-- moved to arduinoGlue.h // Debugf(__VA_ARGS__); \
//-- moved to arduinoGlue.h // })
/*---- einde macro's ------------------------------------------------------------------*/
//-- Version 0.0.1 - https://github.com/jandrassy/TelnetStream
//-- needs #include <TelnetStream.h>
char _bol[128];
void _debugBOL(const char *fn, int line)
{
snprintf(_bol, sizeof(_bol), "[%02d:%02d:%02d][%7u|%6u] %-12.12s(%4d): ", \
hour(), minute(), second(), \
ESP.getFreeHeap(), ESP.getMaxFreeBlockSize(), \
fn, line);
Serial.print (_bol);
TelnetStream.print (_bol);
}
#endif // DEBUG_H