From 85992eff808033d82dcfc70bb4d2ba3d4fcfd541 Mon Sep 17 00:00:00 2001 From: Robert Neumann Date: Sat, 31 Aug 2019 02:51:02 +0200 Subject: [PATCH] SNES: blink LED while dumping (as with the other modules); show total elapsed time, including the checksum check --- Cart_Reader/SNES.ino | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/Cart_Reader/SNES.ino b/Cart_Reader/SNES.ino index 01888ac..989fe9f 100644 --- a/Cart_Reader/SNES.ino +++ b/Cart_Reader/SNES.ino @@ -118,11 +118,21 @@ void snesMenu() { switch (mainMenu) { case 0: - display_Clear(); - // Change working dir to root - sd.chdir("/"); - readROM_SNES(); - compare_checksum(); + { + display_Clear(); + // Change working dir to root + sd.chdir("/"); + // get current time + unsigned long startTime = millis(); + // start reading from cart + readROM_SNES(); + compare_checksum(); + // print elapsed time + print_Msg(F("Time elapsed: ")); + print_Msg((millis() - startTime) / 1000); + println_Msg(F("s")); + display_Update(); + } break; case 1: @@ -425,6 +435,10 @@ void readLoRomBanks( unsigned int start, unsigned int total, SdFile *file) for (int currBank = start; currBank < total; currBank++) { PORTL = currBank; + + // Blink led + PORTB ^= (1 << 4); + currByte = 32768; while (1) { c = 0; @@ -468,6 +482,10 @@ void readHiRomBanks( unsigned int start, unsigned int total, SdFile *file) for (int currBank = start; currBank < total; currBank++) { PORTL = currBank; + + // Blink led + PORTB ^= (1 << 4); + currByte = 0; while (1) { c = 0; @@ -1020,9 +1038,6 @@ void readROM_SNES() { print_Error(F("Can't create file on SD"), true); } - // get current time - unsigned long startTime = millis(); - //Dump Derby Stallion '96 (Japan) Actual Size is 24Mb if ((romType == LO) && (numBanks == 128) && (strcmp("CC86", checksumStr) == 0)) { // Read Banks 0x00-0x3F for the 1st/2nd MB @@ -1101,6 +1116,7 @@ void readROM_SNES() { controlIn_SNES(); readHiRomBanks( 240, 256, &myFile ); + if (currMemmap == 2) display_Clear(); // need more space for the progress bars } dataOut(); @@ -1181,12 +1197,6 @@ void readROM_SNES() { // Close the file: myFile.close(); - - // print elapsed time - print_Msg(F("Time elapsed: ")); - print_Msg((millis() - startTime) / 1000); - println_Msg(F("s")); - display_Update(); } /******************************************