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#if defined(USE_LOGGER_UART_SELECTION_USB_CDC)
33#ifdef USE_LOGGER_UART_SELECTION_UART1
34 SerialUART &uart = Serial2;
36 SerialUART &uart = Serial1;
38#ifdef USE_LOGGER_CONSOLE
40 uart.setFIFOSize(ESPHOME_LOGGER_CONSOLE_RX_BUFFER_SIZE);
47 ESP_LOGI(TAG,
"Log initialized");
49#if defined(USE_RP2_CRASH_HANDLER) && !defined(USE_LOGGER_UART_SELECTION_USB_CDC)
54#ifdef USE_CRASH_HANDLER
void set_interval(const char *name, uint32_t interval, SchedulerCallback &&f)
Set an interval function with a const char* name.
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.