diff options
author | sanni <[email protected]> | 2022-10-08 16:23:33 +0200 |
---|---|---|
committer | sanni <[email protected]> | 2022-10-08 16:23:33 +0200 |
commit | 0ab7a18b052def17ae8d8118bbe17894eeef4021 (patch) | |
tree | 8e1b6beeb1d16252960d41100c14afd2c9f867bc /Cart_Reader | |
parent | 18b37c72d8f6d4c6c29b11a29c9f9c444319f8a7 (diff) | |
download | cartreader-0ab7a18b052def17ae8d8118bbe17894eeef4021.tar.gz cartreader-0ab7a18b052def17ae8d8118bbe17894eeef4021.zip |
V10.1 Move HW1/2/3 to same display lib as HW4/5
... bugs are to be expected :D
Diffstat (limited to 'Cart_Reader')
-rw-r--r-- | Cart_Reader/COLV.ino | 4 | ||||
-rw-r--r-- | Cart_Reader/Cart_Reader.ino | 786 | ||||
-rw-r--r-- | Cart_Reader/GBA.ino | 4 | ||||
-rw-r--r-- | Cart_Reader/INTV.ino | 4 | ||||
-rw-r--r-- | Cart_Reader/N64.ino | 532 | ||||
-rw-r--r-- | Cart_Reader/NES.ino | 46 | ||||
-rw-r--r-- | Cart_Reader/WSV.ino | 4 |
7 files changed, 305 insertions, 1075 deletions
diff --git a/Cart_Reader/COLV.ino b/Cart_Reader/COLV.ino index 88caef3..87d070a 100644 --- a/Cart_Reader/COLV.ino +++ b/Cart_Reader/COLV.ino @@ -423,11 +423,7 @@ 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 debf1f3..38681ba 100644 --- a/Cart_Reader/Cart_Reader.ino +++ b/Cart_Reader/Cart_Reader.ino @@ -4,13 +4,10 @@ This project represents a community-driven effort to provide
an easy to build and easy to modify cartridge dumper.
- Date: 07.10.2022
- Version: 10.0
+ Date: 08.10.2022
+ Version: 10.1
SD lib: https://github.com/greiman/SdFat
- OLED lib: https://github.com/adafruit/Adafruit_SSD1306
- GFX Lib: https://github.com/adafruit/Adafruit-GFX-Library
- BusIO: https://github.com/adafruit/Adafruit_BusIO
LCD lib: https://github.com/olikraus/u8g2
Neopixel lib: https://github.com/adafruit/Adafruit_NeoPixel
Rotary Enc lib: https://github.com/mathertel/RotaryEncoder
@@ -59,7 +56,7 @@ **********************************************************************************/
-char ver[5] = "10.0";
+char ver[5] = "10.1";
//******************************************
// !!! CHOOSE HARDWARE VERSION !!!
@@ -246,13 +243,8 @@ typedef enum COLOR_T { // Graphic I2C OLED
#ifdef enable_OLED
-#include <Adafruit_GFX.h>
-#include <Adafruit_SSD1306.h>
-#define SCREEN_WIDTH 128 // OLED display width, in pixels
-#define SCREEN_HEIGHT 64 // OLED display height, in pixels
-// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
-#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
-Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
+#include <U8g2lib.h>
+U8G2_SSD1306_128X64_NONAME_F_HW_I2C display(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
#endif
// Adafruit Clock Generator
@@ -703,7 +695,7 @@ byte starting_letter() { byte line = 0;
display_Clear();
-#if defined(enable_LCD)
+
println_Msg(F("[#] [A] [B] [C] [D] [E] [F]"));
println_Msg(F(""));
println_Msg(F("[G] [H] [ I ] [J] [K] [L] [M]"));
@@ -711,23 +703,10 @@ byte starting_letter() { println_Msg(F("[N] [O] [P] [Q] [R] [S] [T]"));
println_Msg(F(""));
println_Msg(F("[U] [V] [W] [X] [Y] [Z] [?]"));
-#elif defined(enable_OLED)
- println_Msg(F("# A B C D E F"));
- println_Msg(F(""));
- println_Msg(F("G H I J K L M"));
- println_Msg(F(""));
- println_Msg(F("N O P Q R S T"));
- println_Msg(F(""));
- println_Msg(F("U V W X Y Z ?"));
-#endif
// Draw selection line
-#if defined(enable_LCD)
display.setDrawColor(1);
display.drawLine(4 + selection * 16, 10 + line * 16, 9 + selection * 16, 10 + line * 16);
-#elif defined(enable_OLED)
- display.drawLine(selection * 18, 10 + line * 16, 5 + selection * 18, 10 + line * 16, WHITE);
-#endif
display_Update();
while (1) {
@@ -744,7 +723,6 @@ byte starting_letter() { else if (selection > 0) {
selection--;
}
-#if defined(enable_LCD)
display.setDrawColor(0);
display.drawLine(0, 10 + 0 * 16, 128, 10 + 0 * 16);
display.drawLine(0, 10 + 1 * 16, 128, 10 + 1 * 16);
@@ -752,13 +730,6 @@ byte starting_letter() { display.drawLine(0, 10 + 3 * 16, 128, 10 + 3 * 16);
display.setDrawColor(1);
display.drawLine(4 + selection * 16, 10 + line * 16, 9 + selection * 16, 10 + line * 16);
-#elif defined(enable_OLED)
- display.drawLine(0, 10 + 0 * 16, 128, 10 + 0 * 16, BLACK);
- display.drawLine(0, 10 + 1 * 16, 128, 10 + 1 * 16, BLACK);
- display.drawLine(0, 10 + 2 * 16, 128, 10 + 2 * 16, BLACK);
- display.drawLine(0, 10 + 3 * 16, 128, 10 + 3 * 16, BLACK);
- display.drawLine(selection * 18, 10 + line * 16, 5 + selection * 18, 10 + line * 16, WHITE);
-#endif
display_Update();
}
@@ -775,7 +746,6 @@ byte starting_letter() { else if (selection < 6) {
selection++;
}
-#if defined(enable_LCD)
display.setDrawColor(0);
display.drawLine(0, 10 + 0 * 16, 128, 10 + 0 * 16);
display.drawLine(0, 10 + 1 * 16, 128, 10 + 1 * 16);
@@ -783,13 +753,6 @@ byte starting_letter() { display.drawLine(0, 10 + 3 * 16, 128, 10 + 3 * 16);
display.setDrawColor(1);
display.drawLine(4 + selection * 16, 10 + line * 16, 9 + selection * 16, 10 + line * 16);
-#elif defined(enable_OLED)
- display.drawLine(0, 10 + 0 * 16, 128, 10 + 0 * 16, BLACK);
- display.drawLine(0, 10 + 1 * 16, 128, 10 + 1 * 16, BLACK);
- display.drawLine(0, 10 + 2 * 16, 128, 10 + 2 * 16, BLACK);
- display.drawLine(0, 10 + 3 * 16, 128, 10 + 3 * 16, BLACK);
- display.drawLine(selection * 18, 10 + line * 16, 5 + selection * 18, 10 + line * 16, WHITE);
-#endif
display_Update();
}
@@ -1764,14 +1727,9 @@ void setup() { #endif
#ifdef enable_OLED
- // GLCD
- display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
- display.setTextSize(1);
- display.setTextColor(WHITE);
- // Clear the screen buffer.
- display.clearDisplay();
- display.setCursor(0, 0);
- display.display();
+ display.begin();
+ //isplay.setContrast(40);
+ display.setFont(u8g2_font_haxrcorp4089_tr);
#endif
#ifdef enable_serial
@@ -2004,10 +1962,7 @@ void save_log() { #endif
void print_Msg(const __FlashStringHelper * string) {
-#ifdef enable_LCD
- display.print(string);
-#endif
-#ifdef enable_OLED
+#if (defined(enable_LCD) || defined(enable_OLED))
display.print(string);
#endif
#ifdef enable_serial
@@ -2019,7 +1974,7 @@ void print_Msg(const __FlashStringHelper * string) { }
void print_Msg(const char myString[]) {
-#ifdef enable_LCD
+#if (defined(enable_LCD) || defined(enable_OLED))
// test for word wrap
if ((display.tx + strlen(myString) * 6) > 128) {
int strPos = 0;
@@ -2040,9 +1995,6 @@ void print_Msg(const char myString[]) { display.print(myString);
}
#endif
-#ifdef enable_OLED
- display.print(myString);
-#endif
#ifdef enable_serial
Serial.print(myString);
#endif
@@ -2052,10 +2004,7 @@ void print_Msg(const char myString[]) { }
void print_Msg(long unsigned int message) {
-#ifdef enable_LCD
- display.print(message);
-#endif
-#ifdef enable_OLED
+#if (defined(enable_LCD) || defined(enable_OLED))
display.print(message);
#endif
#ifdef enable_serial
@@ -2067,10 +2016,7 @@ void print_Msg(long unsigned int message) { }
void print_Msg(byte message, int outputFormat) {
-#ifdef enable_LCD
- display.print(message, outputFormat);
-#endif
-#ifdef enable_OLED
+#if (defined(enable_LCD) || defined(enable_OLED))
display.print(message, outputFormat);
#endif
#ifdef enable_serial
@@ -2082,10 +2028,7 @@ void print_Msg(byte message, int outputFormat) { }
void print_Msg(word message, int outputFormat) {
-#ifdef enable_LCD
- display.print(message, outputFormat);
-#endif
-#ifdef enable_OLED
+#if (defined(enable_LCD) || defined(enable_OLED))
display.print(message, outputFormat);
#endif
#ifdef enable_serial
@@ -2097,10 +2040,7 @@ void print_Msg(word message, int outputFormat) { }
void print_Msg(int message, int outputFormat) {
-#ifdef enable_LCD
- display.print(message, outputFormat);
-#endif
-#ifdef enable_OLED
+#if (defined(enable_LCD) || defined(enable_OLED))
display.print(message, outputFormat);
#endif
#ifdef enable_serial
@@ -2112,10 +2052,7 @@ void print_Msg(int message, int outputFormat) { }
void print_Msg(long unsigned int message, int outputFormat) {
-#ifdef enable_LCD
- display.print(message, outputFormat);
-#endif
-#ifdef enable_OLED
+#if (defined(enable_LCD) || defined(enable_OLED))
display.print(message, outputFormat);
#endif
#ifdef enable_serial
@@ -2127,10 +2064,7 @@ void print_Msg(long unsigned int message, int outputFormat) { }
void print_Msg(String string) {
-#ifdef enable_LCD
- display.print(string);
-#endif
-#ifdef enable_OLED
+#if (defined(enable_LCD) || defined(enable_OLED))
display.print(string);
#endif
#ifdef enable_serial
@@ -2158,13 +2092,10 @@ void print_Msg_PaddedHex32(unsigned long message) { print_Msg_PaddedHexByte((message >> 0) & 0xFF);
}
void println_Msg(String string) {
-#ifdef enable_LCD
+#if (defined(enable_LCD) || defined(enable_OLED))
display.print(string);
display.setCursor(0, display.ty + 8);
#endif
-#ifdef enable_OLED
- display.println(string);
-#endif
#ifdef enable_serial
Serial.println(string);
#endif
@@ -2174,13 +2105,10 @@ void println_Msg(String string) { }
void println_Msg(byte message, int outputFormat) {
-#ifdef enable_LCD
+#if (defined(enable_LCD) || defined(enable_OLED))
display.print(message, outputFormat);
display.setCursor(0, display.ty + 8);
#endif
-#ifdef enable_OLED
- display.println(message, outputFormat);
-#endif
#ifdef enable_serial
Serial.println(message, outputFormat);
#endif
@@ -2190,7 +2118,7 @@ void println_Msg(byte message, int outputFormat) { }
void println_Msg(const char myString[]) {
-#ifdef enable_LCD
+#if (defined(enable_LCD) || defined(enable_OLED))
// test for word wrap
if ((display.tx + strlen(myString) * 6) > 128) {
int strPos = 0;
@@ -2212,9 +2140,6 @@ void println_Msg(const char myString[]) { }
display.setCursor(0, display.ty + 8);
#endif
-#ifdef enable_OLED
- display.println(myString);
-#endif
#ifdef enable_serial
Serial.println(myString);
#endif
@@ -2224,13 +2149,10 @@ void println_Msg(const char myString[]) { }
void println_Msg(const __FlashStringHelper * string) {
-#ifdef enable_LCD
+#if (defined(enable_LCD) || defined(enable_OLED))
display.print(string);
display.setCursor(0, display.ty + 8);
#endif
-#ifdef enable_OLED
- display.println(string);
-#endif
#ifdef enable_serial
Serial.println(string);
#endif
@@ -2244,13 +2166,10 @@ void println_Msg(const __FlashStringHelper * string) { }
void println_Msg(long unsigned int message) {
-#ifdef enable_LCD
+#if (defined(enable_LCD) || defined(enable_OLED))
display.print(message);
display.setCursor(0, display.ty + 8);
#endif
-#ifdef enable_OLED
- display.println(message);
-#endif
#ifdef enable_serial
Serial.println(message);
#endif
@@ -2260,12 +2179,9 @@ void println_Msg(long unsigned int message) { }
void display_Update() {
-#ifdef enable_LCD
+#if (defined(enable_LCD) || defined(enable_OLED))
display.updateDisplay();
#endif
-#ifdef enable_OLED
- display.display();
-#endif
#ifdef enable_serial
delay(100);
#endif
@@ -2275,184 +2191,15 @@ void display_Update() { }
void display_Clear() {
-#ifdef enable_LCD
+#if (defined(enable_LCD) || defined(enable_OLED))
display.clearDisplay();
display.setCursor(0, 8);
#endif
-#ifdef enable_OLED
- display.clearDisplay();
- display.setCursor(0, 0);
-#endif
#ifdef global_log
if (!dont_log)myLog.println("");
#endif
}
-unsigned char question_box(const __FlashStringHelper * question, char answers[7][20], int num_answers, int default_choice) {
-#ifdef enable_LCD
- return questionBox_LCD(question, answers, num_answers, default_choice);
-#endif
-#ifdef enable_OLED
- return questionBox_OLED(question, answers, num_answers, default_choice);
-#endif
-#ifdef enable_serial
- return questionBox_Serial(question, answers, num_answers, default_choice);
-#endif
-}
-
-/******************************************
- Serial Out
-*****************************************/
-#ifdef enable_serial
-int checkButton() {
- while (Serial.available() == 0) {
- }
- incomingByte = Serial.read() - 48;
-
- //Next
- if (incomingByte == 52) {
- return 1;
- }
-
- //Previous
- else if (incomingByte == 69) {
- return 2;
- }
-
- //Selection
- else if (incomingByte == 240) {
- return 3;
- }
-}
-
-void wait_serial() {
- if (errorLvl) {
- // Debug
-#ifdef debug_mode
- ignoreError = 1;
-#endif
- errorLvl = 0;
- }
- while (Serial.available() == 0) {
- }
- incomingByte = Serial.read() - 48;
- /* if ((incomingByte == 53) && (fileName[0] != '\0')) {
- // Open file on sd card
- sd.chdir(folder);
- if (myFile.open(fileName, O_READ)) {
- // Get rom size from file
- fileSize = myFile.fileSize();
-
- // Send filesize
- char tempStr[16];
- sprintf(tempStr, "%d", fileSize);
- Serial.write(tempStr);
-
- // Wait for ok
- while (Serial.available() == 0) {
- }
-
- // Send file
- for (unsigned long currByte = 0; currByte < fileSize; currByte++) {
- // Blink led
- if (currByte % 1024 == 0)
- blinkLED();
- Serial.write(myFile.read());
- }
- // Close the file:
- myFile.close();
- }
- else {
- print_Error(F("Can't open file"), true);
- }
- }*/
-}
-
-byte questionBox_Serial(const __FlashStringHelper * question, char answers[7][20], int num_answers, int default_choice) {
- // Print menu to serial monitor
- //Serial.println(question);
- Serial.println("");
- for (byte i = 0; i < num_answers; i++) {
- Serial.print(i);
- Serial.print(F(")"));
- Serial.println(answers[i]);
- }
- // Wait for user input
- Serial.println("");
- Serial.println(F("Please browse pages with 'u'(up) and 'd'(down)"));
- Serial.println(F("and enter a selection by typing a number(0-6): _ "));
- Serial.println("");
- while (Serial.available() == 0) {
- }
-
- // Read the incoming byte:
- incomingByte = Serial.read() - 48;
-
- /* Import file (i)
- if (incomingByte == 57) {
- if (filebrowse == 1) {
- // Make sure we have an import directory
- sd.mkdir("IMPORT", true);
-
- // Create and open file on sd card
- EEPROM_readAnything(0, foldern);
- sprintf(fileName, "IMPORT/%d.bin", foldern);
- if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
- print_Error(F("Can't create file on SD"), true);
- }
-
- // Read file from serial
- fileSize = 0;
- while (Serial.available() > 0) {
- myFile.write(Serial.read());
- fileSize++;
- // Blink led
- blinkLED();
- }
-
- // Close the file:
- myFile.close();
-
- // Write new folder number back to eeprom
- foldern = foldern + 1;
- EEPROM_writeAnything(0, foldern);
-
- print_Msg(F("Imported "));
- print_Msg(fileSize);
- print_Msg(F(" bytes to file "));
- println_Msg(fileName);
- return 7;
- }
- }*/
-
- // Page up (u)
- if (incomingByte == 69) {
- if (filebrowse == 1) {
- if (currPage > 1) {
- lastPage = currPage;
- currPage--;
- }
- else {
- root = 1;
- }
- }
- }
-
- // Page down (d)
- else if (incomingByte == 52) {
- if ((numPages > currPage) && (filebrowse == 1)) {
- lastPage = currPage;
- currPage++;
- }
- }
-
- // Print the received byte for validation e.g. in case of a different keyboard mapping
- //Serial.println(incomingByte);
- //Serial.println("");
- return incomingByte;
-}
-#endif
-
/******************************************
RGB LED
*****************************************/
@@ -2528,146 +2275,108 @@ void statusLED(boolean on) { }
/******************************************
- LCD Menu Module
+ Menu system
*****************************************/
-#if (defined(enable_LCD) && defined(enable_rotary))
-// Read encoder state
-int checkButton() {
- // Read rotary encoder
- encoder.tick();
- int newPos = encoder.getPosition();
- // Read button
- boolean reading = (PING & (1 << PING2)) >> PING2;
+unsigned char question_box(const __FlashStringHelper * question, char answers[7][20], int num_answers, int default_choice) {
+#if (defined(enable_LCD) || defined(enable_OLED))
+ return questionBox_Display(question, answers, num_answers, default_choice);
+#endif
+#ifdef enable_serial
+ return questionBox_Serial(question, answers, num_answers, default_choice);
+#endif
+}
- // Check if rotary encoder has changed
- if (rotaryPos != newPos) {
- int rotaryDir = (int)encoder.getDirection();
- if (rotaryDir == 1) {
- rotaryPos = newPos;
- return 1;
- }
- else if (rotaryDir == -1) {
- rotaryPos = newPos;
- return 2;
- }
- else {
- return 0;
- }
+#if defined(enable_serial)
+// Serial Monitor
+byte questionBox_Serial(const __FlashStringHelper * question, char answers[7][20], int num_answers, int default_choice) {
+ // Print menu to serial monitor
+ //Serial.println(question);
+ Serial.println("");
+ for (byte i = 0; i < num_answers; i++) {
+ Serial.print(i);
+ Serial.print(F(")"));
+ Serial.println(answers[i]);
}
- else if (reading == buttonState) {
- return 0;
+ // Wait for user input
+ Serial.println("");
+ Serial.println(F("Please browse pages with 'u'(up) and 'd'(down)"));
+ Serial.println(F("and enter a selection by typing a number(0-6): _ "));
+ Serial.println("");
+ while (Serial.available() == 0) {
}
- // Check if button has changed
- else {
- if (reading != lastButtonState) {
- lastDebounceTime = millis();
- }
- // Debounce button
- if ((millis() - lastDebounceTime) > debounceDelay) {
- if (reading != buttonState) {
- buttonState = reading;
- // Button was pressed down
- if (buttonState == 0) {
- unsigned long pushTime = millis();
- // Wait until button was let go again
- while ((PING & (1 << PING2)) >> PING2 == 0);
- lastButtonState = reading;
- // If the hold time was over 10 seconds, super long press for resetting eeprom in about screen
- if (millis() - pushTime > 10000) {
- return 4;
- }
- // long press
- else {
- return 3;
- }
- }
- }
- else {
- lastButtonState = reading;
- return 0;
+ // Read the incoming byte:
+ incomingByte = Serial.read() - 48;
+
+ /* Import file (i)
+ if (incomingByte == 57) {
+ if (filebrowse == 1) {
+ // Make sure we have an import directory
+ sd.mkdir("IMPORT", true);
+
+ // Create and open file on sd card
+ EEPROM_readAnything(0, foldern);
+ sprintf(fileName, "IMPORT/%d.bin", foldern);
+ if (!myFile.open(fileName, O_RDWR | O_CREAT)) {
+ print_Error(F("Can't create file on SD"), true);
}
- }
- else {
- lastButtonState = reading;
- return 0;
- }
- }
-}
-// Wait for user to push button
-void wait_btn() {
- // Change led to green
- if (errorLvl == 0)
- rgbLed(green_color);
+ // Read file from serial
+ fileSize = 0;
+ while (Serial.available() > 0) {
+ myFile.write(Serial.read());
+ fileSize++;
+ // Blink led
+ blinkLED();
+ }
- while (1)
- {
- // get input button
- int b = checkButton();
+ // Close the file:
+ myFile.close();
-#ifdef enable_N64
-#ifndef clockgen_installed
- // Send some clock pulses to the Eeprom in case it locked up
- if ((mode == mode_N64_Cart) && ((saveType == 5) || (saveType == 6))) {
- pulseClock_N64(1);
- }
-#endif
-#endif
+ // Write new folder number back to eeprom
+ foldern = foldern + 1;
+ EEPROM_writeAnything(0, foldern);
- // if the cart readers input button is pressed shortly
- if (b == 1) {
- errorLvl = 0;
- break;
+ print_Msg(F("Imported "));
+ print_Msg(fileSize);
+ print_Msg(F(" bytes to file "));
+ println_Msg(fileName);
+ return 7;
}
+ }*/
- // if the cart readers input button is pressed long
- if (b == 3) {
- if (errorLvl) {
- // Debug
-#ifdef debug_mode
- ignoreError = 1;
-#endif
- errorLvl = 0;
+ // Page up (u)
+ if (incomingByte == 69) {
+ if (filebrowse == 1) {
+ if (currPage > 1) {
+ lastPage = currPage;
+ currPage--;
+ }
+ else {
+ root = 1;
}
- break;
}
}
-}
-
-// Wait for user to rotate knob
-void wait_encoder() {
- // Change led to green
- if (errorLvl == 0)
- rgbLed(green_color);
-
- while (1)
- {
- // Get rotary encoder
- encoder.tick();
- int newPos = encoder.getPosition();
-
-#ifdef enable_N64
-#ifndef clockgen_installed
- // Send some clock pulses to the Eeprom in case it locked up
- if ((mode == mode_N64_Cart) && ((saveType == 5) || (saveType == 6))) {
- pulseClock_N64(1);
- }
-#endif
-#endif
- if (rotaryPos != newPos) {
- rotaryPos = newPos;
- errorLvl = 0;
- break;
+ // Page down (d)
+ else if (incomingByte == 52) {
+ if ((numPages > currPage) && (filebrowse == 1)) {
+ lastPage = currPage;
+ currPage++;
}
}
+
+ // Print the received byte for validation e.g. in case of a different keyboard mapping
+ //Serial.println(incomingByte);
+ //Serial.println("");
+ return incomingByte;
}
#endif
-#ifdef enable_LCD
+// OLED & LCD
+#if (defined(enable_LCD) || defined(enable_OLED))
// Display a question box with selectable answers. Make sure default choice is in (0, num_answers]
-unsigned char questionBox_LCD(const __FlashStringHelper * question, char answers[7][20], int num_answers, int default_choice) {
+unsigned char questionBox_Display(const __FlashStringHelper * question, char answers[7][20], int num_answers, int default_choice) {
//clear the screen
display.clearDisplay();
display.updateDisplay();
@@ -2811,9 +2520,77 @@ unsigned char questionBox_LCD(const __FlashStringHelper * question, char answers #endif
/******************************************
- OLED Menu Module
+ User Control
*****************************************/
-#ifdef enable_OLED
+// Using Serial Monitor
+#if defined(enable_serial)
+int checkButton() {
+ while (Serial.available() == 0) {
+ }
+ incomingByte = Serial.read() - 48;
+
+ //Next
+ if (incomingByte == 52) {
+ return 1;
+ }
+
+ //Previous
+ else if (incomingByte == 69) {
+ return 2;
+ }
+
+ //Selection
+ else if (incomingByte == 240) {
+ return 3;
+ }
+}
+
+void wait_serial() {
+ if (errorLvl) {
+ // Debug
+#ifdef debug_mode
+ ignoreError = 1;
+#endif
+ errorLvl = 0;
+ }
+ while (Serial.available() == 0) {
+ }
+ incomingByte = Serial.read() - 48;
+ /* if ((incomingByte == 53) && (fileName[0] != '\0')) {
+ // Open file on sd card
+ sd.chdir(folder);
+ if (myFile.open(fileName, O_READ)) {
+ // Get rom size from file
+ fileSize = myFile.fileSize();
+
+ // Send filesize
+ char tempStr[16];
+ sprintf(tempStr, "%d", fileSize);
+ Serial.write(tempStr);
+
+ // Wait for ok
+ while (Serial.available() == 0) {
+ }
+
+ // Send file
+ for (unsigned long currByte = 0; currByte < fileSize; currByte++) {
+ // Blink led
+ if (currByte % 1024 == 0)
+ blinkLED();
+ Serial.write(myFile.read());
+ }
+ // Close the file:
+ myFile.close();
+ }
+ else {
+ print_Error(F("Can't open file"), true);
+ }
+ }*/
+}
+#endif
+
+// Using one or two push buttons (HW1/HW2/HW3)
+#if defined(enable_OLED)
// Read button state
int checkButton() {
#ifdef enable_Button2
@@ -2985,132 +2762,141 @@ void wait_btn() { }
}
}
+#endif
-// Display a question box with selectable answers. Make sure default choice is in (0, num_answers]
-unsigned char questionBox_OLED(const __FlashStringHelper * question, char answers[7][20], int num_answers, int default_choice) {
- //clear the screen
- display.clearDisplay();
- display.display();
- display.setCursor(0, 0);
-
- // change the rgb led to the start menu color
- rgbLed(default_choice);
+// Using rotary encoder (HW4/HW5)
+#if (defined(enable_LCD) && defined(enable_rotary))
+// Read encoder state
+int checkButton() {
+ // Read rotary encoder
+ encoder.tick();
+ int newPos = encoder.getPosition();
+ // Read button
+ boolean reading = (PING & (1 << PING2)) >> PING2;
- // print menu
- display.println(question);
- for (unsigned char i = 0; i < num_answers; i++) {
- // Add space for the selection dot
- display.print(" ");
- // Print menu item
- display.println(answers[i]);
+ // Check if rotary encoder has changed
+ if (rotaryPos != newPos) {
+ int rotaryDir = (int)encoder.getDirection();
+ if (rotaryDir == 1) {
+ rotaryPos = newPos;
+ return 1;
+ }
+ else if (rotaryDir == -1) {
+ rotaryPos = newPos;
+ return 2;
+ }
+ else {
+ return 0;
+ }
}
- display.display();
-
- // start with the default choice
- choice = default_choice;
-
- // draw selection box
- display.fillRect(0, 8 * choice + 10, 3, 4, WHITE);
- display.display();
-
- unsigned long idleTime = millis();
- byte currentColor = 0;
-
- // wait until user makes his choice
- while (1) {
- // Attract Mode
- if (millis() - idleTime > 300000) {
- if ((millis() - idleTime) % 4000 == 0) {
- if (currentColor < 7) {
- currentColor++;
- if (currentColor == 1) {
- currentColor = 2; // skip red as that signifies an error to the user
- }
- }
- else {
- currentColor = 0;
- }
- }
- rgbLed(currentColor);
+ else if (reading == buttonState) {
+ return 0;
+ }
+ // Check if button has changed
+ else {
+ if (reading != lastButtonState) {
+ lastDebounceTime = millis();
}
+ // Debounce button
+ if ((millis() - lastDebounceTime) > debounceDelay) {
+ if (reading != buttonState) {
+ buttonState = reading;
+ // Button was pressed down
+ if (buttonState == 0) {
+ unsigned long pushTime = millis();
+ // Wait until button was let go again
+ while ((PING & (1 << PING2)) >> PING2 == 0);
+ lastButtonState = reading;
- /* Check Button
- 1 click
- 2 doubleClick
- 3 hold
- 4 longHold */
- int b = checkButton();
-
- if (b == 2) {
- idleTime = millis();
-
- // remove selection box
- display.fillRect(0, 8 * choice + 10, 3, 4, BLACK);
- display.display();
-
- if ((choice == 0) && (filebrowse == 1)) {
- if (currPage > 1) {
- lastPage = currPage;
- currPage--;
- break;
- }
- else {
- root = 1;
- break;
+ // If the hold time was over 10 seconds, super long press for resetting eeprom in about screen
+ if (millis() - pushTime > 10000) {
+ return 4;
+ }
+ // long press
+ else {
+ return 3;
+ }
}
}
- else if (choice > 0) {
- choice--;
- }
else {
- choice = num_answers - 1;
+ lastButtonState = reading;
+ return 0;
}
+ }
+ else {
+ lastButtonState = reading;
+ return 0;
+ }
+ }
+}
- // draw selection box
- display.fillRect(0, 8 * choice + 10, 3, 4, WHITE);
- display.display();
+// Wait for user to push button
+void wait_btn() {
+ // Change led to green
+ if (errorLvl == 0)
+ rgbLed(green_color);
- // change RGB led to the color of the current menu option
- rgbLed(choice);
- }
+ while (1)
+ {
+ // get input button
+ int b = checkButton();
- // go one down in the menu if the Cart Dumpers button is clicked shortly
+#ifdef enable_N64
+#ifndef clockgen_installed
+ // Send some clock pulses to the Eeprom in case it locked up
+ if ((mode == mode_N64_Cart) && ((saveType == 5) || (saveType == 6))) {
+ pulseClock_N64(1);
+ }
+#endif
+#endif
+ // if the cart readers input button is pressed shortly
if (b == 1) {
- idleTime = millis();
-
- // remove selection box
- display.fillRect(0, 8 * choice + 10, 3, 4, BLACK);
- display.display();
+ errorLvl = 0;
+ break;
+ }
- if ((choice == num_answers - 1 ) && (numPages > currPage) && (filebrowse == 1)) {
- lastPage = currPage;
- currPage++;
- break;
+ // if the cart readers input button is pressed long
+ if (b == 3) {
+ if (errorLvl) {
+ // Debug
+#ifdef debug_mode
+ ignoreError = 1;
+#endif
+ errorLvl = 0;
}
- else
- choice = (choice + 1) % num_answers;
+ break;
+ }
+ }
+}
- // draw selection box
- display.fillRect(0, 8 * choice + 10, 3, 4, WHITE);
- display.display();
+// Wait for user to rotate knob
+void wait_encoder() {
+ // Change led to green
+ if (errorLvl == 0)
+ rgbLed(green_color);
- // change RGB led to the color of the current menu option
- rgbLed(choice);
- }
+ while (1)
+ {
+ // Get rotary encoder
+ encoder.tick();
+ int newPos = encoder.getPosition();
- // if the Cart Dumpers button is hold continiously leave the menu
- // so the currently highlighted action can be executed
+#ifdef enable_N64
+#ifndef clockgen_installed
+ // Send some clock pulses to the Eeprom in case it locked up
+ if ((mode == mode_N64_Cart) && ((saveType == 5) || (saveType == 6))) {
+ pulseClock_N64(1);
+ }
+#endif
+#endif
- if (b == 3) {
- idleTime = millis();
+ if (rotaryPos != newPos) {
+ rotaryPos = newPos;
+ errorLvl = 0;
break;
}
}
-
- // pass on user choice
- setColor_RGB(0, 0, 0);
- return choice;
}
#endif
diff --git a/Cart_Reader/GBA.ino b/Cart_Reader/GBA.ino index f46dc5d..4631373 100644 --- a/Cart_Reader/GBA.ino +++ b/Cart_Reader/GBA.ino @@ -886,11 +886,7 @@ void getCartInfo_GBA() { display_Clear();
// Read game name
-#if defined(enable_OLED)
- get_line(gamename, &myFile, 42);
-#else
get_line(gamename, &myFile, 96);
-#endif
// Skip over the CRC checksum
myFile.seekSet(myFile.curPosition() + 9);
diff --git a/Cart_Reader/INTV.ino b/Cart_Reader/INTV.ino index e4f57d5..a749a2b 100644 --- a/Cart_Reader/INTV.ino +++ b/Cart_Reader/INTV.ino @@ -812,11 +812,7 @@ 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()); diff --git a/Cart_Reader/N64.ino b/Cart_Reader/N64.ino index 39231d5..f84989b 100644 --- a/Cart_Reader/N64.ino +++ b/Cart_Reader/N64.ino @@ -180,9 +180,7 @@ void n64ControllerMenu() { resetController(); display_Clear(); display_Update(); -#if defined(enable_OLED) - controllerTest_OLED(); -#elif defined(enable_LCD) +#if (defined(enable_OLED) || defined(enable_LCD)) controllerTest_LCD(); #elif defined(enable_serial) controllerTest_Serial(); @@ -940,7 +938,7 @@ void controllerTest_Serial() { } #endif -#ifdef enable_LCD +#if (defined(enable_LCD) || defined(enable_OLED)) #define CENTER 64 // on which screens do we start int startscreen = 1; @@ -1414,532 +1412,6 @@ void controllerTest_LCD() { } #endif -#ifdef enable_OLED -#define CENTER 64 - -void oledPrint(const char string[], int x, int y) { - - if (x == CENTER) - x = 64 - (strlen(string) / 2) * 6; - display.setCursor(x, y); - display.print(string); -} - -void oledPrint(int number, int x, int y) { - display.setCursor(x, y); - display.print(number); -} - -void printSTR(String st, int x, int y) -{ - char buf[st.length() + 1]; - - st.toCharArray(buf, st.length() + 1); - oledPrint(buf, x, y); -} - -void controllerTest_OLED() { - // on which screens do we start - int startscreen = 1; - int mode = 0; - int test = 1; - - //name of the current displayed result - String anastick = ""; - int prevStickX = 0; - - // Graph - int xax = 22 + 24; // midpoint x - int yax = 24; // midpoint y - int zax = 24; // size - - // variables to display test data of different sticks - int upx = 0; - int upy = 0; - int uprightx = 0; - int uprighty = 0; - int rightx = 0; - int righty = 0; - int downrightx = 0; - int downrighty = 0; - int downx = 0; - int downy = 0; - int downleftx = 0; - int downlefty = 0; - int leftx = 0; - int lefty = 0; - int upleftx = 0; - int uplefty = 0; - - // variables to save test data - int bupx = 0; - int bupy = 0; - int buprightx = 0; - int buprighty = 0; - int brightx = 0; - int brighty = 0; - int bdownrightx = 0; - int bdownrighty = 0; - int bdownx = 0; - int bdowny = 0; - int bdownleftx = 0; - int bdownlefty = 0; - int bleftx = 0; - int blefty = 0; - int bupleftx = 0; - int buplefty = 0; - int results = 0; - - while (quit) { - // Get Button and analog stick - get_button(); - - switch (startscreen) - { - case 1: - { - display.clearDisplay(); - oledPrint("Button Test", CENTER, 0); - display.drawLine(22 + 0, 10, 22 + 84, 10, WHITE); - - // Print Button - printSTR(" " + button + " ", CENTER, 20); - - // Print Stick X Value - String stickx = String("X: " + String(N64_status.stick_x, DEC) + " "); - printSTR(stickx, 22 + 0, 38); - - // Print Stick Y Value - String sticky = String("Y: " + String(N64_status.stick_y, DEC) + " "); - printSTR(sticky, 22 + 60, 38); - - printSTR("(Continue with START)", 0, 55); - //Update LCD - display.display(); - - // go to next screen - if (button == "Press a button" && lastbutton == "START") - { - // reset button - lastbutton = "N/A"; - - display.clearDisplay(); - if (startscreen != 4) - startscreen = startscreen + 1; - else - { - startscreen = 1; - test = 1; - } - } - else if (button == "Press a button" && lastbutton == "Z" && startscreen == 4) - { - // Quit - quit = 0; - } - break; - } - case 2: - { - oledPrint("Range Test", CENTER, 55); - display.drawLine(22 + 0, 50, 22 + 84, 50, WHITE); - - // Print Stick X Value - String stickx = String("X:" + String(N64_status.stick_x, DEC) + " "); - printSTR(stickx, 22 + 54, 8); - - // Print Stick Y Value - String sticky = String("Y:" + String(N64_status.stick_y, DEC) + " "); - printSTR(sticky, 22 + 54, 18); - - // Draw Axis - //display.drawLine(xax - zax, yax, xax + zax, yax, WHITE); - //display.drawLine(xax, yax - zax, xax, yax + zax, WHITE); - display.drawPixel(xax, yax, WHITE); - display.drawPixel(xax, yax - 80 / 4, WHITE); - display.drawPixel(xax, yax + 80 / 4, WHITE); - display.drawPixel(xax + 80 / 4, yax, WHITE); - display.drawPixel(xax - 80 / 4, yax, WHITE); - - // Draw corners - display.drawPixel(xax - 68 / 4, yax - 68 / 4, WHITE); - display.drawPixel(xax + 68 / 4, yax + 68 / 4, WHITE); - display.drawPixel(xax + 68 / 4, yax - 68 / 4, WHITE); - display.drawPixel(xax - 68 / 4, yax + 68 / 4, WHITE); - - //Draw Analog Stick - if (mode == 1) - { - display.drawPixel(xax + N64_status.stick_x / 4, yax - N64_status.stick_y / 4, WHITE); - //Update LCD - display.display(); - } - else - { - display.drawCircle(xax + N64_status.stick_x / 4, yax - N64_status.stick_y / 4, 2, WHITE); - //Update LCD - display.display(); - display.clearDisplay(); - } - - // switch mode - if (button == "Press a button" && lastbutton == "Z") - { - if (mode == 0) - { - mode = 1; - display.clearDisplay(); - } - else - { - mode = 0; - display.clearDisplay(); - } - } - // go to next screen - if (button == "Press a button" && lastbutton == "START") - { - // reset button - lastbutton = "N/A"; - - display.clearDisplay(); - if (startscreen != 4) - startscreen = startscreen + 1; - else - { - startscreen = 1; - test = 1; - } - } - else if (button == "Press a button" && lastbutton == "Z" && startscreen == 4) - { - // Quit - quit = 0; - } - break; - } - case 3: - { - display.drawPixel(22 + prevStickX, 40, BLACK); - oledPrint("Skipping Test", CENTER, 0); - display.drawLine(22 + 0, 10, 22 + 83, 10, WHITE); - display.drawRect(22 + 0, 15, 22 + 59, 21, WHITE); - if (N64_status.stick_x > 0) { - display.drawLine(22 + N64_status.stick_x, 15, 22 + N64_status.stick_x, 35, WHITE); - display.drawPixel(22 + N64_status.stick_x, 40, WHITE); - prevStickX = N64_status.stick_x; - } - - printSTR("Try to fill box by", 0, 45); - printSTR("slowly moving right", 0, 55); - //Update LCD - display.display(); - - if (button == "Press a button" && lastbutton == "Z") - { - // reset button - lastbutton = "N/A"; - - display.clearDisplay(); - } - // go to next screen - if (button == "Press a button" && lastbutton == "START") - { - // reset button - lastbutton = "N/A"; - - display.clearDisplay(); - if (startscreen != 4) - startscreen = startscreen + 1; - else - { - startscreen = 1; - test = 1; - } - } - else if (button == "Press a button" && lastbutton == "Z" && startscreen == 4) - { - // Quit - quit = 0; - } - break; - } - case 4: - { - switch ( test ) - { - case 0: // Display results - { - switch (results) - { - case 0: - { - anastick = "YOURS"; - upx = bupx; - upy = bupy; - uprightx = buprightx; - uprighty = buprighty; - rightx = brightx; - righty = brighty; - downrightx = bdownrightx; - downrighty = bdownrighty; - downx = bdownx; - downy = bdowny; - downleftx = bdownleftx; - downlefty = bdownlefty; - leftx = bleftx; - lefty = blefty; - upleftx = bupleftx; - uplefty = buplefty; - - if (button == "Press a button" && lastbutton == "A") - { - // reset button - lastbutton = "N/A"; - results = 1; - } - - break; - } - case 1: - { - anastick = "ORIG"; - upx = 1; - upy = 84; - uprightx = 67; - uprighty = 68; - rightx = 83; - righty = -2; - downrightx = 67; - downrighty = -69; - downx = 3; - downy = -85; - downleftx = -69; - downlefty = -70; - leftx = -85; - lefty = 0; - upleftx = -68; - uplefty = 68; - - if (button == "Press a button" && lastbutton == "A") - { - // reset button - lastbutton = "N/A"; - results = 0; - } - break; - } - - } //results - display.clearDisplay(); - - printSTR(anastick, 22 + 50, 0); - - oledPrint("U:", 22 + 50, 10); - oledPrint(upy, 100, 10); - oledPrint("D:", 22 + 50, 20); - oledPrint(downy, 100, 20); - oledPrint("L:", 22 + 50, 30); - oledPrint(leftx, 100, 30); - oledPrint("R:", 22 + 50, 40); - oledPrint(rightx, 100, 40); - - display.drawLine(xax + upx / 4, yax - upy / 4, xax + uprightx / 4, yax - uprighty / 4, WHITE); - display.drawLine(xax + uprightx / 4, yax - uprighty / 4, xax + rightx / 4, yax - righty / 4, WHITE); - display.drawLine(xax + rightx / 4, yax - righty / 4, xax + downrightx / 4, yax - downrighty / 4, WHITE); - display.drawLine(xax + downrightx / 4, yax - downrighty / 4, xax + downx / 4, yax - downy / 4, WHITE); - display.drawLine(xax + downx / 4, yax - downy / 4, xax + downleftx / 4, yax - downlefty / 4, WHITE); - display.drawLine(xax + downleftx / 4, yax - downlefty / 4, xax + leftx / 4, yax - lefty / 4, WHITE); - display.drawLine(xax + leftx / 4, yax - lefty / 4, xax + upleftx / 4, yax - uplefty / 4, WHITE); - display.drawLine(xax + upleftx / 4, yax - uplefty / 4, xax + upx / 4, yax - upy / 4, WHITE); - - display.drawPixel(xax, yax, WHITE); - - printSTR("(Quit with Z)", 25, 55); - //Update LCD - display.display(); - break; - } //display results - - case 1:// +y Up - { - oledPrint("Hold Stick Up", CENTER, 18); - oledPrint("then press A", CENTER, 28); - //myOLED.drawBitmap(110, 60, ana1); - - if (button == "Press a button" && lastbutton == "A") - { - bupx = N64_status.stick_x; - bupy = N64_status.stick_y; - // reset button - lastbutton = "N/A"; - - display.clearDisplay(); - test = 2; - } - break; - } - - case 2:// +y+x Up-Right - { - oledPrint("Up-Right", CENTER, 22 ); - //myOLED.drawBitmap(110, 60, ana2); - - if (button == "Press a button" && lastbutton == "A") - { - buprightx = N64_status.stick_x; - buprighty = N64_status.stick_y; - test = 3; - // reset button - lastbutton = "N/A"; - - display.clearDisplay(); - } - break; - } - - case 3:// +x Right - { - oledPrint("Right", CENTER, 22 ); - //myOLED.drawBitmap(110, 60, ana3); - - if (button == "Press a button" && lastbutton == "A") - { - brightx = N64_status.stick_x; - brighty = N64_status.stick_y; - test = 4; - // reset button - lastbutton = "N/A"; - - display.clearDisplay(); - } - break; - } - - case 4:// -y+x Down-Right - { - oledPrint("Down-Right", CENTER, 22 ); - //myOLED.drawBitmap(110, 60, ana4); - - if (button == "Press a button" && lastbutton == "A") - { - bdownrightx = N64_status.stick_x; - bdownrighty = N64_status.stick_y; - test = 5; - // reset button - lastbutton = "N/A"; - - display.clearDisplay(); - } - break; - } - - case 5:// -y Down - { - oledPrint("Down", CENTER, 22 ); - //myOLED.drawBitmap(110, 60, ana5); - - if (button == "Press a button" && lastbutton == "A") - { - bdownx = N64_status.stick_x; - bdowny = N64_status.stick_y; - test = 6; - // reset button - lastbutton = "N/A"; - - display.clearDisplay(); - } - break; - } - - case 6:// -y-x Down-Left - { - oledPrint("Down-Left", CENTER, 22 ); - //myOLED.drawBitmap(110, 60, ana6); - - if (button == "Press a button" && lastbutton == "A") - { - bdownleftx = N64_status.stick_x; - bdownlefty = N64_status.stick_y; - test = 7; - // reset button - lastbutton = "N/A"; - - display.clearDisplay(); - } - break; - } - - case 7:// -x Left - { - oledPrint("Left", CENTER, 22 ); - //myOLED.drawBitmap(110, 60, ana7); - - if (button == "Press a button" && lastbutton == "A") - { - bleftx = N64_status.stick_x; - blefty = N64_status.stick_y; - test = 8; - // reset button - lastbutton = "N/A"; - - display.clearDisplay(); - } - break; - } - - case 8:// +y+x Up-Left - { - oledPrint("Up-Left", CENTER, 22); - //myOLED.drawBitmap(110, 60, ana8); - - if (button == "Press a button" && lastbutton == "A") - { - bupleftx = N64_status.stick_x; - buplefty = N64_status.stick_y; - test = 0; - // reset button - lastbutton = "N/A"; - - display.clearDisplay(); - } - break; - } - } - if (test != 0) - { - oledPrint("Benchmark", CENTER, 0); - display.drawLine(22 + 0, 9, 22 + 83, 9, WHITE); - printSTR("(Quit with Z)", 25, 55); - } - display.display(); - // go to next screen - if (button == "Press a button" && lastbutton == "START") - { - // reset button - lastbutton = "N/A"; - - display.clearDisplay(); - if (startscreen != 4) - startscreen = startscreen + 1; - else - { - startscreen = 1; - test = 1; - } - } - else if (button == "Press a button" && lastbutton == "Z" && startscreen == 4) - { - // Quit - quit = 0; - } - break; - } - } - } -} -#endif - /****************************************** N64 Controller Pak Functions (connected via Controller) diff --git a/Cart_Reader/NES.ino b/Cart_Reader/NES.ino index cdd5315..6592a78 100644 --- a/Cart_Reader/NES.ino +++ b/Cart_Reader/NES.ino @@ -576,11 +576,7 @@ boolean getMapping() { 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()); @@ -848,21 +844,13 @@ void selectMapping() { if ((myLetter > 0) && (myLetter <= 26)) { while (myFile.available()) { // Read current name -#if defined(enable_OLED) - get_line(gamename, &myFile, 42); -#else get_line(gamename, &myFile, 96); -#endif // Compare selected letter with first letter of current name until match while (gamename[0] != 64 + myLetter) { skip_line(&myFile); skip_line(&myFile); -#if defined(enable_OLED) - get_line(gamename, &myFile, 42); -#else get_line(gamename, &myFile, 96); -#endif } break; } @@ -891,11 +879,7 @@ void selectMapping() { 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()); @@ -2085,19 +2069,26 @@ chooseMapper: println_Msg(F("Press right to select")); if (digit == 0) { - display.drawLine(20, 30, 30, 30, WHITE); - display.drawLine(40, 30, 50, 30, BLACK); - display.drawLine(60, 30, 70, 30, BLACK); + 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.drawLine(20, 30, 30, 30, BLACK); - display.drawLine(40, 30, 50, 30, WHITE); - display.drawLine(60, 30, 70, 30, BLACK); + 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.drawLine(20, 30, 30, 30, BLACK); - display.drawLine(40, 30, 50, 30, BLACK); - display.drawLine(60, 30, 70, 30, WHITE); + 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 @@ -4853,10 +4844,7 @@ void writeFLASH() { } } -#if defined(enable_OLED) - display.print(F("*")); - display.display(); -#elif defined(enable_LCD) +#if (defined(enable_LCD) || defined(enable_OLED)) display.print(F("*")); display.updateDisplay(); #else diff --git a/Cart_Reader/WSV.ino b/Cart_Reader/WSV.ino index f71a811..0ed2984 100644 --- a/Cart_Reader/WSV.ino +++ b/Cart_Reader/WSV.ino @@ -435,11 +435,7 @@ void setCart_WSV() { 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()); |