Fix filebrowser for LCD

This commit is contained in:
sanni 2021-10-26 19:26:59 +02:00
parent 5a3b311feb
commit 4cc94fd846

View File

@ -1188,6 +1188,7 @@ unsigned char questionBox_LCD(const __FlashStringHelper * question, char answers
display.clearDisplay(); display.clearDisplay();
display.updateDisplay(); display.updateDisplay();
display.setCursor(0, 8); display.setCursor(0, 8);
display.setDrawColor(1);
// change the rgb led to the start menu color // change the rgb led to the start menu color
rgbLed(default_choice); rgbLed(default_choice);
@ -1208,7 +1209,6 @@ unsigned char questionBox_LCD(const __FlashStringHelper * question, char answers
choice = default_choice; choice = default_choice;
// draw selection box // draw selection box
display.setDrawColor(1);
display.drawBox(1, 8 * choice + 11, 3, 3); display.drawBox(1, 8 * choice + 11, 3, 3);
display.updateDisplay(); display.updateDisplay();
@ -1240,12 +1240,14 @@ unsigned char questionBox_LCD(const __FlashStringHelper * question, char answers
4 longHold */ 4 longHold */
int b = checkButton(); int b = checkButton();
// go one up in the menu if button is pressed twice
if (b == 2) { if (b == 2) {
idleTime = millis(); idleTime = millis();
// remove selection box // remove selection box
display.setDrawColor(0); display.setDrawColor(0);
display.drawBox(1, 8 * choice + 11, 3, 3); display.drawBox(1, 8 * choice + 11, 3, 3);
display.setDrawColor(1);
display.updateDisplay(); display.updateDisplay();
if ((choice == 0) && (filebrowse == 1)) { if ((choice == 0) && (filebrowse == 1)) {
@ -1267,7 +1269,6 @@ unsigned char questionBox_LCD(const __FlashStringHelper * question, char answers
} }
// draw selection box // draw selection box
display.setDrawColor(1);
display.drawBox(1, 8 * choice + 11, 3, 3); display.drawBox(1, 8 * choice + 11, 3, 3);
display.updateDisplay(); display.updateDisplay();
@ -1275,14 +1276,14 @@ unsigned char questionBox_LCD(const __FlashStringHelper * question, char answers
rgbLed(choice); rgbLed(choice);
} }
// go one down in the menu if the Cart Dumpers button is clicked shortly // go one down in the menu if the Cart Readers button is clicked shortly
if (b == 1) { if (b == 1) {
idleTime = millis(); idleTime = millis();
// remove selection box // remove selection box
display.setDrawColor(0); display.setDrawColor(0);
display.drawBox(1, 8 * choice + 11, 3, 3); display.drawBox(1, 8 * choice + 11, 3, 3);
display.setDrawColor(1);
display.updateDisplay(); display.updateDisplay();
if ((choice == num_answers - 1 ) && (numPages > currPage) && (filebrowse == 1)) { if ((choice == num_answers - 1 ) && (numPages > currPage) && (filebrowse == 1)) {
@ -1294,7 +1295,6 @@ unsigned char questionBox_LCD(const __FlashStringHelper * question, char answers
choice = (choice + 1) % num_answers; choice = (choice + 1) % num_answers;
// draw selection box // draw selection box
display.setDrawColor(1);
display.drawBox(1, 8 * choice + 11, 3, 3); display.drawBox(1, 8 * choice + 11, 3, 3);
display.updateDisplay(); display.updateDisplay();
@ -1710,7 +1710,6 @@ page:
count = currFile - 21; count = currFile - 21;
else { else {
display_Clear(); display_Clear();
println_Msg(F("Too many files")); println_Msg(F("Too many files"));
display_Update(); display_Update();
println_Msg(F("")); println_Msg(F(""));
@ -1775,9 +1774,9 @@ page:
strncpy(fileName, fileNames[6 + ((currPage - 1) * 7)], FILENAME_LENGTH - 1); strncpy(fileName, fileNames[6 + ((currPage - 1) * 7)], FILENAME_LENGTH - 1);
break; break;
case 7: //case 7:
// File import // File import
break; //break;
} }
// Add directory to our filepath if we just entered a new directory // Add directory to our filepath if we just entered a new directory