4#ifdef USE_RP2_CRASH_HANDLER
13#if defined(USE_RP2_CRASH_HANDLER) && defined(USE_LOGGER_UART_SELECTION_USB_CDC)
18 this->
set_interval(500, [opened_before =
false]()
mutable {
19 const bool opened = Serial.dtr();
20 if (opened && !opened_before)
22 opened_before = opened;
29 switch (this->
uart_) {
45 ESP_LOGI(TAG,
"Log initialized");
47#if defined(USE_RP2_CRASH_HANDLER) && !defined(USE_LOGGER_UART_SELECTION_USB_CDC)
53 switch (this->
uart_) {
55 return LOG_STR(
"UART0");
57 return LOG_STR(
"UART1");
58#ifdef USE_LOGGER_USB_CDC
60 return LOG_STR(
"USB_CDC");
63 return LOG_STR(
"UNKNOWN");
67#ifdef USE_CRASH_HANDLER
void set_interval(const char *name, uint32_t interval, std::function< void()> &&f)
Set an interval function with a const char* name.
const LogString * get_uart_selection_()
void pre_setup()
Set up this component.
bool crash_log_pending()
Whether a crash record from before this boot is waiting to be reported.
void log_crash_to_client()
Log the previous crash for a client that just subscribed to the logs.
ESPHOME_LOG_TAG(TAG, "logger")
bool crash_handler_has_data()
Returns true if crash data was found this boot, reading it first if needed.
void crash_handler_log()
Log crash data if a crash was detected on previous boot.