aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorsanni <[email protected]>2024-07-13 10:46:59 +0200
committersanni <[email protected]>2024-07-13 10:46:59 +0200
commit8d99ac572ff43615bdb8f294e74113f94a3d343c (patch)
treeacf503cb5b9baa57d57896555882cc756566abde
parent8323aaeca91beaf0b618e0b114b6f2934ab64c25 (diff)
downloadcartreader-8d99ac572ff43615bdb8f294e74113f94a3d343c.tar.gz
cartreader-8d99ac572ff43615bdb8f294e74113f94a3d343c.zip
Fix Serial Monitor errors/warnings
-rw-r--r--Cart_Reader/Cart_Reader.ino25
-rw-r--r--Cart_Reader/GBA.ino9
-rw-r--r--Cart_Reader/MD.ino2
-rw-r--r--Cart_Reader/NES.ino8
4 files changed, 33 insertions, 11 deletions
diff --git a/Cart_Reader/Cart_Reader.ino b/Cart_Reader/Cart_Reader.ino
index c0c62f9..a672655 100644
--- a/Cart_Reader/Cart_Reader.ino
+++ b/Cart_Reader/Cart_Reader.ino
@@ -830,7 +830,7 @@ boolean checkCartSelection(FsFile& database, void (*readData)(FsFile&, void*), v
print_STR(press_to_select_STR, 1);
#elif defined(SERIAL_MONITOR)
println_Msg(F("U/D to Change"));
- println_Msg(F("Space to Select"));
+ println_Msg(F("Space/Zero to Select"));
#endif
display_Update();
@@ -905,7 +905,7 @@ void printInstructions() {
print_STR(press_to_select_STR, 1);
# elif defined(SERIAL_MONITOR)
println_Msg(F("U/D to Change"));
- println_Msg(F("Space to Select"));
+ println_Msg(F("Space/Zero to Select"));
# endif /* ENABLE_OLED | ENABLE_LCD | SERIAL_MONITOR */
display_Update();
@@ -980,6 +980,15 @@ int navigateMenu(int min, int max, void (*printSelection)(int)) {
}
}
}
+#elif defined(SERIAL_MONITOR)
+int navigateMenu(__attribute__((unused)) int min,__attribute__((unused)) int max, void (*printSelection)(int)) {
+ printSelection(0);
+ Serial.println(F("Enter number to change:_"));
+ while (Serial.available() == 0) {}
+ int selectedNumber = Serial.parseInt();
+ delay(200);
+ return selectedNumber;
+}
# endif /* (ENABLE_OLED | ENABLE_LCD) */
# endif /* ENABLE_<CORES> */
@@ -2844,18 +2853,24 @@ void blinkLED() {
#if defined(ENABLE_VSELECT)
// Nothing
#elif defined(HW5)
+ // 3mm LED on D38, front of PCB
PORTD ^= (1 << 7);
#elif defined(ENABLE_OLED)
+ // 5mm LED on D10, above SD slot
PORTB ^= (1 << 4);
-#elif defined(ENABLE_LCD)
+#elif defined(ENABLE_LCD) // HW4
+ // TX LED on D1, build-in
PORTE ^= (1 << 1);
#elif defined(ENABLE_SERIAL)
- PORTB ^= (1 << 4);
+ // 5mm LED on D10, above SD slot (HW3)
+ PORTB ^= (1 << 4); //HW4/HW5 LCD RST connects there now too
+ // 3mm LED on D38, front of PCB (HW5)
PORTB ^= (1 << 7);
#endif
}
#if defined(HW5) && !defined(ENABLE_VSELECT)
+// 3mm LED on D38, front of PCB
void statusLED(boolean on) {
if (!on)
PORTD |= (1 << 7);
@@ -3159,7 +3174,7 @@ uint8_t checkButton() {
}
//Selection
- else if (incomingByte == 240) {
+ else if ((incomingByte == 240) || (incomingByte == -16) || (incomingByte == 0)) {
return 3;
}
diff --git a/Cart_Reader/GBA.ino b/Cart_Reader/GBA.ino
index ef4336a..171c56a 100644
--- a/Cart_Reader/GBA.ino
+++ b/Cart_Reader/GBA.ino
@@ -2532,7 +2532,9 @@ byte selectBlockNumber(boolean option) {
blockNumber = navigateMenu(0, 63, &printblockNumber);
else
blockNumber = navigateMenu(0, 32, &printFileSize);
+#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display.setCursor(0, 56); // Display selection at bottom
+#endif
if (option) {
print_Msg(F("Block Number: "));
println_Msg(blockNumber);
@@ -2569,6 +2571,9 @@ void read369in1(byte blockNumber, byte fileSizeByte) {
unsigned long lastBlock = 0x2000000;
if (fileSize < lastBlock)
lastBlock = startBlock + fileSize;
+ unsigned long lastBuffer = 0x400000;
+ if (fileSize < lastBuffer)
+ lastBuffer = fileSize;
//Initialize progress bar
uint32_t processedProgressBar = 0;
@@ -2582,7 +2587,7 @@ void read369in1(byte blockNumber, byte fileSizeByte) {
// Set-up 369-in-1 mapper
mapBlock369in1((currBank + currBlock) / 1024 / 1024);
// 4MB Block
- for (unsigned long currBuffer = 0; currBuffer < 0x400000; currBuffer += 1024) {
+ for (unsigned long currBuffer = 0; currBuffer < lastBuffer; currBuffer += 1024) {
// 1024 byte readBuffer
for (int currWord = 0; currWord < 1024; currWord += 2) {
word tempWord = readWord_GBA(currBlock + currBuffer + currWord);
@@ -2723,9 +2728,9 @@ void write369in1(byte blockNumber) {
void flashRepro_GBA(boolean option) {
// Check flashrom ID's
idFlashrom_GBA();
- byte blockNum;
if ((flashid == 0x8802) || (flashid == 0x8816) || (flashid == 0x227E) || (flashid == 0x8812)) {
+ byte blockNum = 0;
print_Msg(F("ID: "));
print_Msg(flashid_str);
print_Msg(F(" Size: "));
diff --git a/Cart_Reader/MD.ino b/Cart_Reader/MD.ino
index 4bed801..ef8ed58 100644
--- a/Cart_Reader/MD.ino
+++ b/Cart_Reader/MD.ino
@@ -2896,7 +2896,9 @@ void printRomSize_MD(int index) {
void force_cartSize_MD() {
cartSize = navigateMenu(0, 9, &printRomSize_MD);
cartSize = pgm_read_byte(&(MDSize[cartSize])) * 131072;
+ #if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display.setCursor(0, 56); // Display selection at bottom
+ #endif
print_Msg(FS(FSTRING_ROM_SIZE));
print_Msg(cartSize / 131072);
println_Msg(F(" Mbit"));
diff --git a/Cart_Reader/NES.ino b/Cart_Reader/NES.ino
index 2b1241d..089000e 100644
--- a/Cart_Reader/NES.ino
+++ b/Cart_Reader/NES.ino
@@ -1163,7 +1163,7 @@ setmapper:
String newmap;
bool mapfound = false;
Serial.println(F("SUPPORTED MAPPERS:"));
- for (size_t i = 0; i < mapcount; i++) {
+ for (int i = 0; i < mapcount; i++) {
mapselect = pgm_read_word(mapsize + i);
Serial.print("[");
Serial.print(mapselect);
@@ -1257,7 +1257,7 @@ void setPRGSize() {
else {
setprg:
String sizePRG;
- for (size_t i = 0; i < (prghi - prglo + 1); i++) {
+ for (int i = 0; i < (prghi - prglo + 1); i++) {
Serial.print(F("Select PRG Size: "));
Serial.print(i);
Serial.print(F(" = "));
@@ -1325,7 +1325,7 @@ void setCHRSize() {
else {
setchr:
String sizeCHR;
- for (size_t i = 0; i < (chrhi - chrlo + 1); i++) {
+ for (int i = 0; i < (chrhi - chrlo + 1); i++) {
Serial.print(F("Select CHR Size: "));
Serial.print(i);
Serial.print(F(" = "));
@@ -1435,7 +1435,7 @@ void setRAMSize() {
else {
setram:
String sizeRAM;
- for (size_t i = 0; i < (ramhi - ramlo + 1); i++) {
+ for (int i = 0; i < (ramhi - ramlo + 1); i++) {
Serial.print(F("Select RAM Size: "));
Serial.print(i);
Serial.print(F(" = "));