Fix bugged map select screen on HW3 with new display lib

This commit is contained in:
sanni 2022-10-08 18:19:31 +02:00
parent bdee198286
commit 2c009230cd
2 changed files with 69 additions and 48 deletions

View File

@ -757,9 +757,11 @@ byte starting_letter() {
} }
else if (b == 3) { // Long Press - Execute else if (b == 3) { // Long Press - Execute
display_Clear(); if ((selection + line * 7) != 27) {
println_Msg(F("Please wait...")); display_Clear();
display_Update(); println_Msg(F("Please wait..."));
display_Update();
}
break; break;
} }
} }
@ -1383,7 +1385,7 @@ void clkcal() {
display.setCursor(0, 0); display.setCursor(0, 0);
display.print("Read correction: "); display.print("Read correction: ");
display.println(cal_factor); display.println(cal_factor);
display.display(); display.updateDisplay();
delay(500); delay(500);
if (cal_factor > INT32_MIN) { if (cal_factor > INT32_MIN) {
@ -1961,6 +1963,12 @@ void save_log() {
} }
#endif #endif
#ifdef global_log
void println_Log(const __FlashStringHelper * string) {
myLog.println(string);
}
#endif
void print_Msg(const __FlashStringHelper * string) { void print_Msg(const __FlashStringHelper * string) {
#if (defined(enable_LCD) || defined(enable_OLED)) #if (defined(enable_LCD) || defined(enable_OLED))
display.print(string); display.print(string);

View File

@ -666,6 +666,7 @@ boolean getMapping() {
#ifdef global_log #ifdef global_log
// Disable log to prevent unnecessary logging // Disable log to prevent unnecessary logging
println_Log(F("Get Mapping from List"));
dont_log = true; dont_log = true;
#endif #endif
println_Msg(gamename); println_Msg(gamename);
@ -829,7 +830,6 @@ void selectMapping() {
setPRGSize(); setPRGSize();
setCHRSize(); setCHRSize();
setRAMSize(); setRAMSize();
checkStatus_NES();
} }
else { else {
// Open database // Open database
@ -837,6 +837,7 @@ void selectMapping() {
#ifdef global_log #ifdef global_log
// Disable log to prevent unnecessary logging // Disable log to prevent unnecessary logging
println_Log(F("Select Mapping from List"));
dont_log = true; dont_log = true;
#endif #endif
@ -2038,6 +2039,7 @@ unsigned char* getNES20HeaderBytesFromDatabaseRow(const char* crctest) {
void setMapper() { void setMapper() {
#ifdef global_log #ifdef global_log
// Disable log to prevent unnecessary logging // Disable log to prevent unnecessary logging
println_Log(F("Set Mapper manually"));
dont_log = true; dont_log = true;
#endif #endif
@ -2046,51 +2048,57 @@ void setMapper() {
chooseMapper: chooseMapper:
// Read stored mapper // Read stored mapper
EEPROM_readAnything(7, newmapper); EEPROM_readAnything(7, newmapper);
if (newmapper > 220) if ((newmapper > 220) || (newmapper < 0))
newmapper = 0; newmapper = 0;
// Split into digits // Split into digits
byte hundreds = newmapper / 100; byte hundreds = newmapper / 100;
byte tens = newmapper / 10 - hundreds * 10; byte tens = newmapper / 10 - hundreds * 10;
byte units = newmapper - hundreds * 100 - tens * 10; byte units = newmapper - hundreds * 100 - tens * 10;
// Cycle through al 3 digits // Cycle through all 3 digits
for (byte digit = 0; digit < 3; digit++) { byte digit = 0;
while (digit < 3) {
display_Clear();
println_Msg(F("Select Mapper:"));
display.setCursor(23, 20);
println_Msg(hundreds);
display.setCursor(43, 20);
println_Msg(tens);
display.setCursor(63, 20);
println_Msg(units);
println_Msg("");
println_Msg("");
println_Msg("");
println_Msg(F("Press left to change"));
println_Msg(F("Press right to select"));
if (digit == 0) {
display.setDrawColor(1);
display.drawLine(20, 30, 30, 30);
display.setDrawColor(0);
display.drawLine(40, 30, 50, 30);
display.drawLine(60, 30, 70, 30);
display.setDrawColor(1);
}
else if (digit == 1) {
display.setDrawColor(0);
display.drawLine(20, 30, 30, 30);
display.setDrawColor(1);
display.drawLine(40, 30, 50, 30);
display.setDrawColor(0);
display.drawLine(60, 30, 70, 30);
display.setDrawColor(1);
}
else if (digit == 2) {
display.setDrawColor(0);
display.drawLine(20, 30, 30, 30);
display.drawLine(40, 30, 50, 30);
display.setDrawColor(1);
display.drawLine(60, 30, 70, 30);
}
display.updateDisplay();
while (1) { while (1) {
display_Clear();
println_Msg(F("Select Mapper:"));
display.setCursor(23, 20);
println_Msg(hundreds);
display.setCursor(43, 20);
println_Msg(tens);
display.setCursor(63, 20);
println_Msg(units);
println_Msg("");
println_Msg(F("Press left to change"));
println_Msg(F("Press right to select"));
if (digit == 0) {
display.setDrawColor(1);
display.drawLine(20, 30, 30, 30);
display.setDrawColor(0);
display.drawLine(40, 30, 50, 30);
display.drawLine(60, 30, 70, 30);
}
else if (digit == 1) {
display.setDrawColor(0);
display.drawLine(20, 30, 30, 30);
display.setDrawColor(1);
display.drawLine(40, 30, 50, 30);
display.setDrawColor(0);
display.drawLine(60, 30, 70, 30);
}
else if (digit == 2) {
display.setDrawColor(0);
display.drawLine(20, 30, 30, 30);
display.drawLine(40, 30, 50, 30);
display.setDrawColor(1);
display.drawLine(60, 30, 70, 30);
}
/* Check Button /* Check Button
1 click 1 click
2 doubleClick 2 doubleClick
@ -2125,6 +2133,7 @@ chooseMapper:
else else
units = 0; units = 0;
} }
break;
} }
else if (b == 2) { else if (b == 2) {
if (digit == 0) { if (digit == 0) {
@ -2153,12 +2162,12 @@ chooseMapper:
else else
units = 9; units = 9;
} }
}
else if (b == 3) {
break; break;
} }
else if (b == 3) {
display.display(); digit++;
break;
}
} }
} }
display_Clear(); display_Clear();
@ -2176,7 +2185,7 @@ chooseMapper:
if (!validMapper) { if (!validMapper) {
errorLvl = 1; errorLvl = 1;
display.println(F("Mapper not supported")); display.println(F("Mapper not supported"));
display.display(); display.updateDisplay();
wait(); wait();
goto chooseMapper; goto chooseMapper;
} }
@ -2281,6 +2290,7 @@ setmapper:
goto setmapper; goto setmapper;
} }
#endif #endif
EEPROM_writeAnything(7, newmapper); EEPROM_writeAnything(7, newmapper);
mapper = newmapper; mapper = newmapper;
@ -2309,6 +2319,7 @@ void checkMapperSize() {
void setPRGSize() { void setPRGSize() {
#ifdef global_log #ifdef global_log
// Disable log to prevent unnecessary logging // Disable log to prevent unnecessary logging
println_Log(F("Set PRG Size"));
dont_log = true; dont_log = true;
#endif #endif
@ -2428,6 +2439,7 @@ setprg:
void setCHRSize() { void setCHRSize() {
#ifdef global_log #ifdef global_log
// Disable log to prevent unnecessary logging // Disable log to prevent unnecessary logging
println_Log(F("Set CHR Size"));
dont_log = true; dont_log = true;
#endif #endif
@ -2548,6 +2560,7 @@ setchr:
void setRAMSize() { void setRAMSize() {
#ifdef global_log #ifdef global_log
// Disable log to prevent unnecessary logging // Disable log to prevent unnecessary logging
println_Log(F("Set RAM Size"));
dont_log = true; dont_log = true;
#endif #endif