1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-09-02 19:02:35 +02:00

Use default config after a panic

... to prevent reset loops.
This commit is contained in:
Mitch Bradley
2021-05-22 14:58:35 -10:00
parent 632344bd9b
commit 4916f9fdf0

View File

@@ -433,8 +433,17 @@ bool MachineConfig::load(const char* filename) {
} }
config = instance(); config = instance();
char* buffer; // If the system crashes we skip the config file and use the default
size_t filesize = readFile(filename, buffer); // builtin config. This helps prevent reset loops on bad config files.
size_t filesize = 0;
char* buffer;
esp_reset_reason_t reason = esp_reset_reason();
if (reason == ESP_RST_PANIC) {
log_debug("Skipping configuration file due to panic");
} else {
filesize = readFile(filename, buffer);
}
StringRange* input; StringRange* input;
if (filesize > 0) { if (filesize > 0) {