From efc449ccf8c38e559dd66074ccbc2e09392a10e7 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 5 Apr 2026 16:27:07 -1000 Subject: [PATCH] Address Copilot review comments - Fix crash_handler_has_data docstring: returns true for crash reset reason (exception/WDT), not dependent on RTC backtrace presence - Always log numeric exccause in fallback branch for unexpected causes --- esphome/components/esp8266/crash_handler.cpp | 2 +- esphome/components/esp8266/crash_handler.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/esp8266/crash_handler.cpp b/esphome/components/esp8266/crash_handler.cpp index e187b0e67c..91b0cf9082 100644 --- a/esphome/components/esp8266/crash_handler.cpp +++ b/esphome/components/esp8266/crash_handler.cpp @@ -186,7 +186,7 @@ void crash_handler_log() { ESP_LOGE(TAG, " Reason: %s - %s (exccause=%" PRIu32 ")", LOG_STR_ARG(get_reset_reason(resetInfo.reason)), LOG_STR_ARG(cause), exccause); } else { - ESP_LOGE(TAG, " Reason: %s", LOG_STR_ARG(get_reset_reason(resetInfo.reason))); + ESP_LOGE(TAG, " Reason: %s (exccause=%" PRIu32 ")", LOG_STR_ARG(get_reset_reason(resetInfo.reason)), exccause); } ESP_LOGE(TAG, " PC: 0x%08" PRIX32, resetInfo.epc1); if (resetInfo.reason == REASON_EXCEPTION_RST) { diff --git a/esphome/components/esp8266/crash_handler.h b/esphome/components/esp8266/crash_handler.h index 2d42d07a7e..ea3683b834 100644 --- a/esphome/components/esp8266/crash_handler.h +++ b/esphome/components/esp8266/crash_handler.h @@ -11,7 +11,7 @@ namespace esphome::esp8266 { /// Log crash data if a crash was detected on previous boot. void crash_handler_log(); -/// Returns true if crash data was found this boot. +/// Returns true if the previous boot was a crash (exception, WDT, or soft WDT). bool crash_handler_has_data(); } // namespace esphome::esp8266