WIP on making menues even more generic in handling

This commit is contained in:
Mikael Degerfält 2019-06-23 13:30:58 +02:00
parent be0d08d8d6
commit 9a595c0ffc

View file

@ -960,6 +960,37 @@ static bool updatePage(const MenuPage &page, uint32_t timeNow) {
} }
} }
static bool updateSensorPixelsFlag = false;
void drawSensorPixels() {
updateSensorPixelsFlag = true;
}
bool adjustPageUpdate(uint16_t buttonChanges, uint32_t timeNow) {
// This is a hack to update touch_Thr is it was changed..
int old_thr = ctouchThrVal;
int result = updateAdjustMenu(timeNow, buttonChanges, stateFirstRun, updateSensorPixelsFlag);
bool redraw = false;
updateSensorPixelsFlag = false;
stateFirstRun = 0;
buttonPressedAndNotUsed = 0;
if(result < 0) {
// Go back to main menu
state = MAIN_MENU;
stateFirstRun = true;
} else {
redraw = result;
}
if( old_thr != ctouchThrVal) {
touch_Thr = map(ctouchThrVal,ctouchHiLimit,ctouchLoLimit,ttouchLoLimit,ttouchHiLimit);
}
return redraw;
}
//*********************************************************** //***********************************************************
static void checkForPatchView(int buttons) { static void checkForPatchView(int buttons) {
int trills = readTrills(); int trills = readTrills();
@ -997,13 +1028,6 @@ static void statusBlink() {
digitalWrite(statusLedPin,HIGH); digitalWrite(statusLedPin,HIGH);
} }
static bool updateSensorPixelsFlag = false;
void drawSensorPixels() {
updateSensorPixelsFlag = true;
}
//*********************************************************** //***********************************************************
void menu() { void menu() {
@ -1241,25 +1265,7 @@ void menu() {
// end rotator menu // end rotator menu
} else if (state == ADJUST_MENU) { } else if (state == ADJUST_MENU) {
// This is a hack to update touch_Thr is it was changed.. adjustPageUpdate(buttonPressedAndNotUsed ? deumButtonState : 0, timeNow);
int old_thr = ctouchThrVal;
int result = updateAdjustMenu(timeNow, buttonPressedAndNotUsed ? deumButtonState : 0, stateFirstRun, updateSensorPixelsFlag);
updateSensorPixelsFlag = false;
stateFirstRun = 0;
buttonPressedAndNotUsed = 0;
if(result < 0) {
// Go back to main menu
state = MAIN_MENU;
stateFirstRun = true;
} else {
redraw = result;
}
if( old_thr != ctouchThrVal) {
touch_Thr = map(ctouchThrVal,ctouchHiLimit,ctouchLoLimit,ttouchLoLimit,ttouchHiLimit);
}
} else if (state == SETUP_BR_MENU) { // SETUP BREATH MENU HERE <<<<<<<<<<<<<< } else if (state == SETUP_BR_MENU) { // SETUP BREATH MENU HERE <<<<<<<<<<<<<<
redraw |= updatePage(breathMenuPage, timeNow); redraw |= updatePage(breathMenuPage, timeNow);
} else if (state == SETUP_CT_MENU) { // SETUP CONTROLLERS MENU HERE <<<<<<<<<<<<< } else if (state == SETUP_CT_MENU) { // SETUP CONTROLLERS MENU HERE <<<<<<<<<<<<<