Skip to content

Commit 1330130

Browse files
authored
Merge pull request #3808 from tannewt/panic_safe_mode
Enter safe mode after panic or brownout
2 parents 57101d7 + d0a806d commit 1330130

File tree

1 file changed

+8
-0
lines changed
  • ports/esp32s2/supervisor

1 file changed

+8
-0
lines changed

ports/esp32s2/supervisor/port.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ safe_mode_t port_init(void) {
102102
return NO_HEAP;
103103
}
104104

105+
esp_reset_reason_t reason = esp_reset_reason();
106+
if (reason == ESP_RST_BROWNOUT) {
107+
return BROWNOUT;
108+
}
109+
if (reason == ESP_RST_PANIC) {
110+
return HARD_CRASH;
111+
}
112+
105113
return NO_SAFE_MODE;
106114
}
107115

0 commit comments

Comments
 (0)