Merge pull request #3808 from tannewt/panic_safe_mode

Enter safe mode after panic or brownout
This commit is contained in:
Scott Shawcroft 2020-12-08 16:31:22 -08:00 committed by GitHub
commit 133013083a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -102,6 +102,14 @@ safe_mode_t port_init(void) {
return NO_HEAP; return NO_HEAP;
} }
esp_reset_reason_t reason = esp_reset_reason();
if (reason == ESP_RST_BROWNOUT) {
return BROWNOUT;
}
if (reason == ESP_RST_PANIC) {
return HARD_CRASH;
}
return NO_SAFE_MODE; return NO_SAFE_MODE;
} }