From 92f76b324cb9e3d912a35aa7d388c0c0e677c6f6 Mon Sep 17 00:00:00 2001 From: sanni Date: Wed, 3 Aug 2022 21:59:11 +0200 Subject: [PATCH] Fix word wrap bug on HW5 --- Cart_Reader/COLV.ino | 4 ++++ Cart_Reader/Cart_Reader.ino | 4 ++-- Cart_Reader/INTV.ino | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Cart_Reader/COLV.ino b/Cart_Reader/COLV.ino index 77ab2cd..c17e60f 100644 --- a/Cart_Reader/COLV.ino +++ b/Cart_Reader/COLV.ino @@ -386,7 +386,11 @@ void setCart_COL() { display_Clear(); // Read game name +#if defined(enable_OLED) get_line(gamename, &myFile, 42); +#else + get_line(gamename, &myFile, 96); +#endif // Read CRC32 checksum sprintf(checksumStr, "%c", myFile.read()); diff --git a/Cart_Reader/Cart_Reader.ino b/Cart_Reader/Cart_Reader.ino index 9a14166..f0ee09b 100644 --- a/Cart_Reader/Cart_Reader.ino +++ b/Cart_Reader/Cart_Reader.ino @@ -1966,14 +1966,14 @@ void println_Msg(const char myString[]) { if ((display.tx + strlen(myString) * 6) > 128) { int strPos = 0; // Print until end of display - while (display.tx < 122) { + while ((display.tx < 122) && (myString[strPos] != '\0')) { display.print(myString[strPos]); strPos++; } // Newline display.setCursor(0, display.ty + 8); // Print until end of display and ignore remaining characters - while ((strPos < strlen(myString)) && (display.tx < 122)) { + while ((strPos < strlen(myString)) && (display.tx < 122) && (myString[strPos] != '\0')) { display.print(myString[strPos]); strPos++; } diff --git a/Cart_Reader/INTV.ino b/Cart_Reader/INTV.ino index df3b4dd..81f5876 100644 --- a/Cart_Reader/INTV.ino +++ b/Cart_Reader/INTV.ino @@ -772,7 +772,11 @@ void setCart_INTV() { display_Clear(); // Read game name +#if defined(enable_OLED) get_line(gamename, &myFile, 42); +#else + get_line(gamename, &myFile, 96); +#endif // Read CRC32 checksum sprintf(checksumStr, "%c", myFile.read());