Merge pull request #34 from ramapcsx2/arduino_reset

arduino_reset
This commit is contained in:
sanni 2019-08-27 23:34:53 +02:00 committed by GitHub
commit 9c0a10dec8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 33 additions and 27 deletions

View File

@ -85,6 +85,7 @@ boolean n64crc = 1;
#include <SPI.h> #include <SPI.h>
#include <Wire.h> #include <Wire.h>
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
#include <avr/wdt.h>
// AVR Eeprom // AVR Eeprom
#include <EEPROM.h> #include <EEPROM.h>
@ -374,12 +375,12 @@ void aboutScreen() {
// if the cart readers input button is pressed shortly // if the cart readers input button is pressed shortly
if (b == 1) { if (b == 1) {
asm volatile (" jmp 0"); resetArduino();
} }
// if the cart readers input button is pressed long // if the cart readers input button is pressed long
if (b == 3) { if (b == 3) {
asm volatile (" jmp 0"); resetArduino();
} }
// if the button is pressed super long // if the button is pressed super long
@ -390,18 +391,23 @@ void aboutScreen() {
delay(2000); delay(2000);
foldern = 0; foldern = 0;
EEPROM_writeAnything(10, foldern); EEPROM_writeAnything(10, foldern);
asm volatile (" jmp 0"); resetArduino();
} }
} }
if (enable_Serial) { if (enable_Serial) {
wait_serial(); wait_serial();
asm volatile (" jmp 0"); resetArduino();
} }
rgb.setColor(random(0, 255), random(0, 255), random(0, 255)); rgb.setColor(random(0, 255), random(0, 255), random(0, 255));
delay(random(50, 100)); delay(random(50, 100));
} }
} }
void resetArduino() {
wdt_enable(WDTO_15MS);
while (1);
}
void mainMenu() { void mainMenu() {
// create menu with title and 6 options to choose from // create menu with title and 6 options to choose from
unsigned char modeMenu; unsigned char modeMenu;
@ -577,7 +583,7 @@ void print_Error(const __FlashStringHelper *errorMessage, boolean forceReset) {
display_Update(); display_Update();
wait(); wait();
if (ignoreError == 0) { if (ignoreError == 0) {
asm volatile (" jmp 0"); resetArduino();
} }
else { else {
ignoreError = 0; ignoreError = 0;
@ -1377,7 +1383,7 @@ void loop() {
println_Msg(F("Press Button...")); println_Msg(F("Press Button..."));
display_Update(); display_Update();
wait(); wait();
asm volatile (" jmp 0"); resetArduino();
} }
} }

View File

@ -220,7 +220,7 @@ void flashromMenu8() {
resetFlash29F032(); resetFlash29F032();
else else
resetFlash29F1610(); resetFlash29F1610();
asm volatile (" jmp 0"); resetArduino();
break; break;
} }
if (time != 0) { if (time != 0) {
@ -318,7 +318,7 @@ void flashromMenu16() {
display_Clear(); display_Clear();
display_Update(); display_Update();
resetFlash16(); resetFlash16();
asm volatile (" jmp 0"); resetArduino();
break; break;
} }
if (time != 0) { if (time != 0) {
@ -385,7 +385,7 @@ void epromMenu() {
time = 0; time = 0;
display_Clear(); display_Clear();
display_Update(); display_Update();
asm volatile (" jmp 0"); resetArduino();
break; break;
} }
if (time != 0) { if (time != 0) {

View File

@ -125,7 +125,7 @@ void gbMenu() {
writeFlash_GB(3); writeFlash_GB(3);
// Reset // Reset
wait(); wait();
asm volatile (" jmp 0"); resetArduino();
break; break;
case 4: case 4:
@ -135,11 +135,11 @@ void gbMenu() {
writeFlash_GB(5); writeFlash_GB(5);
// Reset // Reset
wait(); wait();
asm volatile (" jmp 0"); resetArduino();
break; break;
case 5: case 5:
asm volatile (" jmp 0"); resetArduino();
break; break;
} }
println_Msg(F("")); println_Msg(F(""));

View File

@ -473,11 +473,11 @@ void gbaMenu() {
println_Msg(F("Press Button...")); println_Msg(F("Press Button..."));
display_Update(); display_Update();
wait(); wait();
asm volatile (" jmp 0"); resetArduino();
break; break;
case 5: case 5:
asm volatile (" jmp 0"); resetArduino();
break; break;
} }

View File

@ -226,7 +226,7 @@ void mdMenu() {
case 6: case 6:
// Reset // Reset
asm volatile (" jmp 0"); resetArduino();
break; break;
} }
println_Msg(F("")); println_Msg(F(""));

View File

@ -183,7 +183,7 @@ void n64ControllerMenu() {
break; break;
case 3: case 3:
asm volatile (" jmp 0"); resetArduino();
break; break;
} }
} }
@ -341,7 +341,7 @@ void n64CartMenu() {
break; break;
case 4: case 4:
asm volatile (" jmp 0"); resetArduino();
break; break;
} }
} }
@ -2192,7 +2192,7 @@ calcn64crc:
case 3: case 3:
// Reset // Reset
asm volatile (" jmp 0"); resetArduino();
break; break;
} }
} }

View File

@ -78,7 +78,7 @@ void sfmMenu() {
break; break;
// Reset // Reset
case 2: case 2:
asm volatile (" jmp 0"); resetArduino();
break; break;
} }
} }
@ -205,7 +205,7 @@ void sfmGameOptions() {
// Reset // Reset
case 4: case 4:
asm volatile (" jmp 0"); resetArduino();
break; break;
} }
if (gameSubMenu != 3) { if (gameSubMenu != 3) {

View File

@ -863,7 +863,7 @@ void pceMenu() {
write_tennokoe_bank_PCE(); write_tennokoe_bank_PCE();
break; break;
case 3: case 3:
asm volatile (" jmp 0"); resetArduino();
break; break;
} }
} }
@ -884,7 +884,7 @@ void pceMenu() {
break; break;
case 1: case 1:
asm volatile (" jmp 0"); resetArduino();
break; break;
} }
} }

View File

@ -212,11 +212,11 @@ void snesMenu() {
print_Msg("Resetting..."); print_Msg("Resetting...");
display_Update(); display_Update();
delay(3000); // wait 3 secs to switch to next game delay(3000); // wait 3 secs to switch to next game
asm volatile (" jmp 0"); resetArduino();
break; break;
case 5: case 5:
asm volatile (" jmp 0"); resetArduino();
break; break;
} }
println_Msg(F("")); println_Msg(F(""));
@ -262,7 +262,7 @@ void confMenu() {
case 4: case 4:
// Reset // Reset
asm volatile (" jmp 0"); resetArduino();
break; break;
} }
} }
@ -1675,7 +1675,7 @@ unsigned long verifySRAM() {
print_Msg("Resetting..."); print_Msg("Resetting...");
display_Update(); display_Update();
delay(3000); // wait 3 secs delay(3000); // wait 3 secs
asm volatile (" jmp 0"); resetArduino();
} }
// Close the file: // Close the file:
myFile.close(); myFile.close();

View File

@ -59,7 +59,7 @@ void svMenu() {
// Reset // Reset
case 2: case 2:
asm volatile (" jmp 0"); resetArduino();
break; break;
} }
} }