-
Notifications
You must be signed in to change notification settings - Fork 2
/
DccExController.h
202 lines (165 loc) · 5.29 KB
/
DccExController.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
//
// DO NOT alter this file
//
#define maxFoundWitServers 5 // must be 5 for the moment
#define maxFoundSsids 60 // must be a multiple of 5
#define maxRoster 60 // must be a multiple of 10
#define maxTurnoutList 60 // must be a multiple of 10
#define maxRouteList 60 // must be a multiple of 10
extern int keypadUseType;
extern int encoderUseType;
extern boolean menuCommandStarted;
extern String menuCommand;
extern boolean menuIsShowing;
extern String oledText[];
extern bool oledTextInvert[];
extern int currentSpeed[];
extern Direction currentDirection[];
extern int speedStepCurrentMultiplier;
extern TrackPower trackPower;
extern bool circleValues;
extern int encoderValue;
extern int lastEncoderValue;
extern String selectedSsid;
extern String selectedSsidPassword;
extern int ssidConnectionState;
extern String ssidPasswordEntered;
extern boolean ssidPasswordChanged;
extern char ssidPasswordCurrentChar;
extern IPAddress selectedWitServerIP;
extern int selectedWitServerPort;
extern String selectedWitServerName;
extern int noOfWitServices;
extern int dccexConnectionState;
extern IPAddress foundWitServersIPs[];
extern int foundWitServersPorts[];
extern String foundWitServersNames[];
extern int foundWitServersCount;
extern String foundSsids[];
extern long foundSsidRssis[];
extern boolean foundSsidsOpen[];
extern int foundSsidsCount;
extern int ssidSelectionSource;
extern String witServerIpAndPortConstructed;
extern String witServerIpAndPortEntered;
extern boolean witServerIpAndPortChanged;
extern int rosterSize;
extern int rosterIndex[];
extern String rosterName[];
extern int rosterAddress[];
extern int page;
extern int turnoutListSize;
extern int turnoutListIndex[];
extern String turnoutListSysName[];
extern String turnoutListUserName[];
extern bool turnoutListState[];
extern int routeListSize;
extern int routeListIndex[];
extern String routeListSysName[];
extern String routeListUserName[];
extern boolean functionStates[][MAX_FUNCTIONS];
extern String functionLabels[][MAX_FUNCTIONS];
extern int functionFollow[][MAX_FUNCTIONS];
extern int currentSpeedStep[];
extern int heartBeatPeriod;
extern long lastServerResponseTime;
extern boolean heartbeatCheckEnabled;
extern const boolean encoderRotationClockwiseIsIncreaseSpeed;
extern const boolean toggleDirectionOnEncoderButtonPressWhenStationary;
extern int buttonActions[];
extern const String directCommandText[][3];
extern int additionalButtonActions[];
extern long lastSpeedSentTime;
extern int lastSpeedSent;
// extern int lastDirectionSent;
extern int lastSpeedThrottleIndex;
extern AiEsp32RotaryEncoder rotaryEncoder;
extern int currentThrottleIndex;
// function prototypes
void displayUpdateFromWit(void);
void ssidsLoop(void);
void browseSsids(void);
void selectSsidFromFound(int);
void getSsidPasswordAndWitIpForFound(void);
void enterSsidPassword(void);
void showListOfSsids(void);
void selectSsid(int);
void connectSsid(void);
void witServiceLoop(void);
void browseWitService(void);
void selectWitServer(int);
void connectWitServer(void);
void enterWitServer(void);
void disconnectWitServer(void);
void witEntryAddChar(char);
void witEntryDeleteChar(char);
void ssidPasswordAddChar(char);
void ssidPasswordDeleteChar(char);
void buildWitEntry(void);
void IRAM_ATTR readEncoderISR(void);
void rotary_onButtonClick(void);
void rotary_loop(void);
void encoderSpeedChange(boolean, int);
void keypadEvent(KeypadEvent);
void initialiseAdditionalButtons(void);
void additionalButtonLoop(void);
void setup(void);
void loop(void);
void doKeyPress(char, boolean);
void doDirectCommand (char, boolean);
void doDirectAdditionalButtonCommand (int, boolean);
void doDirectAction(int);
void doMenu(void);
void resetMenu(void);
void resetFunctionStates(int);
void loadFunctionLabels(int);
void resetFunctionLabels(int);
void resetAllFunctionLabels(void);
void speedEstop(void);
void speedDown(int, int);
void speedUp(int, int);
void speedSet(int, int);
void releaseAllLocos(int);
void toggleAdditionalMultiplier(void);
void toggleHeartbeatCheck(void);
void toggleDirection(int);
void changeDirection(int, Direction);
void doDirectFunction(int, int, boolean);
void doFunction(int, int, boolean);
void powerOnOff(TrackPower);
void powerToggle(void);
void nextThrottle(void);
void reconnect(void);
void setLastServerResponseTime(boolean);
void selectRoster(int);
void selectTurnoutList(int, boolean);
void selectRouteList(int);
void selectFunctionList(int);
void selectEditConsistList(int);
void _loadRoster();
void _loadTurnoutList();
void _loadRouteList();
void setAppnameForOled(void);
void writeOledFoundSSids(String);
void writeOledRoster(String);
void writeOledTurnoutList(String, boolean);
void writeOledRouteList(String);
void writeOledEnterPassword(void);
void writeOledMenu(String);
void writeOledExtraSubMenu();
void writeHeartbeatCheck(void);
void writeOledSpeed(void);
void writeOledFunctions(void);
void writeOledFunctionList(String);
void writeOledAllLocos(boolean);
void writeOledEditConsist();
void writeOledArray(boolean, boolean);
void writeOledArray(boolean, boolean, boolean);
void writeOledArray(boolean, boolean, boolean, boolean);
void clearOledArray(void);
void writeOledDirectCommands(void);
void debugLocoSpeed(String txt, Loco* loco);
void deepSleepStart();
void deepSleepStart(int);
char getMultiThrottleChar(int);
int getMultiThrottleIndex(char);