From b373c973773d3d3fcf95f5ce0e4add94b07f31a3 Mon Sep 17 00:00:00 2001 From: David Montero Crespo Date: Fri, 8 May 2026 16:29:12 -0300 Subject: [PATCH] fix(esp32): suppress ESP-IDF info logs and switch BLE stack to Bluedroid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two reports rolled into one sdkconfig change: 1. Beta testers reported "weird serial output" across DHT22, Servo+Pot, Joystick, WiFi×2, and DualADC examples. The user's Serial.print lines came interleaved with internal ESP-IDF chatter: I (53306) gpio: GPIO[4]| InputEn: 1| OutputEn: 0| ... I (10626) phy_init: phy_version 4791,2c4672b,... sdkconfig.defaults didn't pin a default log level so it inherited CONFIG_LOG_DEFAULT_LEVEL_INFO. Set WARN (level 2) so only warnings and errors leak into the user's serial output. Sketches can still esp_log_level_set() per tag at runtime if they want verbose. 2. BLE Advertise example failed to compile. sdkconfig had NimBLE enabled, but arduino-esp32 2.0.17's BLEDevice.h targets Bluedroid. Switch the stack: enable BT_BLUEDROID + BTDM_CTRL_MODE_BR_EDR_BLE + BT_BLE so the standard arduino-esp32 BLE library compiles. Sketches that explicitly include NimBLEDevice.h will not compile under this config — that's a smaller minority than the BLEDevice.h users. The runtime side of BLE still depends on stubs in the qemu-lcgamboa fork; this only fixes the compile path. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../services/esp-idf-template/sdkconfig.defaults | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/backend/app/services/esp-idf-template/sdkconfig.defaults b/backend/app/services/esp-idf-template/sdkconfig.defaults index ace8c593..9cc662ae 100644 --- a/backend/app/services/esp-idf-template/sdkconfig.defaults +++ b/backend/app/services/esp-idf-template/sdkconfig.defaults @@ -9,6 +9,12 @@ CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y # Bootloader — minimal logging to speed up QEMU boot CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y +# Default log level — WARN so users see only their Serial.print + real warnings. +# Internal ESP-IDF info-level chatter (gpio:, wifi:, phy:) is suppressed. +# Override per-tag with esp_log_level_set() at runtime if needed. +CONFIG_LOG_DEFAULT_LEVEL_WARN=y +CONFIG_LOG_DEFAULT_LEVEL=2 + # Watchdogs — disable for QEMU (timing is not real-time) CONFIG_ESP_TASK_WDT=n CONFIG_ESP_INT_WDT=n @@ -38,6 +44,10 @@ CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 # Enable C++ exceptions (some Arduino libraries require it) CONFIG_COMPILER_CXX_EXCEPTIONS=y -# Bluetooth for BLE examples +# Bluetooth for BLE examples — Bluedroid stack (the default arduino-esp32 +# BLEDevice.h library targets Bluedroid, not NimBLE). NimBLE-based sketches +# (NimBLEDevice.h) will not compile under this config; flip stacks if needed. CONFIG_BT_ENABLED=y -CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_BLUEDROID_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_BLE=y +CONFIG_BT_BLE_ENABLED=y