Bug fixes:
- Fix path_request_handler hops: use DestinationEntry._hops instead of
stale cached announce_packet.hops(). The cached packet retains its
original wire hops (pre-increment), but Python Transport.py explicitly
overwrites packet.hops from path_table after retrieval (line 2736).
This caused PATH_RESPONSE to report fewer hops than actual, making
the sender's expected_hops too low, which caused LRPROOF hop-count
validation to silently fail. (ROOT CAUSE of link timeout)
- Fix std::map::insert() no-op: erase before insert at 3 locations in
_announce_table. Unlike Python dict assignment, C++ map::insert()
does not overwrite existing keys. This prevented announce table
updates from taking effect. (Caused PATH-RESP delivery failure)
- Defer packet hash filtering for link table entries and LRPROOF
packets. Matching Python Transport behavior (line 1544), packets
belonging to active links are not added to the filter hashlist
until link transport processing determines it is our turn to
forward them. Prevents premature filtering that breaks link transport.
- Pass DestinationEntry and LinkEntry by reference instead of by value
to avoid stale copies and unnecessary allocations.
- Add link_table check before requesting paths for link_id destinations.
Link data packets are handled by link transport, not standard path
lookup, so spurious path requests are avoided.
- Add culling for _held_announces (60s timeout, cap 32) and
_boundary_local_addresses to prevent unbounded memory growth.
- TcpInterface: detect and log partial writes.
Root cause: heltec_V4_boundary build was missing -DRNS_USE_TLSF=1 and
-DRNS_USE_ALLOCATOR=1 flags, causing ALL C++ new/delete to use internal
SRAM (239KB) instead of the PSRAM-backed TLSF pool (~1.6MB). Transport
data structures consumed internal heap until WiFi driver could not
allocate RX buffers (ESP_ERR_NO_MEM).
Changes:
- platformio.ini: Add TLSF/allocator flags to heltec_V4_boundary env,
re-enable NDEBUG
- Transport.cpp: Add periodic culling of _path_requests (was unbounded,
grew one entry per unique destination forever). Cull entries older than
DESTINATION_TIMEOUT. Also cull _pending_local_path_requests for removed
interfaces, and fix missing .erase() (Python .pop() equivalent).
- RNode_Firmware.ino: Replace WiFi watchdog halt-serial with auto-reboot.
Add heap pressure check (reboot if free heap < 20KB). Increase WiFi
grace period from 5s to 15s. Remove orphaned boundary_done label.
- Remove -DNDEBUG to get LOG_TRACE output for WiFi disconnect investigation
- Add WiFi watchdog in main loop: detects WiFi loss, prints diagnostics
(WiFi status, RSSI, heap, TCP state, bridge stats), then halts serial
output after 5s grace period so operator can read the last log lines
- Device keeps running as LoRa repeater even when serial is frozen
- Reboot required to resume serial output
Performance optimizations:
- Move TLSF allocator pool to PSRAM (frees ~170KB internal SRAM)
- Raise TCP_IF_MAX_CLIENTS from 4 to 8 in BOUNDARY_MODE
- Raise path_table_maxsize from 48 to 128, persist from 16 to 32
- Add -DNDEBUG to boundary build: compiles out TRACE/DEBUG macros
- Log level defaults to LOG_VERBOSE when NDEBUG defined
- Serial baud 115200 -> 921600 in BOUNDARY_MODE (reduces CPU blocking)
Previous changes included in this commit:
- Comprehensive boundary filter with transitive whitelisting (7 checks)
- destination_table erase+insert fix (std::map::insert no-overwrite bug)
- Backbone-to-backbone routing guard in next-hop forwarding
- KISS serial output disabled for boundary mode
- flash.py updates for boundary mode support
Vendor microReticulum library with boundary mode transport fixes:
- Two-whitelist system gates backbone traffic (local addresses +
mentioned addresses from local devices)
- Allow control_hashes and local destinations through boundary filter
(fixes backbone→LoRa path discovery)
- Fix get_cached_packet() to call unpack() instead of update_hash()
(fixes empty destination_hash in path responses)
- LRPROOF Identity::recall null guard
- remaining_hops HEADER_1/BROADCAST fix for final-hop delivery
- PROOF packets excluded from boundary wrapping
- Iterator invalidation fix in transport table cleanup
- is_backbone flag replaces string matching for interface identification
Firmware changes:
- Set is_backbone(true) on backbone TCP interface
- Rename default TcpInterface name to BackboneInterface
- Update comments for dual-use TcpInterface (backbone + local AP)
- Use vendored lib/microReticulum instead of PlatformIO registry
- Erase flash prompt: asks user before flashing (in addition to --erase flag)
- 1200 baud reset: opens port at 1200 baud with DTR toggle to force
ESP32-S3 into download mode when device is stuck/unresponsive
- Re-scans serial ports after reset since port name may change
- Fix merged binary detection: check partition table magic (0xAA50) at
offset 0x8000 instead of bootloader magic (0xE9) at offset 0 — both
merged and app-only binaries start with 0xE9, causing app-only
binaries to be flashed at wrong address
- Fix boot_app0.bin discovery: handle versioned PlatformIO package
directories (e.g. framework-arduinoespressif32@3.20009.0)
- Add --erase flag: full flash erase before writing (recommended for
recovery from corrupted flash)
The merged binary (1,257,328 bytes) was below the 1.5MB size threshold,
causing it to be misidentified as app-only and flashed at 0x10000 instead
of 0x0. This corrupted the flash layout and bricked the device.
Now checks for ESP32 bootloader magic byte (0xE9) at offset 0 to reliably
distinguish merged binaries from app-only binaries, regardless of size.
Bundled esptool.py runs via sys.executable, which may be a Python
that lacks pyserial (e.g. miniconda). Reorder find_esptool() to
prefer pip-installed esptool first (handles its own deps), and
only fall back to bundled/PlatformIO scripts if pyserial is
importable. Give a clear error message if neither works.
- flash.py: standalone flash utility with serial port listing, merge-bin,
GitHub Releases download, and esptool flash support
- Display.h: hide LAN row when Local TCP disabled, show local TCP port
instead of backbone port
- README.md: comprehensive documentation — Quick Start with 3 flash options,
OLED display layout, interface modes, routing customizations, path table
fix, interface name uniqueness, hardware rationale (PSRAM/flash)
- Release/boot_app0.bin: bundled for flash.py standalone use
- .gitignore: exclude merged firmware binary build artifact
- Fix path table insert bug: C++ map::insert() silently fails when key
exists (unlike Python dict[key]=value). Changed to erase()+insert() so
updated paths (e.g. local TCP replacing stale LoRa) actually take effect.
- Add name parameter to TcpInterface constructor to give each instance a
unique identity hash, fixing map collision between backbone and local
TCP server interfaces.
- Set TCP interface bitrate to 10 Mbps (was 500 bps) so Transport
correctly prefers TCP paths over LoRa when both exist.
- Add PRG button hold >5s white screen indicator for config portal.
- Boundary mode cull_path_table: evict backbone paths first, preserving
local paths needed for inbound routing.
Bridges LoRa mesh and TCP/WiFi backbone networks using microReticulum.
Based on microReticulum_Firmware with boundary mode additions:
- BoundaryMode.h: State management and EEPROM persistence
- BoundaryConfig.h: WiFi captive portal for configuration
- TcpInterface.h: TCP backbone interface with HDLC framing
- Display.h: Custom OLED layout with network status indicators
- Transport/Identity library patches for embedded memory constraints