509 Commits
Author SHA1 Message Date
Ben MeadorsandGitHub dd1ec9d462 Lora region preset map (#10736)
* Added lora region and preset maps

* Protos

* Address PR review feedback

- Log (and break/skip) when the region preset map exceeds its array bounds
  instead of silently dropping regions
- Derive test bounds from the generated nanopb array sizes via sizeof()
  instead of hard-coded magic numbers
- Fix want_config sequence comment (missing comma, STATE_SEND_MODULECONFIG)
- Specify a language on the spec's fenced code blocks (markdownlint MD040)

* Fix want_config stall: handle STATE_SEND_REGION_PRESETS in PhoneAPI::available()

available() had a separate per-state switch that wasn't updated for the new
state, so it returned false ('unexpected state 5') and getFromRadio() was
never called - the config handshake stalled after metadata and the client
timed out. Verified via the native simulator integration test.
2026-06-19 19:56:24 -05:00
22072c5f4b Pr1.5 tmm nexthop (#10745)
* TrafficManagement: flat unified cache + persistent next-hop overflow store

Reworks the TrafficManagementModule cache layer (policing behaviour unchanged
from upstream) and adds a routing-hint overflow store:

- Flatten the ring: replace the cuckoo-hashed unified cache and the bucketed
  PSRAM NodeInfo index with plain flat arrays + linear scan (same idiom as
  WarmNodeStore). At LoRa packet rates an O(n) scan of the cache is negligible,
  and it removes a large amount of hashing/displacement complexity. The cache
  entry is 11 B; timestamps use a uniform +1 presence-offset so a 0 byte always
  means "empty" across every sub-store. Adds rebaseEpoch() so cached state
  survives the ~19 h relative-timestamp horizon instead of being flushed.

- Next-hop overflow cache: setNextHop/getNextHopHint store a confirmed last-byte
  relay for a destination, written only from NextHopRouter's ACK-confirmed
  decision (and mirrored from TraceRoute). NextHopRouter::getNextHop falls back
  to this cache when the hot NodeDB has no hint, so DMs/relays to long-tail
  nodes keep routing after the node ages out of NodeInfoLite.

- Persistence: preloadNextHopsFromNodeDB warm-starts the cache from persisted
  NodeInfoLite hints on first maintenance pass; next_hop entries are kept alive
  across the maintenance sweep (no TTL) and never clobbered by a stale preload.

All packet-policing logic (rate limit, position dedup, unknown-packet drop,
NodeInfo direct response, hop exhaustion) is the existing upstream behaviour,
untouched. HAS_TRAFFIC_MANAGEMENT defaults on so the module is compiled in. (see note).

Tests: upstream policing suite now actually runs (adds the MeshTypes.h include
that gates HAS_TRAFFIC_MANAGEMENT) plus 4 next-hop tests. Role-aware throttles,
politeness, precision clamp, port-interval and mesh-radius gating — and the
rate-limit >255 saturation fix — are deferred to the advanced-TMM branch.

Note: default dedup movement grid moves to ~91m, which also means 1.5km required to end up with the same signature position - coarser and therefore further than before.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* TrafficManagement: fix cppcheck constVariablePointer warning

`node` in preloadNextHopsFromNodeDB() is never written through — mark
it const to satisfy cppcheck's constVariablePointer check in CI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Add multi-hop NextHop recovery tests and unit tests for routing reliability

- Introduced a new test suite for multi-hop NextHop directed-message delivery and relay recovery in `test_nexthop_multihop_recovery.py`. This includes tests for end-to-end delivery and recovery after relay drop.
- Implemented unit tests in `test_main.cpp` for NextHop routing reliability mitigations, covering:
  - M1: Ambiguity-aware last-byte resolution.
  - M2: NextHopRouter's strict-neighbor gate and hop limit checks.
  - M3: Route-health freshness and failure decay.
- Enhanced mock classes to facilitate controlled testing of node behaviors and routing logic.

* grafting fixed

* Address Copilot review for PR #10735 (NextHop improvements)

- docs/nexthop-routing-reliability.md: update status from "no code
  changes yet" to reflect that mitigations and tests are implemented

RAM pressure and MIGRATION_VERBOSE concerns addressed upstream in
PR2.5 (per-platform TRAFFIC_MANAGEMENT_CACHE_SIZE) and PR2 (verbose
default=0) respectively; (0,0) sentinel fixed in PR2.5.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* CI: fix cppcheck constVariablePointer and test include path

- NextHopRouter.cpp: qualify two RouteHealth *h locals as const — only
  read for stale-route checks, never mutated through the pointer
- Router.cpp: qualify meshtastic_NodeInfoLite *node as const in
  shouldDecrementHopLimit — only read for favorite/role predicate
- test_position_module/test_main.cpp: change bare PositionModule.h to
  modules/PositionModule.h — build_flags sets -Isrc, not -Isrc/modules,
  so the bare form fails to resolve in the native PlatformIO test env

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* WarmStore: cache device role + protected category in last_heard low bits

Steal the low 6 bits of WarmNodeEntry.last_heard to carry an evicted node's
device role (4 bits) and a protected category (2 bits) for the hop-trim path,
at zero record-size cost (entry stays 40 B; no RAM/flash growth). The high bits
remain a real unix-seconds timestamp, quantised to 64 s — ample for warm LRU
ordering of long-tail nodes.

- absorb() packs role/protectedCat; place()/ring replay store the raw word so
  metadata round-trips through flash. LRU compares masked time (warmTimeOf).
- take() rehydration masks the metadata bits and restores the cached role so a
  re-admitted node isn't stuck at CLIENT until its next NodeInfo.
- NodeDB classifies the category (favorite/ignored/verified -> Flag;
  tracker/sensor/tak_tracker -> Role) at each eviction site.
- WarmNodeStore::lookupMeta() exposes role/category to consumers.
- Bump WARM_RING_MAGIC (WRNG->WRN2): old rings read as erased and rebuild;
  warm data is a non-critical evictee cache, so discard-on-upgrade is safe.

Tests: test_warm_store 11/11 (new meta round-trip + quantisation-aware ordering);
NodeDB compiles (test_nodedb_blocked 4/4).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* WarmStore: migrate v1 rings/files by discarding last_heard, not the data

Previously the WRNG->WRN2 magic bump treated old rings as erased, discarding all
warm entries — including the PKI public keys that let evicted nodes keep
decrypting DMs. Instead, read v1 (WRNG / WRM1) records and keep each node's
identity + public key, discarding only last_heard (its low bits would otherwise
be misread as the new role/protected metadata). Records re-rank and re-learn
their role on next contact.

- Ring backend (nRF52840): ringReadHeader accepts both magics and reports v1 via
  an out-param; replay zeroes last_heard for v1 records. If the active head page
  is v1, force a rotation so new v2 records never land in a v1-headered page
  (which would discard their freshly-set role on the next load). Legacy pages
  convert to v2 as the ring rotates.
- File backend (warm.dat): bump WARM_STORE_MAGIC WRM1->WRM2; accept WRM1, verify
  CRC against the stored bytes, then discard last_heard and mark dirty so the
  next save rewrites as v2.

Tests: test_warm_store 12/12 (adds test_ws_v1_migration_discardsLastHeard:
key survives, role/protected reset).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* WarmStore: guard role bit-width + test eviction carries role/protected

- static_assert that the device role enum still fits the 4-bit warm metadata
  field (WARM_ROLE_MASK); fails the build loudly if a new role is added past 15
  rather than silently truncating role on eviction. (Max role today = 12.)
- Add test_migration_carriesRoleAndProtectedIntoWarm: a demoted TRACKER lands in
  the warm tier with its key, role=TRACKER and protected category=Role; a demoted
  CLIENT carries role=CLIENT/None. Exercises the NodeDB eviction path +
  warmProtectedCategory classification (the warm-store unit tests only cover
  absorb() directly).

Tests: test_nodedb_blocked 5/5.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix copilot comments

* fix(test): restore #if HAS_TRAFFIC_MANAGEMENT guard in TMM test

The rebase onto PR1.5 lost the top-level HAS_TRAFFIC_MANAGEMENT guard
that PR1.5 introduced, leaving the #else/#endif tail orphaned and
causing compile errors on non-TMM builds.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
2026-06-19 19:52:58 -05:00
Sacha Weatherstone 48fe68050b Remove docs, moved to main repo 2021-04-15 17:24:28 +10:00
Kevin Hester 7a86d150a3 Delete CNAME 2021-04-15 14:59:24 +08:00
Kevin Hester 5e85e6b7d2 Create CNAME 2021-04-15 13:21:55 +08:00
Kevin Hester d22f2501b6 Delete CNAME 2021-04-15 13:19:07 +08:00
Kevin Hester 680eb18015 Create CNAME 2021-04-15 13:16:31 +08:00
Kevin Hester 4e33de780d Delete CNAME 2021-04-15 13:16:23 +08:00
Kevin Hester 89d6046ccc Create CNAME 2021-04-15 13:15:02 +08:00
Kevin Hester d51b8bbe06 Delete CNAME 2021-04-15 13:11:21 +08:00
Kevin Hester 7d3115bb9b 1.2.28 2021-04-15 12:30:46 +08:00
Kevin Hester ec18efbe7e Add beginnings of RAK4600 and update to latest nrf52 arduino sources 2021-04-15 11:45:58 +08:00
Kevin Hester f1376406fa Add RAK4631 to build 2021-04-12 13:39:45 +08:00
Kevin Hester 55b38a7b02 RAK4631 is almost feature complete 2021-04-12 13:25:55 +08:00
Kevin Hester 7224782d23 rak4631: gps now works 2021-04-11 15:17:56 +08:00
Kevin Hester f7d199a3be rak4631: kinda runs 2021-04-11 13:58:48 +08:00
Kevin Hester 328b24537f rak4631: builds but WIP 2021-04-11 13:33:27 +08:00
Kevin Hester a43a04986d document peer_info 2021-04-11 09:24:36 +08:00
Kevin Hester e71758457b use production mqtt server 2021-04-10 10:55:56 +08:00
Kevin Hester 5dfd387b21 use real MQTT server DNS name 2021-04-09 16:56:28 +08:00
Kevin Hester 57bf4073c5 Merge remote-tracking branch 'root/master' into mqtt 2021-04-06 10:58:01 +08:00
Kevin Hester cbfd80f893 fix #779. Add basic GPIO documentation 2021-04-06 10:56:23 +08:00
Jm CaslerandGitHub 4382caad88 Update RangeTestPlugin.md 2021-04-05 19:25:53 -07:00
Kevin Hester 276526005b run-both should target tbeams 2021-04-05 16:27:44 +08:00
Kevin Hester 63c976d4f1 update docs 2021-04-05 12:11:07 +08:00
Kevin Hester e84edc676f mqtt: automatically start or stop as neede & attempt reconnect 2021-04-05 07:53:07 +08:00
Kevin Hester d19af8b83d mqtt: send packets after they are encrypted 2021-04-04 09:20:37 +08:00
Kevin Hester 638cec7f25 we now send packets to mqtt server 2021-04-03 22:27:06 +08:00
Kevin Hester f3f09f0dcf MQTT WIP 2021-04-03 16:06:40 +08:00
Kevin Hester dcf64dfacd MQTT at least talks to server, works in native and esp32 2021-04-03 14:54:10 +08:00
Kevin Hester 2acde3333c todo updates 2021-04-03 10:40:56 +08:00
Kevin Hester 8d47e4f3e0 1.2.20 2021-04-02 13:44:53 +08:00
Kevin Hester 2c5ea03b74 fix VFS creation bug in native. fix heap corruption in Fsm free 2021-04-01 20:32:12 +08:00
Kevin Hester 9d452ebf29 add WIP notes about running github actions locally... 2021-04-01 14:12:02 +08:00
Kevin Hester 8a20155214 simplify build 2021-04-01 14:05:27 +08:00
Kevin Hester 2594ea0c2c test fix for CI tool 2021-03-31 16:28:16 +08:00
Kevin Hester 5f45a10db5 fix sign comparsion 2021-03-31 11:14:55 +08:00
Kevin Hester 5f948c09fe update libs to fix CI build, thanks @meehow! 2021-03-31 11:05:43 +08:00
Kevin Hester 5c1d8b5bb0 todo updates 2021-03-31 09:13:41 +08:00
Kevin Hester b68397a911 fix simradio init to work more like real radios 2021-03-30 23:39:51 +08:00
Kevin Hester 5fdcb72d46 cleanup applyModemConfig based on porduino testing, share with sim 2021-03-30 23:34:13 +08:00
Kevin Hester cdb4756d9d fix native build 2021-03-29 20:56:02 +08:00
Kevin Hester 525fe9b96c dramatically speed up message RX in some cases (we were sleeping much too long) 2021-03-28 12:16:37 +08:00
Kevin Hester 890ec7bdb2 doc update 2021-03-27 17:19:15 +08:00
Kevin Hester 1e3b037fea populate position.time for broadcast positions 2021-03-27 16:17:01 +08:00
Kevin Hester 04225f7bc2 change! time of last packet rx in node->last_heard instead of node->position.time 2021-03-26 09:30:15 +08:00
Kevin Hester 0261c243e0 PhoneAPIs shouldn't register for messages until they have clients 2021-03-25 07:51:54 +08:00
Kevin Hester 78c665abb9 properly discard messages with fromradio queue is full (Rather than blocking forever) 2021-03-24 13:25:10 +08:00
Kevin Hester eb684aac03 tested OTA is_router 2021-03-23 14:54:56 +08:00
Kevin Hester 7b4f8fb6d6 Fix firmware OTA update while is_router 2021-03-23 14:44:50 +08:00