-
Notifications
You must be signed in to change notification settings - Fork 2
/
static.h
698 lines (625 loc) · 23.1 KB
/
static.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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
const String appName = "DccExController";
const String appVersion = " v0.22";
#ifndef MENU_TEXT_MENU
#define MENU_TEXT_MENU "* Menu # Key Defs"
#endif
#ifndef MENU_TEXT_MENU_HASH_IS_FUNCTIONS
#define MENU_TEXT_MENU_HASH_IS_FUNCTIONS "* Menu # Fn"
#endif
#ifndef MENU_TEXT_FINISH
#define MENU_TEXT_FINISH " # Finish"
#endif
#ifndef MENU_TEXT_CANCEL
#define MENU_TEXT_CANCEL "* Cancel"
#endif
#ifndef MENU_TEXT_SHOW_DIRECT
#define MENU_TEXT_SHOW_DIRECT " # Show Direct"
#endif
#ifndef MENU_TEXT_ROSTER
#define MENU_TEXT_ROSTER "* Cancel 0-9 #Pg"
#endif
#ifndef MENU_TEXT_TURNOUT_LIST
#define MENU_TEXT_TURNOUT_LIST "* Cancel 0-9 #Pg"
#endif
#ifndef MENU_TEXT_ROUTE_LIST
#define MENU_TEXT_ROUTE_LIST "* Cancel 0-9 #Pg"
#endif
#ifndef MENU_TEXT_FUNCTION_LIST
#define MENU_TEXT_FUNCTION_LIST "* Cancel 0-9 #Pg"
#endif
#ifndef MENU_TEXT_SELECT_WIT_SERVICE
#define MENU_TEXT_SELECT_WIT_SERVICE "0-4 # Entry E.btn OFF"
#endif
#ifndef MENU_TEXT_SELECT_WIT_ENTRY
#define MENU_TEXT_SELECT_WIT_ENTRY "0-9 * Back # Go E.btn OFF"
#endif
#ifndef MENU_TEXT_SELECT_SSIDS
#define MENU_TEXT_SELECT_SSIDS "0-9 # Search E.btn OFF"
#endif
#ifndef MENU_TEXT_SELECT_SSIDS_FROM_FOUND
#define MENU_TEXT_SELECT_SSIDS_FROM_FOUND "0-4 9 List # Pg E.btn OFF"
#endif
#ifndef MENU_TEXT_ENTER_SSID_PASSWORD
#define MENU_TEXT_ENTER_SSID_PASSWORD "E Chrs E.btn Slct # Go * Bck"
#endif
const String menu_text[14] = {
MENU_TEXT_MENU,
MENU_TEXT_MENU_HASH_IS_FUNCTIONS,
MENU_TEXT_FINISH,
MENU_TEXT_CANCEL,
MENU_TEXT_SHOW_DIRECT,
MENU_TEXT_ROSTER,
MENU_TEXT_TURNOUT_LIST,
MENU_TEXT_ROUTE_LIST,
MENU_TEXT_FUNCTION_LIST,
MENU_TEXT_SELECT_WIT_SERVICE,
MENU_TEXT_SELECT_WIT_ENTRY,
MENU_TEXT_SELECT_SSIDS,
MENU_TEXT_SELECT_SSIDS_FROM_FOUND,
MENU_TEXT_ENTER_SSID_PASSWORD
};
const int menu_menu = 0;
const int menu_menu_hash_is_functions = 1;
const int menu_finish = 2;
const int menu_cancel = 3;
const int menu_show_direct = 4;
const int menu_roster = 5;
const int menu_turnout_list = 6;
const int menu_route_list = 7;
const int menu_function_list = 8;
const int menu_select_wit_service = 9;
const int menu_select_wit_entry = 10;
const int menu_select_ssids = 11;
const int menu_select_ssids_from_found = 12;
const int menu_enter_ssid_password = 13;
const int last_oled_screen_speed = 0;
const int last_oled_screen_roster = 1;
const int last_oled_screen_turnout_list = 2;
const int last_oled_screen_route_list = 3;
const int last_oled_screen_function_list = 4;
const int last_oled_screen_menu = 5;
const int last_oled_screen_extra_submenu = 6;
const int last_oled_screen_all_locos = 7;
const int last_oled_screen_edit_consist = 8;
const int last_oled_screen_direct_commands = 9;
#ifndef DIRECT_COMMAND_LIST
#define DIRECT_COMMAND_LIST "Direct Commands"
#endif
#ifndef DIRECTION_FORWARD_TEXT
#define DIRECTION_FORWARD_TEXT "Fwd"
#endif
#ifndef DIRECTION_REVERSE_TEXT
#define DIRECTION_REVERSE_TEXT "Rev"
#endif
#ifndef DIRECTION_FORWARD_TEXT_SHORT
#define DIRECTION_FORWARD_TEXT_SHORT ">"
#endif
#ifndef DIRECTION_REVERSE_TEXT_SHORT
#define DIRECTION_REVERSE_TEXT_SHORT "<"
#endif
#ifndef DIRECTION_REVERSE_INDICATOR
#define DIRECTION_REVERSE_INDICATOR "'"
#endif
// const String function_states = "fn ";
#ifndef MSG_START
#define MSG_START "Start"
#endif
#ifndef MSG_BROWSING_FOR_SERVICE
#define MSG_BROWSING_FOR_SERVICE "Browsing for WiT services"
#endif
#ifndef MSG_BROWSING_FOR_SSIDS
#define MSG_BROWSING_FOR_SSIDS "Browsing for SSIDs"
#endif
#ifndef MSG_NO_SSIDS_FOUND
#define MSG_NO_SSIDS_FOUND "No SSIDs found"
#endif
#ifndef MSG_SSIDS_LISTED
#define MSG_SSIDS_LISTED " SSIDs listed"
#endif
#ifndef MSG_SSIDS_FOUND
#define MSG_SSIDS_FOUND " SSIDs found"
#endif
#ifndef MSG_BOUNJOUR_SETUP_FAILED
#define MSG_BOUNJOUR_SETUP_FAILED "Unable to setup Listener"
#endif
#ifndef MSG_NO_SERVICES_FOUND
#define MSG_NO_SERVICES_FOUND "No services found"
#endif
#ifndef MSG_NO_SERVICES_FOUND_ENTRY_REQUIRED
#define MSG_NO_SERVICES_FOUND_ENTRY_REQUIRED "Enter witServer IP:Port"
#endif
#ifndef MSG_SERVICES_FOUND
#define MSG_SERVICES_FOUND " Service(s) found"
#endif
#ifndef MSG_TRYING_TO_CONNECT
#define MSG_TRYING_TO_CONNECT "Trying to Connect"
#endif
#ifndef MSG_CONNECTED
#define MSG_CONNECTED " Connected"
#endif
#ifndef MSG_CONNECTING
#define MSG_CONNECTING " Connecting..."
#endif
#ifndef MSG_ADDRESS_LABEL
#define MSG_ADDRESS_LABEL "IP address: "
#endif
#ifndef MSG_CONNECTION_FAILED
#define MSG_CONNECTION_FAILED "Connection failed"
#endif
#ifndef MSG_DISCONNECTED
#define MSG_DISCONNECTED "Disconnected"
#endif
#ifndef MSG_AUTO_SLEEP
#define MSG_AUTO_SLEEP "Waited too long for Select"
#endif
#ifndef MSG_BATTERY_SLEEP
#define MSG_BATTERY_SLEEP "Battery critically low"
#endif
#ifndef MSG_START_SLEEP
#define MSG_START_SLEEP "Shutting Down. E.btn ON"
#endif
#ifndef MSG_THROTTLE_NUMBER
#define MSG_THROTTLE_NUMBER " Throttle #"
#endif
#ifndef MSG_NO_LOCO_SELECTED
#define MSG_NO_LOCO_SELECTED " No Loco selected"
#endif
#ifndef MSG_ENTER_PASSWORD
#define MSG_ENTER_PASSWORD "Enter Password"
#endif
#ifndef MSG_GUESSED_EX_CS_WIT_SERVER
#define MSG_GUESSED_EX_CS_WIT_SERVER "'Guessed' EX-CS WiT server"
#endif
#ifndef MSG_BYPASS_WIT_SERVER_SEARCH
#define MSG_BYPASS_WIT_SERVER_SEARCH "Bypass WiT server search"
#endif
#ifndef MSG_NO_FUNCTIONS
#define MSG_NO_FUNCTIONS "Function List - No Functions"
#endif
#ifndef MSG_HEARTBEAT_CHECK_ENABLED
#define MSG_HEARTBEAT_CHECK_ENABLED "Heartbeat Check Enabled"
#endif
#ifndef MSG_HEARTBEAT_CHECK_DISABLED
#define MSG_HEARTBEAT_CHECK_DISABLED "Heartbeat Check Disabled"
#endif
const int glyph_heartbeat_off = 0x00b7;
const int glyph_track_power = 0x00eb;
const int glyph_speed_step = 0x00d6;
// const int glyph_direction_forward = 0x0070;
// const int glyph_direction_reverse = 0x006d;
#define SLEEP_REASON_COMMAND 0
#define SLEEP_REASON_INACTIVITY 1
#define SLEEP_REASON_BATTERY 2
#define KEYPAD_USE_OPERATION 0
#define KEYPAD_USE_SELECT_SSID 1
#define KEYPAD_USE_SELECT_SSID_FROM_FOUND 2
#define KEYPAD_USE_SELECT_WITHROTTLE_SERVER 3
#define KEYPAD_USE_ENTER_WITHROTTLE_SERVER 4
#define KEYPAD_USE_SELECT_ROSTER 5
#define KEYPAD_USE_SELECT_TURNOUTS_THROW 6
#define KEYPAD_USE_SELECT_TURNOUTS_CLOSE 7
#define KEYPAD_USE_SELECT_ROUTES 8
#define KEYPAD_USE_SELECT_FUNCTION 9
#define KEYPAD_USE_ENTER_SSID_PASSWORD 10
#define KEYPAD_USE_EDIT_CONSIST 11
#define ENCODER_USE_OPERATION 0
#define ENCODER_USE_SSID_PASSWORD 1
// used for both wit and ssid
#define CONNECTION_STATE_DISCONNECTED 0
#define CONNECTION_STATE_CONNECTED 1
#define CONNECTION_STATE_SELECTION_REQUIRED 2
#define CONNECTION_STATE_ENTRY_REQUIRED 3
#define CONNECTION_STATE_SELECTED 4
#define CONNECTION_STATE_PASSWORD_ENTRY 5
#define CONNECTION_STATE_ENTERED 6
#define SSID_CONNECTION_SOURCE_LIST 0
#define SSID_CONNECTION_SOURCE_BROWSE 1
#define CMD_FUNCTION 0
#define MAX_LOCOS 10 // maximum number of locos that can be added to the consist
#define MAX_FUNCTIONS 32
#define MENU_ITEM_FUNCTION '0'
#define MENU_ITEM_ADD_LOCO '1'
#define MENU_ITEM_DROP_LOCO '2'
#define MENU_ITEM_TOGGLE_DIRECTION '3'
#define MENU_ITEM_SPEED_STEP_MULTIPLIER '4'
#define MENU_ITEM_THROW_POINT '5'
#define MENU_ITEM_CLOSE_POINT '6'
#define MENU_ITEM_ROUTE '7'
#define MENU_ITEM_TRACK_POWER '8'
#define MENU_ITEM_EXTRAS '9'
#ifndef MENU_ITEM_TEXT_TITLE_FUNCTION
#define MENU_ITEM_TEXT_TITLE_FUNCTION "Function"
#endif
#ifndef MENU_ITEM_TEXT_TITLE_ADD_LOCO
#define MENU_ITEM_TEXT_TITLE_ADD_LOCO "Add Loco"
#endif
#ifndef MENU_ITEM_TEXT_TITLE_DROP_LOCO
#define MENU_ITEM_TEXT_TITLE_DROP_LOCO "Drop Loco"
#endif
#ifndef MENU_ITEM_TEXT_TITLE_TOGGLE_DIRECTION
#define MENU_ITEM_TEXT_TITLE_TOGGLE_DIRECTION "Toggle Dir"
#endif
#ifndef MENU_ITEM_TEXT_TITLE_SPEED_STEP_MULTIPLIER
#define MENU_ITEM_TEXT_TITLE_SPEED_STEP_MULTIPLIER "X Speed Step"
#endif
#ifndef MENU_ITEM_TEXT_TITLE_THROW_POINT
#define MENU_ITEM_TEXT_TITLE_THROW_POINT "Throw Point"
#endif
#ifndef MENU_ITEM_TEXT_TITLE_CLOSE_POINT
#define MENU_ITEM_TEXT_TITLE_CLOSE_POINT "Close Point"
#endif
#ifndef MENU_ITEM_TEXT_TITLE_ROUTE
#define MENU_ITEM_TEXT_TITLE_ROUTE "Route"
#endif
#ifndef MENU_ITEM_TEXT_TITLE_TRACK_POWER
#define MENU_ITEM_TEXT_TITLE_TRACK_POWER "Trk Power"
#endif
#ifndef MENU_ITEM_TEXT_TITLE_EXTRAS
#define MENU_ITEM_TEXT_TITLE_EXTRAS "Extras"
#endif
#ifndef MENU_ITEM_TEXT_TITLE_HEARTBEAT
#define MENU_ITEM_TEXT_TITLE_HEARTBEAT "Heartbeat"
#endif
#ifndef MENU_ITEM_TEXT_TITLE_EDIT_CONSIST
#define MENU_ITEM_TEXT_TITLE_EDIT_CONSIST "Edit Consist Facing"
#endif
#ifndef MENU_ITEM_TEXT_MENU_FUNCTION
#define MENU_ITEM_TEXT_MENU_FUNCTION "no+# Select * Cancel # List"
#endif
#ifndef MENU_ITEM_TEXT_MENU_ADD_LOCO
#define MENU_ITEM_TEXT_MENU_ADD_LOCO "addr+# Add * Cancel # Roster"
#endif
#ifndef MENU_ITEM_TEXT_MENU_DROP_LOCO
#define MENU_ITEM_TEXT_MENU_DROP_LOCO "addr+# One * Cancel # All"
#endif
#ifndef MENU_ITEM_TEXT_MENU_TOGGLE_DIRECTION
#define MENU_ITEM_TEXT_MENU_TOGGLE_DIRECTION "# Toggle "
#endif
#ifndef MENU_ITEM_TEXT_MENU_SPEED_STEP_MULTIPLIER
#define MENU_ITEM_TEXT_MENU_SPEED_STEP_MULTIPLIER "* Cancel # Toggle"
#endif
#ifndef MENU_ITEM_TEXT_MENU_THROW_POINT
#define MENU_ITEM_TEXT_MENU_THROW_POINT "no+# Throw * Cancel # List"
#endif
#ifndef MENU_ITEM_TEXT_MENU_CLOSE_POINT
#define MENU_ITEM_TEXT_MENU_CLOSE_POINT "no+# Close * Cancel # List"
#endif
#ifndef MENU_ITEM_TEXT_MENU_ROUTE
#define MENU_ITEM_TEXT_MENU_ROUTE "no+# Select * Cancel # List"
#endif
#ifndef MENU_ITEM_TEXT_MENU_TRACK_POWER
#define MENU_ITEM_TEXT_MENU_TRACK_POWER "* Cancel # Toggle"
#endif
#ifndef MENU_ITEM_TEXT_MENU_EXTRAS
#define MENU_ITEM_TEXT_MENU_EXTRAS "no Select * Cancel "
#endif
#ifndef MENU_ITEM_TEXT_MENU_HEARTBEAT
#define MENU_ITEM_TEXT_MENU_HEARTBEAT "* Close "
#endif
#ifndef MENU_ITEM_TEXT_MENU_EDIT_CONSIST
#define MENU_ITEM_TEXT_MENU_EDIT_CONSIST "no Chng Facing * Close"
#endif
const String menuText[12][3] = {
{MENU_ITEM_TEXT_TITLE_FUNCTION, MENU_ITEM_TEXT_MENU_FUNCTION, ""}, //0
{MENU_ITEM_TEXT_TITLE_ADD_LOCO, MENU_ITEM_TEXT_MENU_ADD_LOCO, ""}, //1
{MENU_ITEM_TEXT_TITLE_DROP_LOCO, MENU_ITEM_TEXT_MENU_DROP_LOCO, ""}, //2
{MENU_ITEM_TEXT_TITLE_TOGGLE_DIRECTION, MENU_ITEM_TEXT_MENU_TOGGLE_DIRECTION, ""}, //3
{MENU_ITEM_TEXT_TITLE_SPEED_STEP_MULTIPLIER, MENU_ITEM_TEXT_MENU_SPEED_STEP_MULTIPLIER, ""}, //4
{MENU_ITEM_TEXT_TITLE_THROW_POINT, MENU_ITEM_TEXT_MENU_THROW_POINT, ""}, //5
{MENU_ITEM_TEXT_TITLE_CLOSE_POINT, MENU_ITEM_TEXT_MENU_CLOSE_POINT, ""}, //6
{MENU_ITEM_TEXT_TITLE_ROUTE, MENU_ITEM_TEXT_MENU_ROUTE, ""}, //7
{MENU_ITEM_TEXT_TITLE_TRACK_POWER, MENU_ITEM_TEXT_MENU_TRACK_POWER, ""}, //8
{MENU_ITEM_TEXT_TITLE_EXTRAS, MENU_ITEM_TEXT_MENU_EXTRAS, ""}, //9
{MENU_ITEM_TEXT_TITLE_HEARTBEAT, MENU_ITEM_TEXT_MENU_HEARTBEAT, ""}, //10
{MENU_ITEM_TEXT_TITLE_EDIT_CONSIST, MENU_ITEM_TEXT_MENU_EDIT_CONSIST, ""} //11
};
const int menuCharsRequired[12] = { // 0=none effectively a direct command / 1=one used for sub menus / 2=one or more
2, //0
2, //1
2, //2
0, //3
0, //4
2, //5
2, //6
2, //7
0, //8
1, //9
2, //10
2 //11
};
#ifndef EXTRA_MENU_TEXT_CHAR_FUNCTION_KEY_TOGGLE
#define EXTRA_MENU_TEXT_CHAR_FUNCTION_KEY_TOGGLE "Fnc/Key Tgl"
#endif
#ifndef EXTRA_MENU_TEXT_CHAR_EDIT_CONSIST
#define EXTRA_MENU_TEXT_CHAR_EDIT_CONSIST "Edt Consist"
#endif
#ifndef EXTRA_MENU_TEXT_CHAR_TBA
#define EXTRA_MENU_TEXT_CHAR_TBA ""
#endif
#ifndef EXTRA_MENU_TEXT_CHAR_HEARTBEAT_TOGGLE
#define EXTRA_MENU_TEXT_CHAR_HEARTBEAT_TOGGLE "Heartbt Tgl"
#endif
#ifndef EXTRA_MENU_TEXT_CHAR_INCREASE_MAX_THROTTLES
#define EXTRA_MENU_TEXT_CHAR_INCREASE_MAX_THROTTLES "#Throttles +"
#endif
#ifndef EXTRA_MENU_TEXT_CHAR_DECREASE_MAX_THROTTLES
#define EXTRA_MENU_TEXT_CHAR_DECREASE_MAX_THROTTLES "#Throttles -"
#endif
#ifndef EXTRA_MENU_TEXT_CHAR_DISCONNECT
#define EXTRA_MENU_TEXT_CHAR_DISCONNECT "Disconnect"
#endif
#ifndef EXTRA_MENU_TEXT_CHAR_OFF_SLEEP
#define EXTRA_MENU_TEXT_CHAR_OFF_SLEEP "OFF / Sleep"
#endif
const String extraSubMenuText[8] = {
EXTRA_MENU_TEXT_CHAR_FUNCTION_KEY_TOGGLE, //0
EXTRA_MENU_TEXT_CHAR_EDIT_CONSIST, //1
EXTRA_MENU_TEXT_CHAR_TBA, //2
EXTRA_MENU_TEXT_CHAR_HEARTBEAT_TOGGLE, //3
EXTRA_MENU_TEXT_CHAR_INCREASE_MAX_THROTTLES, //4
EXTRA_MENU_TEXT_CHAR_DECREASE_MAX_THROTTLES, //5
EXTRA_MENU_TEXT_CHAR_DISCONNECT, //6
EXTRA_MENU_TEXT_CHAR_OFF_SLEEP }; //7
#define EXTRA_MENU_CHAR_FUNCTION_KEY_TOGGLE '0'
#define EXTRA_MENU_CHAR_EDIT_CONSIST '1'
#define EXTRA_MENU_CHAR_TBA '2'
#define EXTRA_MENU_CHAR_HEARTBEAT_TOGGLE '3'
#define EXTRA_MENU_CHAR_INCREASE_MAX_THROTTLES '4'
#define EXTRA_MENU_CHAR_DECREASE_MAX_THROTTLES '5'
#define EXTRA_MENU_CHAR_DISCONNECT '6'
#define EXTRA_MENU_CHAR_OFF_SLEEP '7'
#define EXTRA_MENU_CHAR_OFF_SLEEP_HIDDEN '9' // doesn't appear in the menu
// if defined in config_buttons.h these values will be overwritten
//
// speed increase for each click of the encoder
#ifdef SPEED_STEP
const int speedStep = SPEED_STEP;
#else
const int speedStep = 4;
#endif
#ifdef SPEED_STEP_MULTIPLIER
const int speedStepMultiplier = SPEED_STEP_MULTIPLIER; // for 'fast' speed steps
#else
const int speedStepMultiplier = 3; // for 'fast' speed steps
#endif
// Additional multiplier. If the multiplier is enabled from the menu, each rotation of the encoder becomes the speedStep * the AdditionalMultiplier
#ifdef SPEED_STEP_MULTIPLIER
const int speedStepAdditionalMultiplier = SPEED_STEP_MULTIPLIER;
#else
const int speedStepAdditionalMultiplier = 2;
#endif
#ifdef DISPLAY_SPEED_AS_PERCENT
const bool speedDisplayAsPercent = DISPLAY_SPEED_AS_PERCENT;
#else
const bool speedDisplayAsPercent = false;
#endif
#ifdef DISPLAY_SPEED_AS_0_TO_28
const bool speedDisplayAs0to28 = DISPLAY_SPEED_AS_0_TO_28;
#else
const bool speedDisplayAs0to28 = false;
#endif
String witServerIpAndPortEntryMask = "###.###.###.###:#####";
#ifndef DEFAULT_IP_AND_PORT
#define DEFAULT_IP_AND_PORT ""
#endif
#ifndef SSID_CONNECTION_TIMEOUT
#define SSID_CONNECTION_TIMEOUT 10000
#endif
const char ssidPasswordBlankChar = 164;
// *******************************************************************************************************************
// fonts
#define FONT_DEFAULT u8g2_font_NokiaSmallPlain_tf
#define FONT_FUNCTION_INDICATORS u8g2_font_tiny_simon_tr
#define FONT_THROTTLE_NUMBER u8g2_font_neuecraft_tr
#define FONT_PASSWORD u8g2_font_9x15_tf
#define FONT_SPEED u8g2_font_profont29_mr
// #define FONT_DIRECTION u8g2_font_profont17_tr
#define FONT_DIRECTION u8g2_font_neuecraft_tr
// #define FONT_TRACK_POWER u8g2_font_profont10_tf
#define FONT_TRACK_POWER u8g2_font_open_iconic_all_1x_t
#define FONT_HEARTBEAT u8g2_font_open_iconic_all_1x_t
#define FONT_SPEED_STEP u8g2_font_open_iconic_all_1x_t
#define FONT_NEXT_THROTTLE u8g2_font_6x12_m_symbols
#define CONSIST_LEAD_LOCO 0
#define CONSIST_ALL_LOCOS 1
// *******************************************************************************************************************
#ifndef DCCEXCONTROLLER_DEBUG
#define DCCEXCONTROLLER_DEBUG 0
#endif
#ifndef DCCEXPROTOCOL_DEBUG
#define DCCEXPROTOCOL_DEBUG 1
#endif
// *******************************************************************************************************************
#ifndef AUTO_CONNECT_TO_FIRST_DEFINED_SERVER
#define AUTO_CONNECT_TO_FIRST_DEFINED_SERVER false
#endif
#ifndef AUTO_CONNECT_TO_FIRST_WITHROTTLE_SERVER
#define AUTO_CONNECT_TO_FIRST_WITHROTTLE_SERVER true
#endif
// *******************************************************************************************************************
#ifndef F0_LATCHING
#define F0_LATCHING true
#endif
#ifndef F1_LATCHING
#define F1_LATCHING false
#endif
#ifndef F2_LATCHING
#define F2_LATCHING false
#endif
#ifndef F0_LABEL
#define F0_LABEL "Light"
#endif
#ifndef F1_LABEL
#define F1_LABEL "Bell"
#endif
#ifndef F2_LABEL
#define F2_LABEL "Horn"
#endif
// *******************************************************************************************************************
#ifndef ROTARY_ENCODER_DEBOUNCE_TIME
#define ROTARY_ENCODER_DEBOUNCE_TIME 200
#endif
#ifndef SEARCH_ROSTER_ON_ENTRY_OF_DCC_ADDRESS
#define SEARCH_ROSTER_ON_ENTRY_OF_DCC_ADDRESS false
#endif
// *******************************************************************************************************************
// consists follow functions
#ifndef CONSIST_FUNCTION_FOLLOW_F0
#define CONSIST_FUNCTION_FOLLOW_F0 CONSIST_ALL_LOCOS // lights
#endif
#ifndef CONSIST_FUNCTION_FOLLOW_F1
#define CONSIST_FUNCTION_FOLLOW_F1 CONSIST_LEAD_LOCO // bell
#endif
#ifndef CONSIST_FUNCTION_FOLLOW_F2
#define CONSIST_FUNCTION_FOLLOW_F2 CONSIST_LEAD_LOCO // horn
#endif
#ifndef CONSIST_FUNCTION_FOLLOW_OTHER_FUNCTIONS
#define CONSIST_FUNCTION_FOLLOW_OTHER_FUNCTIONS CONSIST_LEAD_LOCO
#endif
// *******************************************************************************************************************
// other options
#ifndef HASH_SHOWS_FUNCTIONS_INSTEAD_OF_KEY_DEFS
#define HASH_SHOWS_FUNCTIONS_INSTEAD_OF_KEY_DEFS false // default if not defined in config_buttons.h
#endif
#ifndef MAX_THROTTLES
#define MAX_THROTTLES 2 // default if not defined in config_buttons.h
#endif
#ifndef ENCODER_BUTTON_ACTION
#define ENCODER_BUTTON_ACTION SPEED_STOP_THEN_TOGGLE_DIRECTION // default if not defined in config_buttons.h
#endif
// *******************************************************************************************************************
// OLED
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h> // add to include path [Arduino install]\hardware\arduino\avr\libraries\SPI\src
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h> // add to include path [Arduino install]\hardware\arduino\avr\libraries\Wire\src
#endif
// U8g2 Constructor List (Frame Buffer)
// you can overide this in config_buttons.h DO NOT CHANGE IT HERE
#ifndef OLED_TYPE
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE, /* clock=*/ 22, /* data=*/ 23);
#else
OLED_TYPE
#endif
// *******************************************************************************************************************
// additional / optional commands
// these can be any legitimate DCC-EX Native protocol command
#ifndef CUSTOM_COMMAND_1
#define CUSTOM_COMMAND_1 ""
#endif
#ifndef CUSTOM_COMMAND_2
#define CUSTOM_COMMAND_2 ""
#endif
#ifndef CUSTOM_COMMAND_3
#define CUSTOM_COMMAND_3 ""
#endif
#ifndef CUSTOM_COMMAND_4
#define CUSTOM_COMMAND_4 ""
#endif
#ifndef CUSTOM_COMMAND_5
#define CUSTOM_COMMAND_5 ""
#endif
#ifndef CUSTOM_COMMAND_6
#define CUSTOM_COMMAND_6 ""
#endif
#ifndef CUSTOM_COMMAND_7
#define CUSTOM_COMMAND_7 ""
#endif
// *******************************************************************************************************************
// default direct functions
// Labels that will appear in the UI
// These should match the actual commands below
#ifndef CHOSEN_KEYPAD_0_DISPLAY_NAME
#define CHOSEN_KEYPAD_0_DISPLAY_NAME "0 Lights"
#endif
#ifndef CHOSEN_KEYPAD_1_DISPLAY_NAME
#define CHOSEN_KEYPAD_1_DISPLAY_NAME "1 Bell"
#endif
#ifndef CHOSEN_KEYPAD_2_DISPLAY_NAME
#define CHOSEN_KEYPAD_2_DISPLAY_NAME "2 Horn"
#endif
#ifndef CHOSEN_KEYPAD_3_DISPLAY_NAME
#define CHOSEN_KEYPAD_3_DISPLAY_NAME "3 F3"
#endif
#ifndef CHOSEN_KEYPAD_4_DISPLAY_NAME
#define CHOSEN_KEYPAD_4_DISPLAY_NAME "4 F4"
#endif
#ifndef CHOSEN_KEYPAD_5_DISPLAY_NAME
#define CHOSEN_KEYPAD_5_DISPLAY_NAME "5 Nxt Ttl"
#endif
#ifndef CHOSEN_KEYPAD_6_DISPLAY_NAME
#define CHOSEN_KEYPAD_6_DISPLAY_NAME "6 X Spd"
#endif
#ifndef CHOSEN_KEYPAD_7_DISPLAY_NAME
#define CHOSEN_KEYPAD_7_DISPLAY_NAME "7 Rev"
#endif
#ifndef CHOSEN_KEYPAD_8_DISPLAY_NAME
#define CHOSEN_KEYPAD_8_DISPLAY_NAME "8 Estop"
#endif
#ifndef CHOSEN_KEYPAD_9_DISPLAY_NAME
#define CHOSEN_KEYPAD_9_DISPLAY_NAME "9 Fwd"
#endif
// actual commands
#ifndef CHOSEN_KEYPAD_0_FUNCTION
#define CHOSEN_KEYPAD_0_FUNCTION FUNCTION_0
#endif
#ifndef CHOSEN_KEYPAD_1_FUNCTION
#define CHOSEN_KEYPAD_1_FUNCTION FUNCTION_1
#endif
#ifndef CHOSEN_KEYPAD_2_FUNCTION
#define CHOSEN_KEYPAD_2_FUNCTION FUNCTION_2
#endif
#ifndef CHOSEN_KEYPAD_3_FUNCTION
#define CHOSEN_KEYPAD_3_FUNCTION FUNCTION_3
#endif
#ifndef CHOSEN_KEYPAD_4_FUNCTION
#define CHOSEN_KEYPAD_4_FUNCTION FUNCTION_4
#endif
#ifndef CHOSEN_KEYPAD_5_FUNCTION
#define CHOSEN_KEYPAD_5_FUNCTION NEXT_THROTTLE
#endif
#ifndef CHOSEN_KEYPAD_6_FUNCTION
#define CHOSEN_KEYPAD_6_FUNCTION SPEED_MULTIPLIER
#endif
#ifndef CHOSEN_KEYPAD_7_FUNCTION
#define CHOSEN_KEYPAD_7_FUNCTION DIRECTION_REVERSE
#endif
#ifndef CHOSEN_KEYPAD_8_FUNCTION
#define CHOSEN_KEYPAD_8_FUNCTION E_STOP
#endif
#ifndef CHOSEN_KEYPAD_9_FUNCTION
#define CHOSEN_KEYPAD_9_FUNCTION DIRECTION_FORWARD
#endif
#ifndef CHOSEN_KEYPAD_A_FUNCTION
#define CHOSEN_KEYPAD_A_FUNCTION CUSTOM_1
#endif
#ifndef CHOSEN_KEYPAD_B_FUNCTION
#define CHOSEN_KEYPAD_B_FUNCTION CUSTOM_2
#endif
#ifndef CHOSEN_KEYPAD_C_FUNCTION
#define CHOSEN_KEYPAD_C_FUNCTION CUSTOM_3
#endif
#ifndef CHOSEN_KEYPAD_D_FUNCTION
#define CHOSEN_KEYPAD_D_FUNCTION CUSTOM_4
#endif
// *******************************************************************************************************************
#ifndef USE_BATTERY_TEST
#define USE_BATTERY_TEST false
#endif
#ifndef BATTERY_TEST_PIN
#define BATTERY_TEST_PIN 34
#endif
#ifndef USE_BATTERY_PERCENT_AS_WELL_AS_ICON
#define USE_BATTERY_PERCENT_AS_WELL_AS_ICON false
#endif
#ifndef USE_BATTERY_SLEEP_AT_PERCENT
#define USE_BATTERY_SLEEP_AT_PERCENT 3
#endif
// ***************************************************
// ESPmDNS problem
#if ESP_IDF_VERSION_MAJOR < 5
#define ESPMDNS_IP_ATTRIBUTE_NAME MDNS.IP(i)
#else
#define ESPMDNS_IP_ATTRIBUTE_NAME MDNS.address(i)
#endif