Fix Serial Monitor errors/warnings

This commit is contained in:
sanni 2024-07-13 10:46:59 +02:00
parent 8323aaeca9
commit 8d99ac572f
4 changed files with 33 additions and 11 deletions

View File

@ -830,7 +830,7 @@ boolean checkCartSelection(FsFile& database, void (*readData)(FsFile&, void*), v
print_STR(press_to_select_STR, 1); print_STR(press_to_select_STR, 1);
#elif defined(SERIAL_MONITOR) #elif defined(SERIAL_MONITOR)
println_Msg(F("U/D to Change")); println_Msg(F("U/D to Change"));
println_Msg(F("Space to Select")); println_Msg(F("Space/Zero to Select"));
#endif #endif
display_Update(); display_Update();
@ -905,7 +905,7 @@ void printInstructions() {
print_STR(press_to_select_STR, 1); print_STR(press_to_select_STR, 1);
# elif defined(SERIAL_MONITOR) # elif defined(SERIAL_MONITOR)
println_Msg(F("U/D to Change")); 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 */ # endif /* ENABLE_OLED | ENABLE_LCD | SERIAL_MONITOR */
display_Update(); 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_OLED | ENABLE_LCD) */
# endif /* ENABLE_<CORES> */ # endif /* ENABLE_<CORES> */
@ -2844,18 +2853,24 @@ void blinkLED() {
#if defined(ENABLE_VSELECT) #if defined(ENABLE_VSELECT)
// Nothing // Nothing
#elif defined(HW5) #elif defined(HW5)
// 3mm LED on D38, front of PCB
PORTD ^= (1 << 7); PORTD ^= (1 << 7);
#elif defined(ENABLE_OLED) #elif defined(ENABLE_OLED)
// 5mm LED on D10, above SD slot
PORTB ^= (1 << 4); PORTB ^= (1 << 4);
#elif defined(ENABLE_LCD) #elif defined(ENABLE_LCD) // HW4
// TX LED on D1, build-in
PORTE ^= (1 << 1); PORTE ^= (1 << 1);
#elif defined(ENABLE_SERIAL) #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); PORTB ^= (1 << 7);
#endif #endif
} }
#if defined(HW5) && !defined(ENABLE_VSELECT) #if defined(HW5) && !defined(ENABLE_VSELECT)
// 3mm LED on D38, front of PCB
void statusLED(boolean on) { void statusLED(boolean on) {
if (!on) if (!on)
PORTD |= (1 << 7); PORTD |= (1 << 7);
@ -3159,7 +3174,7 @@ uint8_t checkButton() {
} }
//Selection //Selection
else if (incomingByte == 240) { else if ((incomingByte == 240) || (incomingByte == -16) || (incomingByte == 0)) {
return 3; return 3;
} }

View File

@ -2532,7 +2532,9 @@ byte selectBlockNumber(boolean option) {
blockNumber = navigateMenu(0, 63, &printblockNumber); blockNumber = navigateMenu(0, 63, &printblockNumber);
else else
blockNumber = navigateMenu(0, 32, &printFileSize); blockNumber = navigateMenu(0, 32, &printFileSize);
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display.setCursor(0, 56); // Display selection at bottom display.setCursor(0, 56); // Display selection at bottom
#endif
if (option) { if (option) {
print_Msg(F("Block Number: ")); print_Msg(F("Block Number: "));
println_Msg(blockNumber); println_Msg(blockNumber);
@ -2569,6 +2571,9 @@ void read369in1(byte blockNumber, byte fileSizeByte) {
unsigned long lastBlock = 0x2000000; unsigned long lastBlock = 0x2000000;
if (fileSize < lastBlock) if (fileSize < lastBlock)
lastBlock = startBlock + fileSize; lastBlock = startBlock + fileSize;
unsigned long lastBuffer = 0x400000;
if (fileSize < lastBuffer)
lastBuffer = fileSize;
//Initialize progress bar //Initialize progress bar
uint32_t processedProgressBar = 0; uint32_t processedProgressBar = 0;
@ -2582,7 +2587,7 @@ void read369in1(byte blockNumber, byte fileSizeByte) {
// Set-up 369-in-1 mapper // Set-up 369-in-1 mapper
mapBlock369in1((currBank + currBlock) / 1024 / 1024); mapBlock369in1((currBank + currBlock) / 1024 / 1024);
// 4MB Block // 4MB Block
for (unsigned long currBuffer = 0; currBuffer < 0x400000; currBuffer += 1024) { for (unsigned long currBuffer = 0; currBuffer < lastBuffer; currBuffer += 1024) {
// 1024 byte readBuffer // 1024 byte readBuffer
for (int currWord = 0; currWord < 1024; currWord += 2) { for (int currWord = 0; currWord < 1024; currWord += 2) {
word tempWord = readWord_GBA(currBlock + currBuffer + currWord); word tempWord = readWord_GBA(currBlock + currBuffer + currWord);
@ -2723,9 +2728,9 @@ void write369in1(byte blockNumber) {
void flashRepro_GBA(boolean option) { void flashRepro_GBA(boolean option) {
// Check flashrom ID's // Check flashrom ID's
idFlashrom_GBA(); idFlashrom_GBA();
byte blockNum;
if ((flashid == 0x8802) || (flashid == 0x8816) || (flashid == 0x227E) || (flashid == 0x8812)) { if ((flashid == 0x8802) || (flashid == 0x8816) || (flashid == 0x227E) || (flashid == 0x8812)) {
byte blockNum = 0;
print_Msg(F("ID: ")); print_Msg(F("ID: "));
print_Msg(flashid_str); print_Msg(flashid_str);
print_Msg(F(" Size: ")); print_Msg(F(" Size: "));

View File

@ -2896,7 +2896,9 @@ void printRomSize_MD(int index) {
void force_cartSize_MD() { void force_cartSize_MD() {
cartSize = navigateMenu(0, 9, &printRomSize_MD); cartSize = navigateMenu(0, 9, &printRomSize_MD);
cartSize = pgm_read_byte(&(MDSize[cartSize])) * 131072; cartSize = pgm_read_byte(&(MDSize[cartSize])) * 131072;
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
display.setCursor(0, 56); // Display selection at bottom display.setCursor(0, 56); // Display selection at bottom
#endif
print_Msg(FS(FSTRING_ROM_SIZE)); print_Msg(FS(FSTRING_ROM_SIZE));
print_Msg(cartSize / 131072); print_Msg(cartSize / 131072);
println_Msg(F(" Mbit")); println_Msg(F(" Mbit"));

View File

@ -1163,7 +1163,7 @@ setmapper:
String newmap; String newmap;
bool mapfound = false; bool mapfound = false;
Serial.println(F("SUPPORTED MAPPERS:")); 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); mapselect = pgm_read_word(mapsize + i);
Serial.print("["); Serial.print("[");
Serial.print(mapselect); Serial.print(mapselect);
@ -1257,7 +1257,7 @@ void setPRGSize() {
else { else {
setprg: setprg:
String sizePRG; 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(F("Select PRG Size: "));
Serial.print(i); Serial.print(i);
Serial.print(F(" = ")); Serial.print(F(" = "));
@ -1325,7 +1325,7 @@ void setCHRSize() {
else { else {
setchr: setchr:
String sizeCHR; 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(F("Select CHR Size: "));
Serial.print(i); Serial.print(i);
Serial.print(F(" = ")); Serial.print(F(" = "));
@ -1435,7 +1435,7 @@ void setRAMSize() {
else { else {
setram: setram:
String sizeRAM; 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(F("Select RAM Size: "));
Serial.print(i); Serial.print(i);
Serial.print(F(" = ")); Serial.print(F(" = "));