Commit Graph

11 Commits

Author SHA1 Message Date
James L
8ee8e86563 Add WiFi disconnect watchdog + re-enable debug logging
- 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
2026-02-25 10:23:36 -05:00
James L
50e392c45b flash.py: default to app-only flash, preserving settings 2026-02-23 22:49:45 -05:00
James L
5077aa3829 Boundary mode: performance optimizations + boundary filter
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
2026-02-23 22:43:54 -05:00
James L
5ed70dcca9 v1.0.0: Boundary mode with bidirectional LoRa↔TCP transport
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
2026-02-23 18:08:29 -05:00
James L
e741d1cd64 feat: add interactive erase prompt and 1200 baud bootloader reset option
- 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
2026-02-22 21:54:28 -05:00
James L
adc330dc15 fix: flash.py binary detection, boot_app0 discovery, add --erase flag
- 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)
2026-02-22 21:47:00 -05:00
James L
760e92f186 Fix flash address detection: use bootloader magic byte, not file size
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.
2026-02-22 21:24:06 -05:00
James L
8561e9d5ba Fix esptool discovery: prefer pip-installed over bundled
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.
2026-02-22 21:19:59 -05:00
James L
840f51da16 Add flash utility, display fixes, and comprehensive README
- 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
2026-02-22 20:58:44 -05:00
James L
1cbed7afdf Fix TCP receive: path table update + interface naming + 10Mbps bitrate
- 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.
2026-02-22 20:28:13 -05:00
James L
a746937390 Initial commit: RNodeTHV4 boundary mode firmware for Heltec V4
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
2026-02-22 18:25:20 -05:00