From 10c9a5ed5c1e81a9a2304fe039c8913b0a5cd655 Mon Sep 17 00:00:00 2001 From: crispyberry Date: Thu, 19 Feb 2026 15:16:55 +0800 Subject: [PATCH] fix: prevent device hang when no USB host connected Switch primary console from USB Serial/JTAG to UART so log output doesn't block when the device is powered by a wall charger. USB Serial/JTAG remains available as secondary console for debugging. Closes #60 Co-Authored-By: Claude Opus 4.6 --- main/cli/serial_cli.c | 8 ++++---- sdkconfig.defaults.esp32s3 | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/main/cli/serial_cli.c b/main/cli/serial_cli.c index 584caad..a1d6a65 100644 --- a/main/cli/serial_cli.c +++ b/main/cli/serial_cli.c @@ -552,11 +552,11 @@ esp_err_t serial_cli_init(void) repl_config.prompt = "mimi> "; repl_config.max_cmdline_length = 256; - /* USB Serial JTAG */ - esp_console_dev_usb_serial_jtag_config_t hw_config = - ESP_CONSOLE_DEV_USB_SERIAL_JTAG_CONFIG_DEFAULT(); + /* UART console (primary), USB Serial/JTAG available as secondary */ + esp_console_dev_uart_config_t hw_config = + ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT(); - ESP_ERROR_CHECK(esp_console_new_repl_usb_serial_jtag(&hw_config, &repl_config, &repl)); + ESP_ERROR_CHECK(esp_console_new_repl_uart(&hw_config, &repl_config, &repl)); /* Register commands */ esp_console_register_help_command(); diff --git a/sdkconfig.defaults.esp32s3 b/sdkconfig.defaults.esp32s3 index f85efab..4774cd9 100644 --- a/sdkconfig.defaults.esp32s3 +++ b/sdkconfig.defaults.esp32s3 @@ -35,5 +35,7 @@ CONFIG_HTTPD_WS_SUPPORT=y CONFIG_PARTITION_TABLE_CUSTOM=y CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" -# Console/UART for CLI -CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y +# Console: UART primary (non-blocking), USB Serial/JTAG secondary +# Prevents device hang when no USB host is connected (issue #60) +CONFIG_ESP_CONSOLE_UART_DEFAULT=y +CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG=y