mirror of
https://github.com/esphome/esphome.git
synced 2026-09-16 17:48:40 +00:00
Address review feedback
- Clear valid flag after logging to prevent re-logging on API reconnects - Cache esp_cpu_process_stack_pc result to avoid redundant call - Remove unused <cstdint> include from header
This commit is contained in:
@@ -89,6 +89,8 @@ void crash_handler_log() {
|
||||
pos += snprintf(hint + pos, sizeof(hint) - pos, " 0x%08" PRIX32, s_crash_data.backtrace[i]);
|
||||
}
|
||||
ESP_LOGE(TAG, "%s", hint);
|
||||
// Clear so we don't re-log on subsequent API reconnects
|
||||
s_crash_data.valid = false;
|
||||
}
|
||||
|
||||
} // namespace esphome::esp32
|
||||
@@ -123,8 +125,9 @@ void IRAM_ATTR __wrap_esp_panic_handler(panic_info_t *info) {
|
||||
|
||||
uint8_t count = 0;
|
||||
// First frame PC
|
||||
if (is_code_addr(esp_cpu_process_stack_pc(bt_frame.pc))) {
|
||||
s_raw_crash_data.backtrace[count++] = esp_cpu_process_stack_pc(bt_frame.pc);
|
||||
uint32_t first_pc = esp_cpu_process_stack_pc(bt_frame.pc);
|
||||
if (is_code_addr(first_pc)) {
|
||||
s_raw_crash_data.backtrace[count++] = first_pc;
|
||||
}
|
||||
// Walk remaining frames
|
||||
while (count < MAX_BACKTRACE && bt_frame.next_pc != 0) {
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
#ifdef USE_ESP32
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace esphome::esp32 {
|
||||
|
||||
/// Read crash data from NOINIT memory and clear the magic marker.
|
||||
|
||||
Reference in New Issue
Block a user