microReticulumTbeam/exercises/205_sustained_link/README.md

84 lines
3.3 KiB
Markdown
Raw Normal View History

# Introduction
Exercise 205 builds on Exercise 204 established identities and LoRa Link traffic. It keeps the same identity, announce, RTC/GPS, OLED, and machine-parseable TX/RX event style, but changes the link policy for longer multi-unit field runs.
All seven units, `AMY` through `GUY`, are supported. Every unit runs in transport mode and every unit attempts to open a Link to any other unit that announces.
# Behavior
The announce protocol is intentionally the same as the last Exercise 204 protocol:
```text
startup announce: immediate
second announce: ANNOUNCEMENT_2 seconds after startup, default 300
repeat announce: ANNOUNCEMENT_REPEAT seconds after that, default 3600
```
There is no simulated BOB/CY physical block in this exercise. `SIM_PHY_ENVELOPE` remains enabled so log records can report the physical sender slot, but `SIM_PHY_BLOCK_BOB_CY=0` for every environment.
Exercise 205 does not intentionally tear down Links after a message count. A Link is reused while it remains active. The app-level stale threshold is 12 hours. If a Link becomes stale or closes, the unit clears local state and attempts to recreate the outbound Link.
Each unit sends one Link message per active peer per minute at its allocated second:
```text
AMY: 04 BOB: 08 CY: 12 DAN: 16
ED: 20 FLO: 24 GUY: 28
```
The message payload uses board IDs and includes an iteration counter:
```text
BOB says Hi to CY iter=0
```
The outbound Link retry budget is:
```text
retry interval: 60 seconds
failure window: 3 minutes
max attempts: 3
```
After three failed attempts within the window, the peer is marked failed and no more Link requests are sent to that peer until another announce for that peer is received. A fresh announce resets the retry budget and starts over.
# Clock Gate
The unit checks the RTC and `/ex205/clock.txt` on the SD card. If the saved discipline marker is less than 24 hours old according to the RTC, LoRa/microReticulum starts immediately. If not, the OLED shows `Take outside` and serial prints `gps_gate ...` until GPS UTC/fix is available.
# Log Events
Substantive events retain the Exercise 204 style so multi-unit log parsing can correlate TX and RX:
```text
TX ANNOUNCE: Bob
RX ANNOUNCE: label=Cy hash=<destination hash> phy=Cy(2)
TX LINKREQUEST: opening link to Cy slot=19 attempt=1/3
LINK ACTIVE: initiator link established to Cy hash=<link hash>
RX LINK: inbound link established hash=<link hash> phy=Bob(1)
TX LINK: BOB says Hi to CY iter=0 via=outbound hash=<link hash> status=2
RX LINK: CY says Hi to BOB iter=0 | phy=Cy(2) RSSI=... SNR=...
LINK RETRY: no establishment after 60000 ms; retrying Cy attempts=1/3
LINK FAILED: peer=Cy attempts=3 window_ms=... waiting_for_announce=1
LINK RETRY RESET: fresh announce from Cy
```
Reticulum library logging is set to warning level in this exercise. Heap, path-store, entries, and byte-count diagnostics are intentionally suppressed so serial logs remain focused on field-test results.
# Build, Upload, And Monitor
```bash
source /home/jlpoole/rnsenv/bin/activate
cd /usr/local/src/microreticulum/microReticulumTbeam
pio run -d exercises/205_sustained_link -e amy -e bob -e cy -e dan -e ed -e flo -e guy
for env in amy bob cy dan ed flo guy
do
pio run -d exercises/205_sustained_link -e "${env}" -t upload
done
```
Monitor one unit:
```bash
pio device monitor -d exercises/205_sustained_link -e bob
```