From 68147dba86331a4a172fef18f81e3664f1b7dbde Mon Sep 17 00:00:00 2001 From: liquidraver <504870+liquidraver@users.noreply.github.com> Date: Mon, 15 Jun 2026 11:19:51 +0200 Subject: [PATCH] lilygo debug trims and BT back to 8dBm --- zephcore/CMakeLists.txt | 13 +++++++++++++ zephcore/boards/common/debug_esp32.conf | 7 +++++++ zephcore/boards/common/nrf52_common.conf | 4 ++-- zephcore/boards/common/nrf54l_common.conf | 4 ++-- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/zephcore/CMakeLists.txt b/zephcore/CMakeLists.txt index 7a20abb..20f389b 100644 --- a/zephcore/CMakeLists.txt +++ b/zephcore/CMakeLists.txt @@ -349,6 +349,19 @@ if(ZEPHCORE_CONF_FILES) endif() endif() +# ESP32 debug builds: debug.conf is nRF/SEGGER-RTT shaped — on ESP32 RTT yields +# no output (no J-Link; logs go out the UART console) and the deferred-log DRAM +# overflows the RAM-tight classic ESP32. Append debug_esp32.conf LAST so it wins +# over debug.conf (console backend, smaller buffers, trimmed companion arrays). +if(ZEPHCORE_PLATFORM_CONF MATCHES "esp32_common" + AND EXTRA_CONF_FILE MATCHES "debug" AND NOT EXTRA_CONF_FILE MATCHES "debug_esp32") + set(ZEPHCORE_DEBUG_ESP32_CONF "${CMAKE_CURRENT_SOURCE_DIR}/boards/common/debug_esp32.conf") + if(EXISTS ${ZEPHCORE_DEBUG_ESP32_CONF}) + set(EXTRA_CONF_FILE "${EXTRA_CONF_FILE};${ZEPHCORE_DEBUG_ESP32_CONF}" CACHE STRING "" FORCE) + message(STATUS " ESP32 debug: appended debug_esp32.conf (no RTT, smaller buffers)") + endif() +endif() + # Auto-pair user-supplied EXTRA_CONF_FILE entries with same-named .overlay files. # This allows repeater.conf + repeater.overlay, prod.conf + prod.overlay, etc. if(EXTRA_CONF_FILE) diff --git a/zephcore/boards/common/debug_esp32.conf b/zephcore/boards/common/debug_esp32.conf index 4a5c0b0..90d3862 100644 --- a/zephcore/boards/common/debug_esp32.conf +++ b/zephcore/boards/common/debug_esp32.conf @@ -13,3 +13,10 @@ CONFIG_LOG_BACKEND_UART=y # Smaller deferred log buffer (8KB -> 2KB) for the RAM-tight classic ESP32. CONFIG_LOG_BUFFER_SIZE=2048 + +# Reclaim companion DRAM for the log infrastructure. The classic ESP32 companion +# is already ~97% DRAM at production sizes; debug logging needs ~11KB more than +# fits. Trim the contact/offline-queue arrays for debug builds only (production +# board.conf keeps 160/128). Ignored by the repeater role (no contacts there). +CONFIG_ZEPHCORE_MAX_CONTACTS=120 +CONFIG_ZEPHCORE_OFFLINE_QUEUE_SIZE=64 diff --git a/zephcore/boards/common/nrf52_common.conf b/zephcore/boards/common/nrf52_common.conf index 588cd07..1d59be0 100644 --- a/zephcore/boards/common/nrf52_common.conf +++ b/zephcore/boards/common/nrf52_common.conf @@ -19,8 +19,8 @@ CONFIG_CDC_ACM_SERIAL_INITIALIZE_AT_BOOT=n CONFIG_UART_LINE_CTRL=y # ========== BLE: nRF52-specific controller settings ========== -# TX power: +4 dBm (Zephyr open-source BLE controller) -CONFIG_BT_CTLR_TX_PWR_PLUS_4=y +# TX power: +8 dBm (max for nRF52840 high-power radio front-end) +CONFIG_BT_CTLR_TX_PWR_PLUS_8=y # Data Length Extension — controller-side max (host-side in zephcore_common.conf) CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 diff --git a/zephcore/boards/common/nrf54l_common.conf b/zephcore/boards/common/nrf54l_common.conf index 67e5989..0542227 100644 --- a/zephcore/boards/common/nrf54l_common.conf +++ b/zephcore/boards/common/nrf54l_common.conf @@ -14,8 +14,8 @@ CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL_REQ_LOW_FREQ=y # ========== BLE: nRF54L-specific controller settings ========== -# TX power: +4 dBm (same open-source BLE controller as nRF52) -CONFIG_BT_CTLR_TX_PWR_PLUS_4=y +# TX power: +8 dBm (max — same open-source BLE controller as nRF52) +CONFIG_BT_CTLR_TX_PWR_PLUS_8=y # Data Length Extension — controller-side max CONFIG_BT_CTLR_DATA_LENGTH_MAX=251