diff --git a/Cart_Reader/Cart_Reader.ino b/Cart_Reader/Cart_Reader.ino index 748d04e..745136e 100644 --- a/Cart_Reader/Cart_Reader.ino +++ b/Cart_Reader/Cart_Reader.ino @@ -85,6 +85,7 @@ boolean n64crc = 1; #include #include #include +#include // AVR Eeprom #include @@ -374,12 +375,12 @@ void aboutScreen() { // if the cart readers input button is pressed shortly if (b == 1) { - asm volatile (" jmp 0"); + resetArduino(); } // if the cart readers input button is pressed long if (b == 3) { - asm volatile (" jmp 0"); + resetArduino(); } // if the button is pressed super long @@ -390,18 +391,23 @@ void aboutScreen() { delay(2000); foldern = 0; EEPROM_writeAnything(10, foldern); - asm volatile (" jmp 0"); + resetArduino(); } } if (enable_Serial) { wait_serial(); - asm volatile (" jmp 0"); + resetArduino(); } rgb.setColor(random(0, 255), random(0, 255), random(0, 255)); delay(random(50, 100)); } } +void resetArduino() { + wdt_enable(WDTO_15MS); + while (1); +} + void mainMenu() { // create menu with title and 6 options to choose from unsigned char modeMenu; @@ -577,7 +583,7 @@ void print_Error(const __FlashStringHelper *errorMessage, boolean forceReset) { display_Update(); wait(); if (ignoreError == 0) { - asm volatile (" jmp 0"); + resetArduino(); } else { ignoreError = 0; @@ -1377,7 +1383,7 @@ void loop() { println_Msg(F("Press Button...")); display_Update(); wait(); - asm volatile (" jmp 0"); + resetArduino(); } } diff --git a/Cart_Reader/FLASH.ino b/Cart_Reader/FLASH.ino index e7f794b..2d54ad7 100644 --- a/Cart_Reader/FLASH.ino +++ b/Cart_Reader/FLASH.ino @@ -220,7 +220,7 @@ void flashromMenu8() { resetFlash29F032(); else resetFlash29F1610(); - asm volatile (" jmp 0"); + resetArduino(); break; } if (time != 0) { @@ -318,7 +318,7 @@ void flashromMenu16() { display_Clear(); display_Update(); resetFlash16(); - asm volatile (" jmp 0"); + resetArduino(); break; } if (time != 0) { @@ -385,7 +385,7 @@ void epromMenu() { time = 0; display_Clear(); display_Update(); - asm volatile (" jmp 0"); + resetArduino(); break; } if (time != 0) { diff --git a/Cart_Reader/GB.ino b/Cart_Reader/GB.ino index db98d1a..7be1882 100644 --- a/Cart_Reader/GB.ino +++ b/Cart_Reader/GB.ino @@ -125,7 +125,7 @@ void gbMenu() { writeFlash_GB(3); // Reset wait(); - asm volatile (" jmp 0"); + resetArduino(); break; case 4: @@ -135,11 +135,11 @@ void gbMenu() { writeFlash_GB(5); // Reset wait(); - asm volatile (" jmp 0"); + resetArduino(); break; case 5: - asm volatile (" jmp 0"); + resetArduino(); break; } println_Msg(F("")); diff --git a/Cart_Reader/GBA.ino b/Cart_Reader/GBA.ino index 9e3f698..07edb9a 100644 --- a/Cart_Reader/GBA.ino +++ b/Cart_Reader/GBA.ino @@ -473,11 +473,11 @@ void gbaMenu() { println_Msg(F("Press Button...")); display_Update(); wait(); - asm volatile (" jmp 0"); + resetArduino(); break; case 5: - asm volatile (" jmp 0"); + resetArduino(); break; } diff --git a/Cart_Reader/MD.ino b/Cart_Reader/MD.ino index 000276c..9f70aed 100644 --- a/Cart_Reader/MD.ino +++ b/Cart_Reader/MD.ino @@ -226,7 +226,7 @@ void mdMenu() { case 6: // Reset - asm volatile (" jmp 0"); + resetArduino(); break; } println_Msg(F("")); diff --git a/Cart_Reader/N64.ino b/Cart_Reader/N64.ino index 98d0f2c..039aa50 100644 --- a/Cart_Reader/N64.ino +++ b/Cart_Reader/N64.ino @@ -183,7 +183,7 @@ void n64ControllerMenu() { break; case 3: - asm volatile (" jmp 0"); + resetArduino(); break; } } @@ -341,7 +341,7 @@ void n64CartMenu() { break; case 4: - asm volatile (" jmp 0"); + resetArduino(); break; } } @@ -2192,7 +2192,7 @@ calcn64crc: case 3: // Reset - asm volatile (" jmp 0"); + resetArduino(); break; } } diff --git a/Cart_Reader/NP.ino b/Cart_Reader/NP.ino index 2f414a2..03f9f25 100644 --- a/Cart_Reader/NP.ino +++ b/Cart_Reader/NP.ino @@ -78,7 +78,7 @@ void sfmMenu() { break; // Reset case 2: - asm volatile (" jmp 0"); + resetArduino(); break; } } @@ -205,7 +205,7 @@ void sfmGameOptions() { // Reset case 4: - asm volatile (" jmp 0"); + resetArduino(); break; } if (gameSubMenu != 3) { diff --git a/Cart_Reader/PCE.ino b/Cart_Reader/PCE.ino index 463d503..d4766c8 100644 --- a/Cart_Reader/PCE.ino +++ b/Cart_Reader/PCE.ino @@ -863,7 +863,7 @@ void pceMenu() { write_tennokoe_bank_PCE(); break; case 3: - asm volatile (" jmp 0"); + resetArduino(); break; } } @@ -884,7 +884,7 @@ void pceMenu() { break; case 1: - asm volatile (" jmp 0"); + resetArduino(); break; } } diff --git a/Cart_Reader/SNES.ino b/Cart_Reader/SNES.ino index f6b29bc..183aef6 100644 --- a/Cart_Reader/SNES.ino +++ b/Cart_Reader/SNES.ino @@ -212,11 +212,11 @@ void snesMenu() { print_Msg("Resetting..."); display_Update(); delay(3000); // wait 3 secs to switch to next game - asm volatile (" jmp 0"); + resetArduino(); break; case 5: - asm volatile (" jmp 0"); + resetArduino(); break; } println_Msg(F("")); @@ -262,7 +262,7 @@ void confMenu() { case 4: // Reset - asm volatile (" jmp 0"); + resetArduino(); break; } } @@ -1675,7 +1675,7 @@ unsigned long verifySRAM() { print_Msg("Resetting..."); display_Update(); delay(3000); // wait 3 secs - asm volatile (" jmp 0"); + resetArduino(); } // Close the file: myFile.close(); diff --git a/Cart_Reader/SV.ino b/Cart_Reader/SV.ino index a9fd7b0..777bfe1 100644 --- a/Cart_Reader/SV.ino +++ b/Cart_Reader/SV.ino @@ -59,7 +59,7 @@ void svMenu() { // Reset case 2: - asm volatile (" jmp 0"); + resetArduino(); break; } }