diff --git a/Cart_Reader/Cart_Reader.ino b/Cart_Reader/Cart_Reader.ino index 91da0a1..85963bc 100644 --- a/Cart_Reader/Cart_Reader.ino +++ b/Cart_Reader/Cart_Reader.ino @@ -490,7 +490,7 @@ byte sdBuffer[512]; // soft reset Arduino: jumps to 0 // using the watchdog timer would be more elegant but some Mega2560 bootloaders are buggy with it -void (*resetArduino)(void) = 0; +void (*resetArduino)(void) __attribute__ ((noreturn)) = 0; // Progressbar void draw_progressbar(uint32_t processedsize, uint32_t totalsize); @@ -2005,6 +2005,22 @@ void print_Error(byte errorMessage, boolean forceReset) { } } +void print_FatalError(const __FlashStringHelper* errorMessage) __attribute__ ((noreturn)); +void print_FatalError(const __FlashStringHelper* errorMessage) { + print_Error(errorMessage, true); + // Redundant as print_Error already calls it, but makes gcc understand that + // this in fact does not return. + resetArduino(); +} + +void print_FatalError(byte errorMessage) __attribute__ ((noreturn)); +void print_FatalError(byte errorMessage){ + print_Error(errorMessage, true); + // Redundant as print_Error already calls it, but makes gcc understand that + // this in fact does not return. + resetArduino(); +} + void wait() { // Switch status LED off statusLED(false);