Final push to unify all menu states

All states are now handled by the new menu system, although some are flagged to have a custom handler that does everything by itself.

I replaced most reference parameters to pointers to be able to typecast in a nicer way.

Key input is not passed as a parameter to the menu functions instead of having global variables they all access. I think I broke one thing by doing this, since there is no way to propagate key input changes to the next frame.
This commit is contained in:
Mikael Degerfält 2019-06-23 16:55:25 +02:00
parent 9a595c0ffc
commit 5b59b4cd0f
4 changed files with 364 additions and 314 deletions

View file

@ -274,12 +274,14 @@ static bool updateAdjustCursor(uint32_t timeNow) {
return false;
}
int updateAdjustMenu(uint32_t timeNow, uint8_t buttons, bool firstRun, bool drawSensor) {
int updateAdjustMenu(uint32_t timeNow, KeyState &input, bool firstRun, bool drawSensor) {
bool redraw = false;
int result = 0;
const AdjustMenuEntry *currentMenu = adjustMenuEntries[adjustOption];
uint8_t buttons = input.changed ? input.current : 0;
if(firstRun || refreshScreen) {
adjustCurrent = 0;
refreshScreen = false;
@ -294,7 +296,6 @@ int updateAdjustMenu(uint32_t timeNow, uint8_t buttons, bool firstRun, bool draw
redraw |= updateAdjustCursor(timeNow);
bool save = false;
if( buttons == BTN_DOWN ) {
adjustOption += 1;
refreshScreen = 1;
@ -357,3 +358,4 @@ int updateAdjustMenu(uint32_t timeNow, uint8_t buttons, bool firstRun, bool draw
return result;
}