-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOperatorMenus.h
More file actions
167 lines (136 loc) · 5.88 KB
/
OperatorMenus.h
File metadata and controls
167 lines (136 loc) · 5.88 KB
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
/**************************************************************************
* This file is part of the RPU OS for Arduino Project.
I, Dick Hamill, the author of this program disclaim all copyright
in order to make this program freely available in perpetuity to
anyone who would like to use it. Dick Hamill, 12/7/2024
RPU OS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
RPU OS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
See <https://www.gnu.org/licenses/>.
*/
#ifndef OPERATOR_MENUS_H
#define OPERATOR_MENUS_H
#ifdef OPERATOR_MENUS_CPP
#define NUM_CPC_PAIRS 9
extern boolean CPCSelectionsHaveBeenRead;
extern byte CPCPairs[NUM_CPC_PAIRS][2];
extern byte CPCSelection[3];
#endif
#define OPERATOR_MENU_ADJ_TYPE_LIST 1
#define OPERATOR_MENU_ADJ_TYPE_MIN_MAX 2
#define OPERATOR_MENU_ADJ_TYPE_MIN_MAX_DEFAULT 3
#define OPERATOR_MENU_ADJ_TYPE_SCORE 4
#define OPERATOR_MENU_ADJ_TYPE_SCORE_WITH_DEFAULT 5
#define OPERATOR_MENU_ADJ_TYPE_SCORE_NO_DEFAULT 6
#define OPERATOR_MENU_ADJ_TYPE_CPC 7
#define OPERATOR_MENU_AUD_DISPLAY_ONLY 10
#define OPERATOR_MENU_AUD_CLEARABLE 11
#define OPERATOR_MENU_BUTTON_UNDEFINED 0xF0
#define OPERATOR_MENU_RETURN_TO_GAME 0
#define OPERATOR_MENU_SELF_TEST_MENU 1
#define OPERATOR_MENU_AUDITS_MENU 2
#define OPERATOR_MENU_BASIC_ADJ_MENU 3
#define OPERATOR_MENU_GAME_RULES_LEVEL 4
#define OPERATOR_MENU_GAME_ADJ_MENU 5
#define OPERATOR_MENU_NOT_ACTIVE 0xFF
#define OPERATOR_MENU_TEST_LAMPS 0
#define OPERATOR_MENU_TEST_DISPLAYS 1
#define OPERATOR_MENU_TEST_SOLENOIDS 2
#define OPERATOR_MENU_TEST_SWITCHES 3
#define OPERATOR_MENU_TEST_SOUNDS 4
#define OPERATOR_MENU_TEST_EJECT_BALLS 5
#define OPERATOR_MENU_VALUE_UNUSED 0xFD
#define OPERATOR_MENU_VALUE_OUT_OF_RANGE 0xFE
class OperatorMenus
{
public:
OperatorMenus();
~OperatorMenus();
void SetLastChangedTime(unsigned long setSelfTestChange);
void SetNavigationButtons(byte forwardButtonNum, byte backButtonNum, byte enterButtonNum, byte menuButtonNum);
void SetMenuButtonDebounce(short menuButtonDebounce);
unsigned long GetLastChangedTime();
void EnterOperatorMenu();
void ExitOperatorMenu();
boolean OperatorMenusActive();
boolean HasTopLevelChanged();
byte GetTopLevel();
boolean HasSubLevelChanged();
byte GetSubLevel();
void SetNumSubLevels(byte numSubLevels);
boolean HasParameterChanged();
byte GetParameterID();
boolean BallEjectInProgress(boolean startBallEject = false);
void SetCreditAndBIPRestore(byte creditRestore, byte bipRestore);
unsigned short GetParameterCallout();
void SetParameterControls( byte adjustmentType, byte numAdjustmentValues, byte *adjustmentValues,
short parameterCallout, short currentAdjustmentStorageByte,
byte *currentAdjustmentByte, unsigned long *currentAdjustmentUL );
void SetAuditControls( unsigned long *currentAuditUL, short currentAuditStorageByte, byte adjustmentType );
void SetLampsLookupCallback(byte (*lampLookup)(byte));
void SetSolenoidIDLookupCallback(unsigned short (*solenoidIDLookup)(byte));
void SetSolenoidStrengthLookupCallback(byte (*solenoidStrengthLookup)(byte));
void SetSoundCallbackFunction(byte (*soundCallback)(byte));
void SetDisplayTestCallback(byte (*displayTestCallback)(byte, byte, byte));
int UpdateMenu(unsigned long currentTime);
private:
byte TopLevel;
byte SubLevel;
byte ForwardButton;
byte BackButton;
byte EnterButton;
byte MenuButton;
byte NumSubLevels;
byte LastSwitchSeen;
byte CreditRestore;
byte BIPRestore;
byte NumSpeedyChanges;
short MenuButtonDebounce;
boolean TopLevelChanged;
boolean SubLevelChanged;
boolean ParameterChanged;
boolean EjectBalls;
unsigned long LastMenuButtonSeenTime;
byte AdjustmentType;
byte NumAdjustmentValues;
byte AdjustmentValues[8];
short CurrentAdjustmentStorageByte;
byte *CurrentAdjustmentByte;
byte ParameterID;
short ParameterCallout;
unsigned long *CurrentAdjustmentUL;
unsigned long SoundSettingTimeout;
unsigned long AdjustmentScore;
byte NextTestValue;
byte LastTestValue;
byte TestDelay;
boolean CycleTest;
boolean SolenoidStackStateOnEntry;
boolean FlipperStateOnEntry;
unsigned long LastTestTime;
unsigned long SavedValue;
unsigned long ResetHold;
unsigned long NextSpeedyValueChange;
unsigned long LastResetPress;
void StartSubMenu(unsigned long currentTime);
boolean AdvanceTopMenu(boolean moveForward);
boolean AdvanceSubMenu(boolean moveForward, boolean loopMenu, unsigned long currentTime);
void StartTestMode(unsigned long currentTime);
void UpdateSelfTest(unsigned long currentTime);
void ReadCurrentSwitches();
byte GetDisplayMaskForSwitches(byte switch1, byte switch2);
void HandleEnterButton(boolean doubleClick=false, boolean resetHeld=false, boolean speedyChange=false);
void ShowParameterValue();
void ShowAuditValue();
byte (*LampLookupFunction)(byte);
byte (*SolenoidStrengthLookupFunction)(byte);
byte (*SoundTestCallback)(byte);
byte (*DisplayTestCallback)(byte, byte, byte);
unsigned short (*SolenoidIDLookupFunction)(byte);
};
#endif