Jason Huebert (jh185422)andgithub-actions[bot] e4d3e8964b feat: add ham mode with per-packet TX power and station ID (#16)
* feat: add ham mode with per-packet TX power and station ID

Adapted from NebraskaMesh/MeshCore-Ham by KF0WXX and the Nebraska Mesh community (MIT licensed), whose original implementation is commit 6e716038. The public/private classification model, hardcoded Public key and hashtag derivation, activation gate, per-packet TX power hook, command names and counters come from that work. This is a rewrite into the repeater-filter architecture, not a copy.

Adds a fork-owned HamMode to the repeater. Publicly readable traffic uses the new 'ham tx' power; encrypted traffic keeps using 'set tx'. The gate requires ham on, a callsign, and that callsign as a whole word in the node name. A timer-driven zero-hop advert identifies the station at least every 10 minutes. Settings persist in /ham_cfg with a CRC-16 and staged save; a load failure keeps ham mode off. Default off, with the upstream path untouched when disabled. The only upstream edit is the virtual Dispatcher::onBeforeTransmit() hook.

Includes HAM.md, the README feature section, AGENTS.md updates, the native_ham_mode and _san suites, and the promotion-gate entry.

* docs: correct fleet ACK power and widen antenna-gain warning

Fleet ACKs are GRP_TXT datagrams encrypted with the private fleet PSK, not PAYLOAD_TYPE_ACK, so they use set tx like all other fleet traffic. The previous HAM.md text copied the source plan's incorrect claim that they were public ACKs. Add a test that pins fleet ACK classification and power to private.

Add links to the NebraskaMesh/MeshCore-Ham repository and commit 6e716038 in the acknowledgement, and state that a high-gain antenna can exceed radiated power limits on any board, not only amplified ones like G2 and G3.

* fix: address adversarial review findings in ham mode

Fix a stale applied-power cache: the set tx CLI is handled by CommonRadioPrefs, which writes the radio directly and never reaches MyMesh::setTxPower(). Dispatch that command explicitly so ham.noteRadioPower() resyncs the cache, preventing a public packet from going out at private power and avoiding a redundant radio write when ham is off.

Fix three CLI gaps: channel add and remove with no name returned no reply at all; a quoted or tabbed callsign was accepted despite the one-word rule; an unknown channel subcommand ignored trailing tokens. Factor the one-word check into a shared helper and add regression tests for all three plus the set tx cache sequence.

Correct two HAM.md inaccuracies: the admin check lives in MyMesh::onPeerDataRecv(), and the ID countdown is 0s until the first advert is queued then about 598s, not 300s.

* fix: block ham transmissions on unconfirmed power changes

Honor radio power errors in the per-packet hook, including restoration after disable. Check the actual advert name budget, accept zero as a valid ID deadline, and validate persisted one-word settings. Cover radio vetoes and use independent wire fixtures for the channel checks.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-22 22:01:52 -06:00
2026-04-28 21:39:34 +10:00
2026-09-20 15:25:18 -04:00
2026-10-15 19:42:40 +11:00
2025-01-13 14:07:48 +11:00
2025-06-05 20:35:40 +12:00
2026-11-12 13:51:02 -06:00
2026-02-03 13:47:43 +13:00
2026-03-23 14:26:56 +01:00
2025-01-20 10:20:42 +11:00
2025-01-25 23:09:09 +11:00
2026-03-31 00:51:15 +13:00
2026-06-05 21:25:25 +12:00

MeshCore — Repeater Firmware with a Remote-Configurable Packet Filter

This is a feature fork of MeshCore. It tracks upstream main releases and adds ten repeater-focused capabilities on top of stock firmware. Everything else — supported boards, clients, protocols, build system — is identical to upstream; see the upstream README for the general project, hardware support, and getting-started guide.

What this fork adds

📡 Packet filter

A remote-configurable drop-rule engine for the simple_repeater firmware. Rules match on packet type, route type, region, hop count, channel, and — on decrypted payloads — channel identity and sender/text patterns. Rules are managed over the repeater CLI, locally via serial or remotely over the mesh by an authenticated admin. No rebuild, no physical access.

Independently of the rules, flood-route adverts can be rate-limited per originating node: each node's advert is forwarded at most once per window (up to 30 days), taming advert storms on busy channels while every node stays discoverable.

→ Full guide, including the complete predicate reference and CLI commands: FILTER.md

🔋 Battery gate

A configurable low-battery cut-off: below a set voltage the repeater stops forwarding (but stays reachable and keeps advertising); when the battery recovers it resumes automatically. Debounce + hysteresis keep it from flapping, and the admin can check voltage and tune thresholds over the mesh.

→ Full guide: BATTERY.md

⚡ Power profile

Three runtime knobs take an idle repeater from ~54 mA to ~4 mA: ESP32 light sleep (powersaving), the radio's receive duty cycle (radio.rxps) and the CPU clock (cpu.freq). All are persisted and revertible from the CLI — the duty-cycle levels are chosen so the datasheet's preamble-capture guarantee still holds, so the savings do not quietly turn into lost packets.

Credit where it is due: powersaving is upstream MeshCore, and the RXPS duty-cycle subsystem is ported from EasySkyMesh (IoTThinks/MeshCore, PowerSaving-v18 + the SX1262 post-preamble-timer fix from Dev-PS18, PR #27 by Dom4n); this fork added the cpu.freq setting, the port and the guide.

→ Full guide: POWER.md

📻 Second radio preset

One transceiver, two LoRa presets. The repeater keeps its normal preset as the protected home channel and visits a second preset for short windows, so it can repeat adverts and group flood traffic between two nearby networks — or simply listen to a second preset. Direct messages, ACKs, path returns and traces never cross, replies go back on the preset the request arrived on, and the existing packet filter applies to both. Off by default: with radio2 off the node behaves like stock firmware.

→ Full guide, including the policy recipes, CLI reference and tradeoffs: RADIO2.md

📢 Ham mode (licensed amateur operators)

For licensed operators who want more range on traffic anyone can read. With ham mode on, publicly readable traffic (the Public channel, the #hashtag channels you list, adverts, ACKs and traces) goes out at the power you set with ham tx, while encrypted traffic keeps using the normal set tx power. The node schedules a zero-hop callsign advert if it has not scheduled a local advert in the last 10 minutes. Actual air time depends on the radio and queue. Packets themselves are unchanged, so stock nodes and apps are unaffected. Off by default: with ham mode off the node behaves like stock firmware.

Adapted from NebraskaMesh/MeshCore-Ham by KF0WXX for the Nebraska Mesh community; see the Acknowledgements in HAM.md.

→ Full guide, including the classification table, setup and the legal notes: HAM.md

🕒 Mesh clock sync

A repeater with no GPS, NTP, or battery-backed RTC can estimate UTC from signed adverts it hears. When enabled (clock mesh on), it waits for a batch of distinct sources to agree on the median before stepping the RTC; it is off by default. Advert timestamps earlier than the firmware build timestamp are rejected and never enter the batch. Public adverts are not a root of trust, so this is for plausible time on clockless nodes, not authoritative timekeeping.

→ Full guide: MESHCLOCK.md

🛰️ Fleet management (remote CLI scripts)

Broadcast CLI jobs to a whole fleet of repeaters through one private keyed channel. Set once per repeater (fleet chan set + tags + fleet on), a group text message on that channel executes as a small script — deferred, and at most once per job key per boot — on every repeater whose tags the job targets. Every admin command works remotely: radio settings, filter rules, node names, reboots. Re-send jobs freely to catch nodes that were offline; duplicates are ignored automatically; tags address sub-fleets (by location, board type, or rollout stage) and !ack makes nodes answer in-channel.

The channel key is the credential: holding the PSK is equivalent to serial-console access on every member, so PSK hygiene is the whole security model. The feature supersedes the battery gate — fleet jobs run, and fleet-channel traffic relays, even while a low battery has suspended forwarding.

→ Full guide, including recipes, the two-phase and scheduled-cutover patterns, and the security model: FLEET.md

📶 MQTT observer

An optional firmware build that publishes the traffic a repeater hears to one or two MQTT brokers, turning the node into a live feed for map, coverage, and packet-analysis tools — no computer or companion app attached to it. It captures before the packet filter and battery gate, so it observes packets the node will not forward, and it uplinks its own adverts by default so the node appears in the feed. ESP32 boards only; two broker slots with Ed25519-signed JWT or username/password auth, TLS with a valid clock, and a bounded best-effort queue that rides out broker outages.

→ Full guide, including the build targets, broker setup, CLI reference, and the message schema: MQTT_OBSERVER.md

📲 LoRa OTA

ESP32 repeaters are updated over the mesh with the MeshCoreRepeaterManager app — the supported way to run an update. It talks to a stock companion over Bluetooth or TCP, stages the image in the inactive A/B slot, verifies it before applying, and boots it only when you confirm. If the new image cannot start its radio, the repeater flips back on its own.

Boards without a dual app partition and non-ESP32 builds report the feature unsupported. The ota status, ota abort and ota rollback CLI commands are for diagnostics.

→ Full guide: OTA.md

Partition change: the 28 ESP32 repeaters still using default.csv, and the other roles on those boards, need a full erase and merged reflash for OTA headroom — 20 move to min_spiffs.csv, 8 16 MB boards to default_16MB.csv. See OTA.md for the affected targets and the backup procedure.

🤖 Chat bot

An opt-in responder that answers test/ping/help chatter on one keyed channel with the sender tagged and the path it arrived on — no companion, no internet, no contact table. Most meshes do not need a bot: every reply costs airtime for everyone, so enable it only with a reason, and then give it its own channel with no other bots on it. Off by default; no rebuild needed.

→ Full guide: BOT.md

Why run this instead of stock repeater firmware?

Stock repeaters forward everything they hear, until the battery dies. This fork is for operators who want policy and resilience at the node:

  • Shared / community nodes — mute noisy senders or channels that eat your airtime, without asking anyone to change their setup.
  • OpenHop-style policy, nothing extra to run — the rule engine is modelled after the policy filters in OpenHop and lives entirely in the repeater firmware, so you get about the same functionality with just the node itself — no computer, companion app, or other hardware needed.
  • Solar / off-grid sites — the node goes quiet while it can still answer you, instead of disappearing dark, and wakes itself when there's sun again.
  • Fleet operators — run several repeaters (a region, a club's network, a set of towers) and push settings to all of them with one broadcast message instead of one admin session each: radio preset cutovers, advert hygiene, filter policy, rollouts and rollbacks.
  • Licensed amateur operators: send publicly readable traffic at amateur power while encrypted traffic stays at unlicensed power, with the callsign included in adverts on a 10-minute ID timer.

Getting the firmware

Prebuilt binaries for all supported boards are on the Releases page — except the STM32WLE5 boards (wio-e5, wio-e5-mini, the wio-e5 bridge, RAK3172 and Tiny Relay), which no longer fit the fork's repeater firmware and ship no build. Two channels:

Channel Branch Based on Tags
dev repeater-filter repeater-filter-stable (fork work, lands on stable) filter-v*-dev.N
stable repeater-filter-stable upstream main releases filter-v*

Flash as you would stock firmware, then follow FILTER.md to set your first rules over the CLI, FLEET.md if you are running a fleet, POWER.md if the node runs on solar or battery, RADIO2.md if it should listen on a second preset, HAM.md if you are a licensed operator using dual TX power, or MQTT_OBSERVER.md if you flashed an observer build. Observer builds ship in the same releases as the plain repeater firmware.

S
Description
No description provided
Readme MIT
21 MiB
0 Stars 1 Watchers 0 Forks
Languages
C++ 56.4%
C 40.9%
Python 1.7%
Shell 0.9%