forked from DCC-EX/CommandStation-EX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhmiGlobals.h
153 lines (136 loc) · 5.62 KB
/
hmiGlobals.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
* La Box Project
* Parameters
* @Author : Cedric Bellec
* @Organization : Locoduino.org
*/
#ifndef GLOBALS_H
#define GLOBALS_H
#include <Arduino.h>
//************************ Global variables ****************************
//***********************************************************************
enum enumHMIState :byte {StateDashboard, StateParametersMenu, StateDashboardTrainView, StateBrowseEventLst, StateExitMenu, StateWifiWaiting, StateNoWifi } ;
enum enumEvent :byte {noEvent, eventUp, eventDown, eventSel};
enum enumWifiMode :byte {wifiAp, wifiClient};
// variables must be global due to static methods
//enumEvent _HMIEvent = noEvent;
//************************** DEBUG LOG **********************************
//***********************************************************************
// Comment or uncomment #define if you want to see debugging information.
// Take care, to much informations is not good for the ESP32.
#define _HMIDEBUG // Global debugging traces. <<< Log levels only work if _HMIDEBUG is active >>>
#define _HMIDEBUG_CRITICAL // Critical error level
#define _HMIDEBUG_ERROR // Error level
//#define _HMIDEBUG_FUNCTION // Log begin and exit function
//#define _HMIDEBUG_PARAMS // Log parameters at function beginning
//#define _HMIDEBUG_LEVEL1 // Level 1 Log
//#define _HMIDEBUG_LEVEL2 // Level 2 Log
//#define _HMIDEBUG_LEVEL3 // Level 3 Log
//#define _HMIDEBUG_SIMUL // simulates physical measurements
//#define _HMIDEBUG_STATE_MACHINE // State Machine Log
//***********************************************************************
//*********************************************************************************
//------------------ Traces functions only if _HMIDEBUG is active --------------------
//*********************************************************************************
#ifdef _HMIDEBUG_FUNCTION
#define _HMIDEBUG_FCT_PRINTLN(x) Serial.println(x)
#define _HMIDEBUG_FCT_PRINTLN2(x,y) Serial.println(x,y)
#define _HMIDEBUG_FCT_PRINT(x) Serial.print(x)
#define _HMIDEBUG_FCT_PRINT2(x,y) Serial.print(x,y)
#else
#define _HMIDEBUG_FCT_PRINTLN(x)
#define _HMIDEBUG_FCT_PRINTLN2(x,y)
#define _HMIDEBUG_FCT_PRINT(x)
#define _HMIDEBUG_FCT_PRINT2(x,y)
#endif
#ifdef _HMIDEBUG_PARAMS
#define _HMIDEBUG_PARAMS_PRINTLN(x) Serial.println(x)
#define _HMIDEBUG_PARAMS_PRINTLN2(x,y) Serial.println(x,y)
#define _HMIDEBUG_PARAMS_PRINT(x) Serial.print(x)
#define _HMIDEBUG_PARAMS_PRINT2(x,y) Serial.print(x,y)
#else
#define _HMIDEBUG_PARAMS_PRINTLN(x)
#define _HMIDEBUG_PARAMS_PRINTLN2(x,y)
#define _HMIDEBUG_PARAMS_PRINT(x)
#define _HMIDEBUG_PARAMS_PRINT2(x,y)
#endif
#ifdef _HMIDEBUG_LEVEL1
#define _HMIDEBUG_LEVEL1_PRINTLN(x) Serial.println(x)
#define _HMIDEBUG_LEVEL1_PRINTLN2(x,y) Serial.println(x,y)
#define _HMIDEBUG_LEVEL1_PRINT(x) Serial.print(x)
#define _HMIDEBUG_LEVEL1_PRINT2(x,y) Serial.print(x,y)
#else
#define _HMIDEBUG_LEVEL1_PRINTLN(x)
#define _HMIDEBUG_LEVEL1_PRINTLN2(x,y)
#define _HMIDEBUG_LEVEL1_PRINT(x)
#define _HMIDEBUG_LEVEL1_PRINT2(x,y)
#endif
#ifdef _HMIDEBUG_LEVEL2
#define _HMIDEBUG_LEVEL2_PRINTLN(x) Serial.println(x)
#define _HMIDEBUG_LEVEL2_PRINTLN2(x,y) Serial.println(x,y)
#define _HMIDEBUG_LEVEL2_PRINT(x) Serial.print(x)
#define _HMIDEBUG_LEVEL2_PRINT2(x,y) Serial.print(x,y)
#else
#define _HMIDEBUG_LEVEL2_PRINTLN(x)
#define _HMIDEBUG_LEVEL2_PRINTLN2(x,y)
#define _HMIDEBUG_LEVEL2_PRINT(x)
#define _HMIDEBUG_LEVEL2_PRINT2(x,y)
#endif
#ifdef _HMIDEBUG_LEVEL3
#define _HMIDEBUG_LEVEL3_PRINTLN(x) Serial.println(x)
#define _HMIDEBUG_LEVEL3_PRINTLN2(x,y) Serial.println(x,y)
#define _HMIDEBUG_LEVEL3_PRINT(x) Serial.print(x)
#define _HMIDEBUG_LEVEL3_PRINT2(x,y) Serial.print(x,y)
#else
#define _HMIDEBUG_LEVEL3_PRINTLN(x)
#define _HMIDEBUG_LEVEL3_PRINTLN2(x,y)
#define _HMIDEBUG_LEVEL3_PRINT(x)
#define _HMIDEBUG_LEVEL3_PRINT2(x,y)
#endif
// simulates physical measurements
#ifdef _HMIDEBUG_SIMUL
#define _HMIDEBUG_SIMUL_PRINTLN(x) Serial.println(x)
#define _HMIDEBUG_SIMUL_PRINTLN2(x,y) Serial.println(x,y)
#define _HMIDEBUG_SIMUL_PRINT(x) Serial.print(x)
#define _HMIDEBUG_SIMUL_PRINT2(x,y) Serial.print(x,y)
#else
#define _HMIDEBUG_SIMUL_PRINTLN(x)
#define _HMIDEBUG_SIMUL_PRINTLN2(x,y)
#define _HMIDEBUG_SIMUL_PRINT(x)
#define _HMIDEBUG_SIMUL_PRINT2(x,y)
#endif
// simulates physical measurements
#ifdef _HMIDEBUG_STATE_MACHINE
#define _HMIDEBUG_SM_PRINTLN(x) Serial.println(x)
#define _HMIDEBUG_SM_PRINTLN2(x,y) Serial.println(x,y)
#define _HMIDEBUG_SM_PRINT(x) Serial.print(x)
#define _HMIDEBUG_SM_PRINT2(x,y) Serial.print(x,y)
#else
#define _HMIDEBUG_SM_PRINTLN(x)
#define _HMIDEBUG_SM_PRINTLN2(x,y)
#define _HMIDEBUG_SM_PRINT(x)
#define _HMIDEBUG_SM_PRINT2(x,y)
#endif
#ifdef _HMIDEBUG_CRITICAL
#define _HMIDEBUG_CRITICAL_PRINTLN(x) Serial.println(x)
#define _HMIDEBUG_CRITICAL_PRINTLN2(x,y) Serial.println(x,y)
#define _HMIDEBUG_CRITICAL_PRINT(x) Serial.print(x)
#define _HMIDEBUG_CRITICAL_PRINT2(x,y) Serial.print(x,y)
#else
#define _HMIDEBUG_CRITICAL_PRINTLN(x)
#define _HMIDEBUG_CRITICAL_PRINTLN2(x,y)
#define _HMIDEBUG_CRITICAL_PRINT(x)
#define _HMIDEBUG_CRITICAL_PRINT2(x,y)
#endif
#ifdef _HMIDEBUG_ERROR
#define _HMIDEBUG_ERROR_PRINTLN(x) Serial.println(x)
#define _HMIDEBUG_ERROR_PRINTLN2(x,y) Serial.println(x,y)
#define _HMIDEBUG_ERROR_PRINT(x) Serial.print(x)
#define _HMIDEBUG_ERROR_PRINT2(x,y) Serial.print(x,y)
#else
#define _HMIDEBUG_ERROR_PRINTLN(x)
#define _HMIDEBUG_ERROR_PRINTLN2(x,y)
#define _HMIDEBUG_ERROR_PRINT(x)
#define _HMIDEBUG_ERROR_PRINT2(x,y)
#endif
#endif