acw: airtime-scale jitter caps, companion surroundings awareness

- flood retransmit jitter now capped at min(2000ms, 6·airtime) instead of
  fixed 2000ms — spreads tighter at SF7, unchanged at SF8
- reactive per-dupe backoff cap now min(2000ms, 12·airtime), keeps
  semantic of "push past ~12 relay slots"
- contention ring 16 → 24 for 50-neighbor hilltops
- companions passively track heard floods (warms EMA without forwarding)
  and spread their own TX by up to min(1000ms, 3·airtime), hopefully
  fixing repeaters missing companion's first transmission

config cleanup:
- move BLE TX buffer bumps (ACL_TX=12 etc.) from zephcore_common.conf to
  esp32_common.conf — the Espressif blob needs them, nRF doesn't, and
  the bumps were overflowing nRF52840 RAM
- remove CONFIG_ZEPHCORE_MAX_CONTACTS=510 overrides from 5 nRF52840
  companion boards; Kconfig default of 350 fits with comfortable margin
  (wio prod: 91% → 79% RAM)
This commit is contained in:
liquidraver committed 2026-04-17 10:24:12 +02:00
1 parent cba81af196
commit ba4b86752d
17 files changed
+1909 -1864

No files matched your search

+9
View File
@@ -15,6 +15,15 @@ CONFIG_BT_PRIVACY=y
# BLE thread stacks — ESP32 software BLE controller needs larger stacks
CONFIG_BT_TX_PROCESSOR_STACK_SIZE=2048
# BLE TX buffers — the Espressif BLE controller blob bursts more aggressively
# than the nRF softdevice and will deadlock the system workqueue if ACL TX
# buffers run dry (bt_hci_cmd_alloc(K_FOREVER) blocks the cooperative syswq).
# EVT_RX must strictly exceed ACL_TX (enforced by BUILD_ASSERT in buf.h).
CONFIG_BT_BUF_ACL_TX_COUNT=12
CONFIG_BT_L2CAP_TX_BUF_COUNT=12
CONFIG_BT_CONN_TX_MAX=12
CONFIG_BT_BUF_EVT_RX_COUNT=14
# ========== Heap ==========
# ESP32 BLE stack requires larger heap (override zephcore_common 2KB default)
CONFIG_HEAP_MEM_POOL_SIZE=32768
+22 -22
View File
@@ -1,22 +1,22 @@
# Production Config - Common to ALL boards (Companion & Repeater)
# Build: west build -b <board> zephcore --pristine -- \
# -DEXTRA_CONF_FILE="boards/common/prod.conf"
#
# Disables logging for smaller binary and lower power consumption.
# USB CDC still works for CLI commands on repeaters.
# Disable logging subsystem (saves ~62KB flash, ~2-5mA power)
CONFIG_LOG=n
# Disable asserts (saves flash, removes CMake warning)
CONFIG_ASSERT=n
# Disable SEGGER RTT (saves ~4KB RAM ring buffer + init code)
CONFIG_USE_SEGGER_RTT=n
# Disable thread name strings (saves flash — only useful for debug)
CONFIG_THREAD_NAME=n
# Max contacts: Kconfig default is 350 (safe for 100KB ExtraFS).
# Do NOT set here — EXTRA_CONF_FILE overrides board.conf, which would
# prevent boards with more storage (Wio QSPI=510) from raising the limit.
# Production Config - Common to ALL boards (Companion & Repeater)
# Build: west build -b <board> zephcore --pristine -- \
# -DEXTRA_CONF_FILE="boards/common/prod.conf"
#
# Disables logging for smaller binary and lower power consumption.
# USB CDC still works for CLI commands on repeaters.
# Disable logging subsystem (saves ~62KB flash, ~2-5mA power)
CONFIG_LOG=n
# Disable asserts (saves flash, removes CMake warning)
CONFIG_ASSERT=n
# Disable SEGGER RTT (saves ~4KB RAM ring buffer + init code)
CONFIG_USE_SEGGER_RTT=n
# Disable thread name strings (saves flash — only useful for debug)
CONFIG_THREAD_NAME=n
# Max contacts: Kconfig default is 350 — fits nRF52840 RAM with ~10% headroom
# and is safe for 100KB ExtraFS. RAM-limited boards (xiao_nrf54l15=450,
# xiao_esp32c3=300) override in their own board.conf. Do not set here.
+5 -6
View File
@@ -93,12 +93,11 @@ CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_L2CAP_TX_MTU=247
# BLE TX buffers — default 3 is too low, causes system workqueue deadlock
# when BLE activity bursts (DLE + param update + ATT) exhaust all buffers
# and bt_hci_cmd_alloc(K_FOREVER) blocks the cooperative syswq forever.
CONFIG_BT_BUF_ACL_TX_COUNT=12
CONFIG_BT_L2CAP_TX_BUF_COUNT=12
CONFIG_BT_CONN_TX_MAX=12
# BLE TX buffers — platform-specific. ESP32 gets a large bump in
# esp32_common.conf to prevent syswq deadlock during BLE bursts (DLE +
# param update + ATT exhausting buffers and bt_hci_cmd_alloc(K_FOREVER)
# blocking the cooperative syswq). nRF52 uses Zephyr defaults — RAM is
# tight on nRF52840 and the nRF controller rarely deadlocks.
# BLE RX thread stack — default 1200 too small for ATT handlers + logging + asserts
CONFIG_BT_RX_STACK_SIZE=2048
@@ -10,5 +10,3 @@ CONFIG_ZEPHCORE_BOARD_NAME="SenseCAP Solar"
CONFIG_BT_DIS_MODEL_NUMBER_STR="Seeed SenseCAP Solar"
CONFIG_ZEPHCORE_SD_FWID=0x0123
CONFIG_ZEPHCORE_MAX_CONTACTS=510
@@ -1,30 +1,27 @@
# Elecrow ThinkNode M1 (nRF52840 + SX1262 + SSD1681 EPD)
# Board-specific configuration
#
# Hardware:
# - nRF52840 SoC, SX1262 LoRa (22dBm), 1.54" SSD1681 e-paper (200x200)
# - GPS module on UART0, MX25R1635F 2MB QSPI flash
# - Battery ADC on AIN2 (P0.04), 150K+150K divider
# - Buzzer on P0.06, two buttons, GPS hardware switch
# - LEDs: GREEN=P1.04, BLUE=P0.14
# Board identification (matches Arduino MeshCore variant name)
CONFIG_ZEPHCORE_BOARD_NAME="ThinkNode M1"
# Device Information Service model name
CONFIG_BT_DIS_MODEL_NUMBER_STR="Elecrow ThinkNode-M1"
# SoftDevice firmware ID (ThinkNode M1 bootloader uses S140 v6)
CONFIG_ZEPHCORE_SD_FWID=0x00B6
# Contacts — QSPI (2MB) provides ample storage for more contacts
CONFIG_ZEPHCORE_MAX_CONTACTS=510
# ========== RAM budget ==========
# SSD1681 200x200 CFB framebuffer needs 5000 bytes from k_malloc.
# Default heap (2048) is sized for SSD1306 128x64 (1024 bytes).
CONFIG_HEAP_MEM_POOL_SIZE=6144
# Shrink RTT buffer to free RAM (4096 → 1024, saves 3KB).
# Only used during J-Link debugging, 1KB is Zephyr's default.
CONFIG_SEGGER_RTT_BUFFER_SIZE_UP=1024
# Elecrow ThinkNode M1 (nRF52840 + SX1262 + SSD1681 EPD)
# Board-specific configuration
#
# Hardware:
# - nRF52840 SoC, SX1262 LoRa (22dBm), 1.54" SSD1681 e-paper (200x200)
# - GPS module on UART0, MX25R1635F 2MB QSPI flash
# - Battery ADC on AIN2 (P0.04), 150K+150K divider
# - Buzzer on P0.06, two buttons, GPS hardware switch
# - LEDs: GREEN=P1.04, BLUE=P0.14
# Board identification (matches Arduino MeshCore variant name)
CONFIG_ZEPHCORE_BOARD_NAME="ThinkNode M1"
# Device Information Service model name
CONFIG_BT_DIS_MODEL_NUMBER_STR="Elecrow ThinkNode-M1"
# SoftDevice firmware ID (ThinkNode M1 bootloader uses S140 v6)
CONFIG_ZEPHCORE_SD_FWID=0x00B6
# ========== RAM budget ==========
# SSD1681 200x200 CFB framebuffer needs 5000 bytes from k_malloc.
# Default heap (2048) is sized for SSD1306 128x64 (1024 bytes).
CONFIG_HEAP_MEM_POOL_SIZE=6144
# Shrink RTT buffer to free RAM (4096 → 1024, saves 3KB).
# Only used during J-Link debugging, 1KB is Zephyr's default.
CONFIG_SEGGER_RTT_BUFFER_SIZE_UP=1024
@@ -18,6 +18,3 @@ CONFIG_BT_DIS_MODEL_NUMBER_STR="Elecrow ThinkNode-M6"
# SoftDevice firmware ID (ThinkNode M6 bootloader uses S140 v6, same as M1/M3)
CONFIG_ZEPHCORE_SD_FWID=0x00B6
# Contacts — QSPI (2MB) provides ample storage for more contacts
CONFIG_ZEPHCORE_MAX_CONTACTS=510
@@ -1,22 +1,19 @@
# Wio Tracker L1 (nRF52840 + SX1262)
# Board-specific configuration - pins and unique features only
#
# Hardware:
# - SX1262 LoRa on SPI0 (P1.14 CS, P1.07 RST, P1.10 BUSY, P0.07 DIO1, P1.08 RXEN)
# - L76KB GPS on UART0 (P0.26/P0.27)
# - P25Q16H 2MB QSPI flash
# - Battery ADC on AIN7 (P0.31), enable on P0.04
# - SH1106 OLED on I2C0 (P0.05/P0.06, addr 0x3D)
# - Joystick + user button + buzzer (P1.00)
# Board identification (matches Arduino variant name)
CONFIG_ZEPHCORE_BOARD_NAME="Wio Tracker L1"
# Device Information Service model name
CONFIG_BT_DIS_MODEL_NUMBER_STR="Wio Tracker L1"
# SoftDevice firmware ID (s140 v7.3.0 — Seeed bootloader)
CONFIG_ZEPHCORE_SD_FWID=0x0123
# Contacts — QSPI (2MB) provides ample storage for more contacts
CONFIG_ZEPHCORE_MAX_CONTACTS=510
# Wio Tracker L1 (nRF52840 + SX1262)
# Board-specific configuration - pins and unique features only
#
# Hardware:
# - SX1262 LoRa on SPI0 (P1.14 CS, P1.07 RST, P1.10 BUSY, P0.07 DIO1, P1.08 RXEN)
# - L76KB GPS on UART0 (P0.26/P0.27)
# - P25Q16H 2MB QSPI flash
# - Battery ADC on AIN7 (P0.31), enable on P0.04
# - SH1106 OLED on I2C0 (P0.05/P0.06, addr 0x3D)
# - Joystick + user button + buzzer (P1.00)
# Board identification (matches Arduino variant name)
CONFIG_ZEPHCORE_BOARD_NAME="Wio Tracker L1"
# Device Information Service model name
CONFIG_BT_DIS_MODEL_NUMBER_STR="Wio Tracker L1"
# SoftDevice firmware ID (s140 v7.3.0 — Seeed bootloader)
CONFIG_ZEPHCORE_SD_FWID=0x0123
@@ -7,8 +7,6 @@ CONFIG_BT_DIS_MODEL_NUMBER_STR="Seeed XIAO nRF52840"
CONFIG_ZEPHCORE_SD_FWID=0x0123
CONFIG_ZEPHCORE_MAX_CONTACTS=510
# Default debug (logging.conf) sends LOG_* to RTT only. Plain XIAO is usually
# flashed/debugged over USB without an SWD J-Link — enable UART backend so
# LOG_* appears on the CDC ACM serial port (same as zephyr,console).