Fix display flicker on HW5 with Arc, Atari, Fairchild and Ody2 size/mapper selection

This commit is contained in:
sanni 2023-01-15 15:25:24 +01:00
parent 8114721d9d
commit 978fc80287
4 changed files with 238 additions and 54 deletions

View File

@ -192,7 +192,7 @@ void readROM_ARC() {
calcCRC(fileName, crcsize, NULL, 0); calcCRC(fileName, crcsize, NULL, 0);
println_Msg(F("")); println_Msg(F(""));
println_Msg(F("Press Button...")); print_STR(press_button_STR, 1);
display_Update(); display_Update();
wait(); wait();
} }
@ -209,26 +209,61 @@ void setROMSize_ARC() {
else { else {
int b = 0; int b = 0;
int i = arclo; int i = arclo;
while (1) {
display_Clear(); display_Clear();
print_Msg(F("ROM Size: ")); print_Msg(F("ROM Size: "));
println_Msg(ARC[i]); println_Msg(ARC[i]);
println_Msg(F("")); println_Msg(F(""));
println_Msg(F("Press to Change")); #if defined(enable_OLED)
println_Msg(F("Hold to Select")); print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(enable_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update(); display_Update();
while (1) {
b = checkButton(); b = checkButton();
if (b == 2) { // Previous (doubleclick) if (b == 2) { // Previous (doubleclick)
if (i == arclo) if (i == arclo)
i = archi; i = archi;
else else
i--; i--;
// Only update display after input because of slow LCD library
display_Clear();
print_Msg(F("ROM Size: "));
println_Msg(ARC[i]);
println_Msg(F(""));
#if defined(enable_OLED)
print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(enable_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update();
} }
if (b == 1) { // Next (press) if (b == 1) { // Next (press)
if (i == archi) if (i == archi)
i = arclo; i = arclo;
else else
i++; i++;
// Only update display after input because of slow LCD library
display_Clear();
print_Msg(F("ROM Size: "));
println_Msg(ARC[i]);
println_Msg(F(""));
#if defined(enable_OLED)
print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(enable_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update();
} }
if (b == 3) { // Long Press - Execute (hold) if (b == 3) { // Long Press - Execute (hold)
newarcsize = i; newarcsize = i;
@ -423,8 +458,13 @@ bool getCartListInfo_ARC() {
println_Msg(F("")); println_Msg(F(""));
println_Msg(arcgame); println_Msg(arcgame);
display.setCursor(0, 48); display.setCursor(0, 48);
println_Msg(F("Press to Change")); #if defined(enable_OLED)
println_Msg(F("Hold to Select")); print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(enable_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update(); display_Update();
#else #else
Serial.print(F("CART TITLE:")); Serial.print(F("CART TITLE:"));

View File

@ -456,7 +456,7 @@ void readROM_ATARI() {
calcCRC(fileName, crcsize, NULL, 0); calcCRC(fileName, crcsize, NULL, 0);
println_Msg(F("")); println_Msg(F(""));
println_Msg(F("Press Button...")); print_STR(press_button_STR, 1);
display_Update(); display_Update();
wait(); wait();
} }
@ -537,6 +537,7 @@ void setMapper_ATARI() {
#elif defined(enable_LCD) #elif defined(enable_LCD)
boolean buttonVal1 = (PING & (1 << 2)); //PG2 boolean buttonVal1 = (PING & (1 << 2)); //PG2
#endif #endif
if (buttonVal1 == LOW) { // Button Pressed if (buttonVal1 == LOW) { // Button Pressed
while (1) { // Scroll Mapper List while (1) { // Scroll Mapper List
#if defined(enable_OLED) #if defined(enable_OLED)
@ -576,7 +577,7 @@ void setMapper_ATARI() {
delay(250); delay(250);
} }
} }
while (1) {
display_Clear(); display_Clear();
print_Msg(F("Mapper: ")); print_Msg(F("Mapper: "));
atariindex = i * 2; atariindex = i * 2;
@ -594,21 +595,82 @@ void setMapper_ATARI() {
else else
println_Msg(atarimapselect, HEX); println_Msg(atarimapselect, HEX);
println_Msg(F("")); println_Msg(F(""));
println_Msg(F("Press to Change")); #if defined(enable_OLED)
println_Msg(F("Hold to Select")); print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(enable_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update(); display_Update();
while (1) {
b = checkButton(); b = checkButton();
if (b == 2) { // Previous Mapper (doubleclick) if (b == 2) { // Previous Mapper (doubleclick)
if (i == 0) if (i == 0)
i = atarimapcount - 1; i = atarimapcount - 1;
else else
i--; i--;
// Only update display after input because of slow LCD library
display_Clear();
print_Msg(F("Mapper: "));
atariindex = i * 2;
atarimapselect = pgm_read_byte(atarimapsize + atariindex);
if (atarimapselect == 0x20)
println_Msg(F("2K"));
else if (atarimapselect == 0x40)
println_Msg(F("4K"));
else if (atarimapselect == 0x0A)
println_Msg(F("UA"));
else if (atarimapselect == 0xC0)
println_Msg(F("CV"));
else if (atarimapselect == 0xD0)
println_Msg(F("DPC"));
else
println_Msg(atarimapselect, HEX);
println_Msg(F(""));
#if defined(enable_OLED)
print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(enable_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update();
} }
if (b == 1) { // Next Mapper (press) if (b == 1) { // Next Mapper (press)
if (i == (atarimapcount - 1)) if (i == (atarimapcount - 1))
i = 0; i = 0;
else else
i++; i++;
// Only update display after input because of slow LCD library
display_Clear();
print_Msg(F("Mapper: "));
atariindex = i * 2;
atarimapselect = pgm_read_byte(atarimapsize + atariindex);
if (atarimapselect == 0x20)
println_Msg(F("2K"));
else if (atarimapselect == 0x40)
println_Msg(F("4K"));
else if (atarimapselect == 0x0A)
println_Msg(F("UA"));
else if (atarimapselect == 0xC0)
println_Msg(F("CV"));
else if (atarimapselect == 0xD0)
println_Msg(F("DPC"));
else
println_Msg(atarimapselect, HEX);
println_Msg(F(""));
#if defined(enable_OLED)
print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(enable_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update();
} }
if (b == 3) { // Long Press - Execute (hold) if (b == 3) { // Long Press - Execute (hold)
newatarimapper = atarimapselect; newatarimapper = atarimapselect;
@ -788,8 +850,13 @@ bool getCartListInfo_ATARI() {
println_Msg(F("")); println_Msg(F(""));
println_Msg(atarigame); println_Msg(atarigame);
display.setCursor(0, 48); display.setCursor(0, 48);
println_Msg(F("Press to Change")); #if defined(enable_OLED)
println_Msg(F("Hold to Select")); print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(enable_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update(); display_Update();
#else #else
Serial.print(F("CART TITLE:")); Serial.print(F("CART TITLE:"));

View File

@ -467,7 +467,7 @@ void readROM_FAIRCHILD() {
calcCRC(fileName, cartsize, NULL, 0); calcCRC(fileName, cartsize, NULL, 0);
println_Msg(F("")); println_Msg(F(""));
println_Msg(F("Press Button...")); print_STR(press_button_STR, 1);
display_Update(); display_Update();
wait(); wait();
} }
@ -523,7 +523,7 @@ void read16K_FAIRCHILD() // Read 16K Bytes
calcCRC(fileName, 0x4000, NULL, 0); calcCRC(fileName, 0x4000, NULL, 0);
println_Msg(F("")); println_Msg(F(""));
println_Msg(F("Press Button...")); print_STR(press_button_STR, 1);
display_Update(); display_Update();
wait(); wait();
} }
@ -540,26 +540,58 @@ void setROMSize_FAIRCHILD() {
else { else {
int b = 0; int b = 0;
int i = fairchildlo; int i = fairchildlo;
while (1) {
display_Clear(); display_Clear();
print_Msg(F("ROM Size: ")); print_Msg(F("ROM Size: "));
println_Msg(FAIRCHILD[i]); println_Msg(FAIRCHILD[i]);
println_Msg(F("")); println_Msg(F(""));
println_Msg(F("Press to Change")); #if defined(enable_OLED)
println_Msg(F("Hold to Select")); print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(enable_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update(); display_Update();
while (1) {
b = checkButton(); b = checkButton();
if (b == 2) { // Previous (doubleclick) if (b == 2) { // Previous (doubleclick)
if (i == fairchildlo) if (i == fairchildlo)
i = fairchildhi; i = fairchildhi;
else else
i--; i--;
// Only update display after input because of slow LCD library
display_Clear();
print_Msg(F("ROM Size: "));
println_Msg(FAIRCHILD[i]);
println_Msg(F(""));
#if defined(enable_OLED)
print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(enable_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update();
} }
if (b == 1) { // Next (press) if (b == 1) { // Next (press)
if (i == fairchildhi) if (i == fairchildhi)
i = fairchildlo; i = fairchildlo;
else else
i++; i++;
// Only update display after input because of slow LCD library
display_Clear();
print_Msg(F("ROM Size: "));
println_Msg(FAIRCHILD[i]);
println_Msg(F(""));
#if defined(enable_OLED)
print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(enable_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update();
} }
if (b == 3) { // Long Press - Execute (hold) if (b == 3) { // Long Press - Execute (hold)
newfairchildsize = i; newfairchildsize = i;
@ -754,8 +786,13 @@ bool getCartListInfo_FAIRCHILD() {
println_Msg(F("")); println_Msg(F(""));
println_Msg(fairchildgame); println_Msg(fairchildgame);
display.setCursor(0, 48); display.setCursor(0, 48);
println_Msg(F("Press to Change")); #if defined(enable_OLED)
println_Msg(F("Hold to Select")); print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(enable_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update(); display_Update();
#else #else
Serial.print(F("CART TITLE:")); Serial.print(F("CART TITLE:"));

View File

@ -272,7 +272,7 @@ void readROM_ODY2() {
calcCRC(fileName, crcsize, NULL, 0); calcCRC(fileName, crcsize, NULL, 0);
println_Msg(F("")); println_Msg(F(""));
println_Msg(F("Press Button...")); print_STR(press_button_STR, 1);
display_Update(); display_Update();
wait(); wait();
} }
@ -289,26 +289,61 @@ void setROMSize_ODY2() {
else { else {
int b = 0; int b = 0;
int i = ody2lo; int i = ody2lo;
while (1) {
display_Clear(); display_Clear();
print_Msg(F("ROM Size: ")); print_Msg(F("ROM Size: "));
println_Msg(ODY2[i]); println_Msg(ODY2[i]);
println_Msg(F("")); println_Msg(F(""));
println_Msg(F("Press to Change")); #if defined(enable_OLED)
println_Msg(F("Hold to Select")); print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(enable_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update(); display_Update();
while (1) {
b = checkButton(); b = checkButton();
if (b == 2) { // Previous (doubleclick) if (b == 2) { // Previous (doubleclick)
if (i == ody2lo) if (i == ody2lo)
i = ody2hi; i = ody2hi;
else else
i--; i--;
// Only update display after input because of slow LCD library
display_Clear();
print_Msg(F("ROM Size: "));
println_Msg(ODY2[i]);
println_Msg(F(""));
#if defined(enable_OLED)
print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(enable_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update();
} }
if (b == 1) { // Next (press) if (b == 1) { // Next (press)
if (i == ody2hi) if (i == ody2hi)
i = ody2lo; i = ody2lo;
else else
i++; i++;
// Only update display after input because of slow LCD library
display_Clear();
print_Msg(F("ROM Size: "));
println_Msg(ODY2[i]);
println_Msg(F(""));
#if defined(enable_OLED)
print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(enable_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update();
} }
if (b == 3) { // Long Press - Execute (hold) if (b == 3) { // Long Press - Execute (hold)
newody2size = i; newody2size = i;
@ -515,8 +550,13 @@ bool getCartListInfo_ODY2() {
println_Msg(F("")); println_Msg(F(""));
println_Msg(ody2game); println_Msg(ody2game);
display.setCursor(0, 48); display.setCursor(0, 48);
println_Msg(F("Press to Change")); #if defined(enable_OLED)
println_Msg(F("Hold to Select")); print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1);
#elif defined(enable_LCD)
print_STR(rotate_to_change_STR, 1);
print_STR(press_to_select_STR, 1);
#endif
display_Update(); display_Update();
#else #else
Serial.print(F("CART TITLE:")); Serial.print(F("CART TITLE:"));