From 59dec09d751e64527d5f9fba58b458f090262fe5 Mon Sep 17 00:00:00 2001 From: mikecarper Date: Tue, 4 Aug 2026 23:16:03 -0700 Subject: [PATCH] Expand repeater neighbor tables to 254 --- build.sh | 47 ++++++++++++++++++++++++++++++++-------- docs/WiFi.md | 7 +++++- docs/cli_build_matrix.md | 4 ++++ 3 files changed, 48 insertions(+), 10 deletions(-) diff --git a/build.sh b/build.sh index 41621b8b..2d1e0b24 100755 --- a/build.sh +++ b/build.sh @@ -62,8 +62,9 @@ TAG_PREFIX_SENSOR="sensor" SUPPORTED_PLATFORM_PATTERN='ESP32_PLATFORM|NRF52_PLATFORM|STM32_PLATFORM|RP2040_PLATFORM' OUTPUT_DIR="out" ESP32_LORA_OTA_APP_LIMIT=$((0x150000 - 0x10000)) -ESP32_FULL_MAX_NEIGHBOURS=254 -ESP32_FULL_DRAM_LIMITED_MAX_NEIGHBOURS=50 +REPEATER_MAX_NEIGHBOURS=254 +DRAM_LIMITED_MAX_NEIGHBOURS=50 +ESP32_FULL_MAX_NEIGHBOURS=$REPEATER_MAX_NEIGHBOURS FALLBACK_VERSION_PREFIX="dev" FALLBACK_VERSION_DATE_FORMAT='+%Y-%m-%d-%H-%M' @@ -87,7 +88,7 @@ Commands: build-full-esp32-logging-firmwares: Build only feature-complete ESP32 profiles with up to 254 neighbors, logging, MQTT disabled, LoRa OTA, and expanded dual-OTA partitions. build-matching-firmwares : Build all firmwares for build targets containing the string given for . build-companion-firmwares: Build all companion firmwares for all build targets. - build-repeater-firmwares: Build all repeater firmwares for all build targets. + build-repeater-firmwares: Build all repeater firmwares with 254 neighbors, except DRAM-limited targets that retain 50. build-room-server-firmwares: Build all chat room server firmwares for all build targets. build-sensor-firmwares: Build all sensor firmwares for all build targets. @@ -1739,16 +1740,23 @@ requires_esp32_companion_full_ota_fallback() { esac } -requires_esp32_full_dram_limited_neighbors() { - # These classic ESP32 MQTT observers already declare a 50-entry table because - # their GPS, TLS, and OTA state leave little internal DRAM. FULL restores flash- - # limited features, but must not override that explicit RAM safety limit. +requires_dram_limited_neighbors() { + # These classic ESP32 MQTT observers keep their persistent neighbor and MQTT + # discovery tables in internal DRAM. Their GPS, TLS, and OTA state leave too + # little linker margin for the protocol maximum, even when PSRAM is present. case "${1,,}" in tbeam_sx1262_repeater_observer_mqtt|tbeam_sx1262_room_server_observer_mqtt|tbeam_sx1276_repeater_observer_mqtt|tbeam_sx1276_room_server_observer_mqtt) return 0 ;; *) return 1 ;; esac } +is_repeater_role_target() { + case "${1,,}" in + *repeater*|*repeatr*) return 0 ;; + *) return 1 ;; + esac +} + is_lora_ota_build() { local env_name=$1 local env_name_lc=${env_name,,} @@ -1904,8 +1912,8 @@ apply_esp32_full_size_profile() { # Keep ordinary builds at their board-defined neighbor capacity. FULL builds # normally use the largest table supported by the one-byte neighbor discovery # indexes. Explicitly DRAM-limited classic ESP32 observers retain 50 entries. - if requires_esp32_full_dram_limited_neighbors "$env_name"; then - max_neighbours=$ESP32_FULL_DRAM_LIMITED_MAX_NEIGHBOURS + if requires_dram_limited_neighbors "$env_name"; then + max_neighbours=$DRAM_LIMITED_MAX_NEIGHBOURS append_platformio_build_unflags "-DMAX_NEIGHBOURS=8" else append_platformio_build_unflags "-DMAX_NEIGHBOURS=50 -DMAX_NEIGHBOURS=8" @@ -1926,6 +1934,26 @@ apply_esp32_full_size_profile() { fi } +apply_repeater_neighbor_capacity() { + local env_name=$1 + local max_neighbours=$REPEATER_MAX_NEIGHBOURS + + if ! is_repeater_role_target "$env_name"; then + return 0 + fi + + # Repeater discovery uses one-byte indexes, so 254 is the largest usable + # table. Keep the two classic T-Beam MQTT observers at their measured safe + # capacity; their 254-entry builds leave less than 256 bytes of DRAM margin. + if requires_dram_limited_neighbors "$env_name"; then + max_neighbours=$DRAM_LIMITED_MAX_NEIGHBOURS + append_platformio_build_unflags "-DMAX_NEIGHBOURS=8 -DMAX_NEIGHBOURS=254" + else + append_platformio_build_unflags "-DMAX_NEIGHBOURS=8 -DMAX_NEIGHBOURS=50" + fi + export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DMAX_NEIGHBOURS=${max_neighbours}" +} + apply_lora_ota_no_external_sensors_profile() { local env_name=$1 @@ -2316,6 +2344,7 @@ build_firmware() { apply_lora_ota_override "$env_name" apply_esp32_lora_ota_size_profile "$env_name" apply_esp32_full_size_profile "$env_name" + apply_repeater_neighbor_capacity "$env_name" apply_lora_ota_no_external_sensors_profile "$env_name" apply_radio_overrides apply_firmware_profile_overrides diff --git a/docs/WiFi.md b/docs/WiFi.md index 35656e99..d4936255 100644 --- a/docs/WiFi.md +++ b/docs/WiFi.md @@ -335,10 +335,15 @@ role. | Standard | Uses the selected target's role. Ordinary portable ESP32 repeater/room-server artifacts omit WebConfig to fit the legacy app slot. Explicit MQTT and WiFi-companion targets still use WiFi. | | Logging | Enables USB/debug packet logging and disables the MQTT bridge. Logging output is not an MQTT uplink. | | MQTT | Builds explicit MQTT observer or WiFi-companion-MQTT targets with USB packet logging off. | -| FULL ESP32 | Uses the board's MQTT target with logging off, expanded dual-OTA partitions, up to 254 neighbors, LoRa OTA, and full-size ESP32 features such as WebConfig where supported. Classic T-Beam MQTT observers retain their 50-entry table because they have no PSRAM. | +| FULL ESP32 | Uses the board's MQTT target with logging off, expanded dual-OTA partitions, up to 254 neighbors, LoRa OTA, and full-size ESP32 features such as WebConfig where supported. Classic T-Beam MQTT observers retain their 50-entry table because their persistent discovery state exhausts internal DRAM at 254. | | FULL ESP32 logging | Uses the board's non-MQTT target with debug and packet logging enabled, expanded dual-OTA partitions, up to 254 neighbors, and LoRa OTA. | | LoRa-OTA no-external-sensors | A lean repeater image with no MQTT; ESP32 builds retain the compact on-demand browser WiFi uploader and 254 neighbors. | +All repeater profiles use the full 254-entry neighbor table, including standard, +logging, bridge, and LoRa-OTA builds on every supported platform. The classic +T-Beam SX1262 and SX1276 MQTT observer repeaters retain 50 entries because their +persistent MQTT discovery state leaves insufficient internal-DRAM margin at 254. + The interactive Option 1 **FULL everything** choice selects the FULL logging profile: logging is enabled and MQTT is disabled. The standalone FULL ESP32 profile and Profile 4 of the five-profile matrix use the matching MQTT target diff --git a/docs/cli_build_matrix.md b/docs/cli_build_matrix.md index c03b27f6..9555b096 100644 --- a/docs/cli_build_matrix.md +++ b/docs/cli_build_matrix.md @@ -27,6 +27,10 @@ A command belonging to a different role is not considered a profile cut. For example, adding FULL features to a sensor does not turn it into a repeater administrator. +Repeater profiles use 254 neighbor entries across supported platforms. The +classic T-Beam SX1262 and SX1276 MQTT observer repeaters are the exception and +retain 50 because their MQTT discovery tables are constrained by internal DRAM. + ## Profile matrix | Build/profile | Command availability |