Skip to content

firmware: ESP-NOW range quick-wins + per-peer RSSI (2026.06.08.01) - #43

Merged
avillach merged 1 commit into
mainfrom
firmware/espnow-range-quickwins
Jun 8, 2026
Merged

avillach merged 1 commit into
mainfrom
firmware/espnow-range-quickwins

Conversation

@avillach

@avillach avillach commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

⚠️ Do not merge until validated on a bench unit — a green main build auto-publishes the OTA manifest to all 6 boats (CI firmware-edge.yml, main-only step), so merge = fleet-wide auto-OTA. This PR's job is the compile check only.

Why

Field test on a football field: ESP-NOW peers vanished past ~8 m (worse in the rain — wet grass is brutal at 2.4 GHz). Code read ruled out a software RSSI gate (meshOnReceive never looked at RSSI; peer expiry is 30 s), so packets genuinely weren't arriving → RF/PHY + reliability. Three low-risk fixes, none touching the ESP-NOW wire format:

  1. Disable modem power-save (WiFi.setSleep(false)) in meshInit — default STA power-save duty-cycles the RX so it sleeps through 2 Hz broadcasts; at the link margin that looks like a short-range cliff. Reasserted in connectWiFi after the upload window too.
  2. Pin max TX power (WiFi.setTxPower(WIFI_POWER_19_5dBm)) in meshInit — it was only set during the WiFi upload window, so mesh-only operation ran at the default.
  3. Per-peer RX RSSI telemetry — capture info->rx_ctrl->rssi in meshOnReceive into a new in-memory MeshPeerState.last_rssi (not a wire field) and print it in the mesh command (rssi=NdBm). Lets you read RSSI-vs-distance and distinguish a real sensitivity/range problem from a logic one.

FW_VERSION → 2026.06.08.01.

Validation plan (before merge)

  1. Flash one bench unit (scripts/flash-edge.sh), run mesh — confirm rssi=NdBm now appears per peer.
  2. Walk a peer out and watch RSSI vs distance; confirm range improves vs the pre-fix 8 m.
  3. Only then merge to roll out to the fleet via auto-OTA.

🤖 Generated with Claude Code

Field test: mesh peers vanished past ~8 m (worse in the rain). Three
low-risk fixes to the always-on ESP-NOW mesh, none touching wire format:

1. Disable modem power-save in meshInit (WiFi.setSleep(false)). The
   default STA power-save duty-cycles the receiver, so it sleeps through
   2 Hz broadcasts — at the link margin that reads as a sharp short-range
   cliff. Also reasserted after the WiFi upload window in connectWiFi so
   the mesh stays awake once an upload ends.
2. Pin max TX power in meshInit (WiFi.setTxPower(19.5dBm)). It was only
   set inside connectWiFi (upload window); mesh-only operation ran at the
   post-mode default.
3. Per-peer RX RSSI telemetry: capture info->rx_ctrl->rssi in
   meshOnReceive into a new local MeshPeerState.last_rssi (in-memory
   only, not a wire field), and surface it in the `mesh` command
   (rssi=NdBm). Lets us read RSSI-vs-distance and tell a real range/
   sensitivity problem from a logic one.

Validate on one bench unit (mesh RSSI readout + range) BEFORE merging —
a main merge auto-OTAs the whole fleet via the CI manifest fan-out.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@avillach
avillach merged commit cd05719 into main Jun 8, 2026
1 check passed
@avillach
avillach deleted the firmware/espnow-range-quickwins branch June 8, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant