Fix menu navigation bug

This commit is contained in:
sanni 2022-10-13 10:31:17 +02:00
parent 4badfff458
commit 3bf6004e79

View File

@ -2416,14 +2416,14 @@ unsigned char questionBox_Display(const __FlashStringHelper* question, char answ
rgbLed(currentColor); rgbLed(currentColor);
} }
/* Check Button /* Check Button/rotary encoder
1 click 1 click/clockwise rotation
2 doubleClick 2 doubleClick/counter clockwise rotation
3 hold 3 hold/press
4 longHold */ 4 longHold */
int b = checkButton(); int b = checkButton();
// go one up in the menu if button is pressed twice // if button is pressed twice or rotary encoder turned left/counter clockwise
if (b == 2) { if (b == 2) {
idleTime = millis(); idleTime = millis();
@ -2433,20 +2433,28 @@ unsigned char questionBox_Display(const __FlashStringHelper* question, char answ
display.setDrawColor(1); display.setDrawColor(1);
display.updateDisplay(); display.updateDisplay();
// If cursor on top list entry
if (choice == 0) { if (choice == 0) {
// On 2nd, 3rd, ... page go back one page
if (currPage > 1) { if (currPage > 1) {
lastPage = currPage; lastPage = currPage;
currPage--; currPage--;
break; break;
} else if (filebrowse == 1) { }
// In file browser go to root dir
else if ((filebrowse == 1) && (root != 1)) {
root = 1; root = 1;
break; break;
} }
} else if (choice > 0) { // Else go to bottom of list as a shortcut
choice--; else {
} else {
choice = num_answers - 1; choice = num_answers - 1;
} }
}
// If not top entry go up/back one entry
else {
choice--;
}
// draw selection box // draw selection box
display.drawBox(1, 8 * choice + 11, 3, 3); display.drawBox(1, 8 * choice + 11, 3, 3);