From 978fc80287975ac10bf4901aba91284499348b55 Mon Sep 17 00:00:00 2001 From: sanni Date: Sun, 15 Jan 2023 15:25:24 +0100 Subject: [PATCH] Fix display flicker on HW5 with Arc, Atari, Fairchild and Ody2 size/mapper selection --- Cart_Reader/ARC.ino | 60 ++++++++++++++++---- Cart_Reader/ATARI.ino | 113 ++++++++++++++++++++++++++++++-------- Cart_Reader/FAIRCHILD.ino | 59 ++++++++++++++++---- Cart_Reader/ODY2.ino | 60 ++++++++++++++++---- 4 files changed, 238 insertions(+), 54 deletions(-) diff --git a/Cart_Reader/ARC.ino b/Cart_Reader/ARC.ino index 8efc01b..946cb12 100644 --- a/Cart_Reader/ARC.ino +++ b/Cart_Reader/ARC.ino @@ -192,7 +192,7 @@ void readROM_ARC() { calcCRC(fileName, crcsize, NULL, 0); println_Msg(F("")); - println_Msg(F("Press Button...")); + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -209,26 +209,61 @@ void setROMSize_ARC() { else { int b = 0; int i = arclo; + + 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(); + while (1) { - display_Clear(); - print_Msg(F("ROM Size: ")); - println_Msg(ARC[i]); - println_Msg(F("")); - println_Msg(F("Press to Change")); - println_Msg(F("Hold to Select")); - display_Update(); b = checkButton(); if (b == 2) { // Previous (doubleclick) if (i == arclo) i = archi; else 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 (i == archi) i = arclo; else 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) newarcsize = i; @@ -423,8 +458,13 @@ bool getCartListInfo_ARC() { println_Msg(F("")); println_Msg(arcgame); display.setCursor(0, 48); - println_Msg(F("Press to Change")); - println_Msg(F("Hold to Select")); +#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(); #else Serial.print(F("CART TITLE:")); diff --git a/Cart_Reader/ATARI.ino b/Cart_Reader/ATARI.ino index 1b92ca2..99974db 100644 --- a/Cart_Reader/ATARI.ino +++ b/Cart_Reader/ATARI.ino @@ -456,7 +456,7 @@ void readROM_ATARI() { calcCRC(fileName, crcsize, NULL, 0); println_Msg(F("")); - println_Msg(F("Press Button...")); + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -537,6 +537,7 @@ void setMapper_ATARI() { #elif defined(enable_LCD) boolean buttonVal1 = (PING & (1 << 2)); //PG2 #endif + if (buttonVal1 == LOW) { // Button Pressed while (1) { // Scroll Mapper List #if defined(enable_OLED) @@ -576,39 +577,100 @@ void setMapper_ATARI() { delay(250); } } + + 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(); + while (1) { - 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("")); - println_Msg(F("Press to Change")); - println_Msg(F("Hold to Select")); - display_Update(); b = checkButton(); if (b == 2) { // Previous Mapper (doubleclick) if (i == 0) i = atarimapcount - 1; else 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 (i == (atarimapcount - 1)) i = 0; else 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) newatarimapper = atarimapselect; @@ -788,8 +850,13 @@ bool getCartListInfo_ATARI() { println_Msg(F("")); println_Msg(atarigame); display.setCursor(0, 48); - println_Msg(F("Press to Change")); - println_Msg(F("Hold to Select")); +#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(); #else Serial.print(F("CART TITLE:")); diff --git a/Cart_Reader/FAIRCHILD.ino b/Cart_Reader/FAIRCHILD.ino index e1ece11..ae6379b 100644 --- a/Cart_Reader/FAIRCHILD.ino +++ b/Cart_Reader/FAIRCHILD.ino @@ -467,7 +467,7 @@ void readROM_FAIRCHILD() { calcCRC(fileName, cartsize, NULL, 0); println_Msg(F("")); - println_Msg(F("Press Button...")); + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -523,7 +523,7 @@ void read16K_FAIRCHILD() // Read 16K Bytes calcCRC(fileName, 0x4000, NULL, 0); println_Msg(F("")); - println_Msg(F("Press Button...")); + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -540,26 +540,58 @@ void setROMSize_FAIRCHILD() { else { int b = 0; int i = fairchildlo; + 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(); while (1) { - display_Clear(); - print_Msg(F("ROM Size: ")); - println_Msg(FAIRCHILD[i]); - println_Msg(F("")); - println_Msg(F("Press to Change")); - println_Msg(F("Hold to Select")); - display_Update(); b = checkButton(); if (b == 2) { // Previous (doubleclick) if (i == fairchildlo) i = fairchildhi; else 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 (i == fairchildhi) i = fairchildlo; else 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) newfairchildsize = i; @@ -754,8 +786,13 @@ bool getCartListInfo_FAIRCHILD() { println_Msg(F("")); println_Msg(fairchildgame); display.setCursor(0, 48); - println_Msg(F("Press to Change")); - println_Msg(F("Hold to Select")); +#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(); #else Serial.print(F("CART TITLE:")); diff --git a/Cart_Reader/ODY2.ino b/Cart_Reader/ODY2.ino index 4b83b06..95b6191 100644 --- a/Cart_Reader/ODY2.ino +++ b/Cart_Reader/ODY2.ino @@ -272,7 +272,7 @@ void readROM_ODY2() { calcCRC(fileName, crcsize, NULL, 0); println_Msg(F("")); - println_Msg(F("Press Button...")); + print_STR(press_button_STR, 1); display_Update(); wait(); } @@ -289,26 +289,61 @@ void setROMSize_ODY2() { else { int b = 0; int i = ody2lo; + + 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(); + while (1) { - display_Clear(); - print_Msg(F("ROM Size: ")); - println_Msg(ODY2[i]); - println_Msg(F("")); - println_Msg(F("Press to Change")); - println_Msg(F("Hold to Select")); - display_Update(); b = checkButton(); if (b == 2) { // Previous (doubleclick) if (i == ody2lo) i = ody2hi; else 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 (i == ody2hi) i = ody2lo; else 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) newody2size = i; @@ -515,8 +550,13 @@ bool getCartListInfo_ODY2() { println_Msg(F("")); println_Msg(ody2game); display.setCursor(0, 48); - println_Msg(F("Press to Change")); - println_Msg(F("Hold to Select")); +#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(); #else Serial.print(F("CART TITLE:"));