Commit Graph
420 Commits
Author SHA1 Message Date
tthandClaude Opus 5.5 29ef420486 repeater/ble: blepwr se ukládá a přežije reboot
Výkon BLE spojení (výchozí 0 dBm) se dal měnit za běhu, ale každý reboot ho
vrátil na nulu. mast-three přitom drží most z bridge-host přes zavřené okno jen na
+8 dBm. `blepwr <dBm>` teď platnou hodnotu uloží do InternalFS (/ble_pwr,
výchozí = žádný soubor) a boot ji načte. Neplatná hodnota (mimo
−40,−20,−16,−12,−8,−4,0,2..8) skončí ERR a neuloží se.

Automatický návrat oslabení po 5 minutách a `hold` jsou pryč: s uloženou
hodnotou by se rozcházely s tím, co platí po rebootu. Špatně nastavený výkon
se opraví přes mesh admin CLI, které na BLE nezávisí.

Ověřeno na x1: ERR + neuloženo, 6 → reboot → 6, −4 → reboot → −4,
0 → reboot → 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 23:39:44 +02:00
tthandClaude Opus 5.5 89a50b8542 Merge remote-tracking branch 'origin/dev'
Konflikty:
- ESP32Board.h: upstream obnovuje čas z RTC backupu přes všechny resety;
  záchytná hodnota je teď novější z FIRMWARE_BUILD_EPOCH (náš stamping)
  a RTC_TIME_MIN.
- t1000-e: upstream sloučil sleep_gps() do stop_gps() (drží VRTC + Airoha
  RTC backup sleep) ⇒ gps duty používá stop_gps(), sleep_gps() zrušen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 16:28:45 +02:00
Scott Powell 48aae4072d * don't respond to DISCOVER requests if node has adverts turned off. (isHiddenNode()) 2026-10-04 15:02:00 +11:00
tthandClaude Opus 5.5 36de0d92cd Merge remote-tracking branch 'origin/dev' into main
77 upstream commitů (8.–23. 9. 2026): MyMesh::Listener místo UITask,
Board::handleCommand + board.loop() hook, agc.reset.interval, validace
`set af`, CMD_SEND_CHANNEL_DATA gate, DC-DC na LR1110/LR1121, nové desky.

Konflikty:
- simple_repeater/main.cpp: náš BLE vstup konzole + upstream oprava
  plného bufferu (\r na size-2, NUL na konci)
- platformio.ini: zůstává ${nrf52_fw.pkg} (pin je shodný s upstreamem)
- TxtDataHelpers.cpp: upstream verze (ltoa + include api/itoa.h) místo
  našeho sprintf — řeší totéž STM32 selhání
- EnvironmentSensorManager.h: obě metody

Postaveno: SenseCap_Solar_repeater_ble, SenseCap_hreb_rpt,
SenseCap_ples_rpt, Xiao_x1_rpt, Xiao_x2_cmp, T1000E_cmp_cz. Neflashováno.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 18:35:35 +02:00
Wolfram Keil ba345d486c Add board loop hook for periodic work 2026-09-22 08:01:48 +02:00
Kevin Le 39ba9ddb15 Off LED before powering off for repeater 2026-09-19 11:26:42 +07:00
tthandClaude Fable 5 694c6397b7 fix(repeater): drobnosti z review antispamu (žádný high/med, jen LOW)
Ze tří nezávislých review agentů:
- fairnessHandleCommand: `memcmp(arg, "cap ", 4)` nad 1bajtovým ""
  literálem = OOB read (UB, trip ASAN) → `strncmp` (zastaví se na NUL).
- chan_list_del trimoval jen leading space → `filter del Bob ` (RF pad
  trailing) nic nesmazal; teď trimuje oba konce jako chan_list_add.
  + test TrimsTrailingSpaceOfName.
- formatGrid: `static` scratch (nereentrantní + 448 B BSS napořád) →
  lokální; + guard max_len<=0.
- reply formátování přes snprintf(reply, reply_max) místo sprintf/strcpy
  (filter_deny je proměnné délky) — defense-in-depth.

Ostatní nálezy (spoofovatelnost jména, agresivní advert cap 4/120min
default-on) jsou zdokumentované/záměrné, ne bugy — advert default na
husté CZ síti chce ověřit gridem před stožárem.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-06 00:07:52 +02:00
tthandClaude Fable 5 141a1c8069 feat(repeater): fairness grid viditelnost + runtime cap/refill tuning
Bez gridu jsme slepí — `fairness` čítač říkal KOLIK, ne CO. A capy byly
build konstanty, takže zvolnit telemetrii šlo jen reflashem.

FairnessLimiter:
- per-bucket deny čítače (uint16, group/sender/advert mapy) + formatGrid:
  vypíše nejrušnější buckety po kategoriích jako `<pfx>=<count>`, busiest
  first. Bucket prefix se křížově dohledá v observeru/CoreScope na jméno.
- runtime settery capů (setGroupCap/…; 0 = build default).

MyMesh + NodePrefs (persistováno přes savePrefs):
- prefs fair_{g,s,a}cap + fair_{g,s,a}rf_s (0 = build default), aplikují se
  v begin() a refill scheduling je z nich (fairGroupRefillMs atd.).
- CLI `fairness grid`, `fairness cap <g> <s> <a>`, `fairness refill <g> <s>
  <a>` (sekundy); bare `fairness` teď hlásí i capy a refilly.

Bench (x1, 5. 9.): `fairness cap 2 2 2` → burst 6 zpráv na #test →
grid `group(cap 2): 19=5` (bucket 0x19 = #test hash 0xD9 & 0x1F, sedí);
cap 0/refill 0 vrací defaulty. Testy test_fairness_limiter rozšířeny
o cap tuning + grid (native i ASAN, 66/66 zelených).

Telemetrie chodí FLOOD jen do naučení cesty — direct část se nelimituje
vůbec (FAIRNESS_ALLOW_DIRECT), takže zvolnění se týká jen flood telemetrie.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-05 23:39:04 +02:00
tthandClaude Fable 5 04838e8492 feat(repeater): antispam — FairnessLimiter (port #1502) + kanálový deny list
Reakce na 5. 9.: ujetý AI bot lil 11dílný Gemini 429 dump na #meshcore
(99 ze 100 posledních zpráv kanálu) a naše repeatery ho poslušně šířily.

Vrstva A — FairnessLimiter (port Beanowovy větve beanow/wp-repeat,
upstream návrh meshcore-dev/MeshCore#1502): token buckety nad
FORWARDOVANÝM provozem, klíčované 1B identifikátory v plaintextu
(channel hash / src hash / pubkey[0]). Nový virtual
Mesh::takeForwardingRateLimit() jako poslední podmínka všech čtyř
forward rozhodnutí. DIRECT se nelimituje. Odchylky od originálu: bez
RTC závislosti (logy přes MESH_DEBUG_PRINTLN), bounds guardy na
payload_len. Kill switch: `fairness on|off` (persistovaný pref).

Vrstva B — ChannelFilter: repeater se znalostí PSK (committed
[channel_filter] — klíče hashtag kanálů jsou SHA256(jméno)[:16],
tedy veřejné z konstrukce; derivace ověřená na 0xEF z éteru)
dešifruje GRP_TXT a zprávy odesílatelů z runtime deny listu
odmítne přeposlat (markDoNotRetransmit, stejný mechanismus jako
ANON větev). CLI `filter add|del|list|clear`, seznam v NodePrefs.
Jméno je spoofovatelné — je to zadržení ujetého bota, ne security;
příjem a rxlog/pktfeed (CoreScope) nedotčené. Fork-only, upstream
by to nevzal (privacy/no-censorship, viz diskuze u #169).

ChannelBot refactor: registr kanálů + parse sdílené v ChannelCommon.h
(bot = botOnChannelText), čisté helpery v ChanListUtil.h kvůli native
testům. Nové testy test_fairness_limiter + test_chan_list (native i
ASAN, 164/164 zelených).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-05 21:35:36 +02:00
João Brázio dbb2aeee00 Ensure command buffers stay NUL-terminated to prevent overflow
The serial command buffers must stay NUL-terminated within their
bounds: if they ever aren't, strlen() can return >= sizeof(command)
and the read loop would index past the buffer. Additionally, a full
buffer now becomes a completed line (end-of-line marker placed
inside the buffer, NUL terminator kept) instead of overwriting the
terminator and silently corrupting the buffer for the next pass.

Applies to the serial CLI readers of the repeater, room server,
sensor and secure chat examples, and to the CLI rescue reader of
the companion example.
2026-09-04 20:01:39 +01:00
tthandClaude Opus 5 a043033910 Merge remote-tracking branch 'origin/dev' into main
58 commitů upstreamu nad v1.17.1. Šest konfliktů, všechny ručně:

- `src/helpers/radiolib/RadioLibWrappers.cpp` — OBOJE. Upstream `aa229245`
  přidává `idle()` před `setOutputPower()` na LR2021 (tam jsou to standby-only
  příkazy a přijímač se sám nevrátí do Rx); naše část si dál drží návratový
  status, aby „rádio to odmítlo" a „rádio to změnilo" nevypadaly z konzole
  stejně. Nezávislé věci, obě zůstávají.
- `src/helpers/CommonCLI.cpp` — VERZE UPSTREAMU. Celý blok `radio`,
  `radio.rxgain` a `radio.fem.*` byl čistě upstreamový kód (diff proti merge
  base v té oblasti je prázdný) a upstream ho přestěhoval do nového
  `CommonRadioPrefs`; FEM příkazy zrušil ve prospěch per-variant klíčů
  `fem_rxgain`/`fem_txgain`.
- `examples/simple_repeater/MyMesh.h` — NAŠE + úklid. `static_assert` na
  64bajtový wire formát `RepeaterStats` zůstává, `MAX_CLIENTS` odsud mizí:
  `1a8d860d` ho centralizoval do `helpers/ClientACL.h`, který je tu už
  includovaný.
- `examples/simple_repeater/MyMesh.cpp` — NAŠE. Konflikt byl falešný (upstream
  ten řádek nemění), jde o naše dva countery `tx_start_fail`/`tx_timeout`.
- `examples/companion_radio/ui-new/UITask.cpp` — OBOJE. Upstream přidal větve
  pro `UI_SHOW_CLOCK`, my podmínku `_task->isBluetoothEnabled()`, aby displej
  nenabízel PIN k párování, které není jak navázat.
- `platformio.ini` — OBOJE. Vedle našeho symlinku na lokální nRF52 framework
  přibyl upstreamový `toolchain-gccarmnoneeabi@^1.140201.0`.

Navíc: `[env:native_asan]` musel dostat `DynamicConfigSerializer.cpp` do
`build_src_filter`. Merge ho přidal jen do `[env:native]` a ASAN env pak padal
na undefined reference — což vypadá jako nález sanitizeru a je to jen chybějící
překladová jednotka. Ty dva envy musí zůstat v zákrytu.

Ověřeno: `pio test -e native` i `-e native_asan` 53/53, a čtyři envy, které
skutečně flashujeme, se přeloží (Xiao repeater / companion_radio_usb /
kiss_modem, t1000e_companion_radio_ble).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 02:19:04 +02:00
Scott Powell 5a7bc507d1 * new DynamicConfigSerializer
* board/variant KeyValueStore now can write to 'custom' object in Json prefs
2026-08-24 17:12:56 +10:00
Scott Powell 8c73c948b4 * T096, and Station G3: refactoring the 'FEM' prefs to variant-specific code
* CommonCLI: 'FEM' commands removed
* introduced static no-op attachDynamicPrefs() for all boards
2026-08-24 01:50:22 +10:00
Scott Powell 644e68d0ff * new TXT_TYPE_CLI_COMMAND (3) 2026-08-23 22:04:05 +10:00
tthandClaude Opus 5 6aaa816386 fix(mesh): šířku path hashe bere každá TX cesta z prefs uzlu, ne z konstanty
Ranní 4caf52bb spravil jen sendZeroHop() a jen tam, kde mu volající šířku
předal. Zbylo dvoje místo, kde uzel s `path.hash.mode 1` pořád vysílal
hlavičku s 1 B:

  * sendDirect() s PRÁZDNOU cestou. `path_len` je zakódovaný bajt (bity
    šířky + počet hopů), takže neprázdná cesta si svou šířku nese sama a
    přes copyPath() projde beze změny — proto tady žádná chyba routingu
    není a moje první diagnóza „forwarder rozseká cestu po bajtu" byla
    mylná. Prázdná cesta ale nemá co nést a holá 0 se dekóduje jako 1 B.
    A přesně to je nejběžnější případ: odpověď sousedovi na dosah jde
    zerohop direct, takže tudy tekla VĚTŠINA 1B provozu, co je vidět na
    ob2 a v appce na #tth-test.
  * volání send*() bez explicitní šířky. Companion (ob1/ob2/L1) posílá
    zerohop na třech místech výchozím argumentem, stejně tak sensor
    a room server; ACKy a PATH-return v BaseChatMesh a Mesh.cpp:187 taky.

Řeší se to na jednom místě: `getSelfPathHashSize()` je nový protected
virtual na Mesh a výchozí hodnota parametru se mění z 1 na 0 = „vem prefs
uzlu". Firmwary s NodePrefs ho přebíjejí na `path_hash_mode + 1`, takže
opravu dostanou i cesty, které si šířku nikdy nepředávaly. Základní třída
prefs nemá a vrací protokolové minimum, tedy simple_secure_chat zůstává,
jak byl.

TRACE se schválně nedotýká: tam `path_len` NENÍ zakódovaný bajt, ale holý
čítač SNR vzorků, a šířka se veze v příznacích payloadu (Mesh.cpp:55).

Kompatibilita: `path_len = 0x40` znamená šířka 2, počet hopů 0, tedy
`getPathByteLen() == 0` — starší uzly ho projdou přes isValidPathLen()
a nepřečtou o bajt navíc.

Přeloženo: SenseCap_hreb_rpt, SenseCap_ples_rpt,
SenseCap_Solar_repeater_ble, T1000E_cmp_cz,
Heltec_t114_without_display_room_server, Heltec_ct62_sensor.

Upstream to opravené nemá: origin/main je cad602e4 (v1.17.1) a je předkem
tohohle stromu, 0 commitů napřed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-22 18:13:02 +02:00
tthandClaude Opus 5 4caf52bb7a fix(mesh): sendZeroHop mazal šířku path hashe, uzel se hlásil jako 1bajtový
`packet->path_len = 0` vynuluje celý bajt — a v jeho horních dvou bitech bydlí
šířka hashe (`Packet.h:85`). Zerohop paket proto hlásil 1 B bez ohledu na
`path_hash_mode`, zatímco floodová větev šířku dostávala. Na uzlu s 2bajtovým
nastavením to vypadalo takhle: `flood: {2 B}` a `route2: {1 B}` od téhož
původce, přesně `advert.interval` od sebe.

Routing to nerozbíjí (zerohop nemá cestu a nepřeposílá se, `Mesh.cpp:83` chce
`getPathHashCount() > 0`), ale kazí to odvozování šířky v analyzerech — a je to
pravděpodobné vysvětlení části komunitních uzlů vedených jako "suspected 1B".

`sendZeroHop()` dostal `path_hash_size=1` jako `sendFlood()` a všechna čtyři
volání v `simple_repeater` mu předávají `_prefs.path_hash_mode + 1`. Zvlášť to
u periodického advertu (`MyMesh.cpp:1706`), který NEJDE přes
`sendSelfAdvertisement()` — oprava jen v té funkci by ho minula, a přitom je to
zrovna on, koho bylo v datech vidět.

Ostatní příklady se nemění, default zachovává dnešní chování. Build ověřen na
všech třech produkčních envech.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-22 15:04:52 +02:00
ripplebiz 1a8d860d8d Merge pull request #3233 from entr0p1/fix/centralise-max-clients
Fix duplicate MAX_CLIENTS definition
2026-08-20 14:09:30 +10:00
tthandClaude Opus 5 f80fcc0587 feat(repeater): report the TX-failure counters in the RF status reply
A repeater that keeps failing to get its transmits out looks perfectly
healthy over RF: sent/airtime just stop growing and nothing in the status
says why. The Dispatcher already counts those failures (n_tx_start_fail,
n_tx_timeout, from the requeue path); this puts them on the air.

Appended at the END of RepeaterStats on purpose, because the struct goes out
byte-for-byte and clients parse it by fixed offsets. Upstream grew the same
frame the same way -- meshcore-py's parse_status() reads recv_errors only
`if len(data) >= offset + 56`, with the comment "appended in firmware
v1.12.0" -- so older clients keep working and simply do not see the new
fields. Verified against the installed parser before writing this.

A static_assert pins sizeof(RepeaterStats) == 64 (56 + 8, padding-free):
reordering a field or gaining padding would silently shift every offset
after it, and that is not something to leave to review.

Room server keeps its own, already-different stats struct -- not touched.

Builds: SenseCap_Solar_repeater, SenseCap_Solar_repeater_ble, t1000e_repeater.
NOT field-tested yet: needs a repeater flashed with this and queried over RF.
Reading the two values also needs the consumer side extended (the library
parser stops at 56 bytes by design).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 19:42:20 +02:00
Rastislav Vysoky d1a2a0c20b repeater: set loop.detect to minimal as default for new installs 2026-08-18 14:56:58 +02:00
entr0p1 11a02eeaba Duplicate MAX_CLIENTS definition
MAX_CLIENTS is defined in both src/helpers/ClientACL.h and examples/simple_repeater/MyMesh.h. Appears it was centralised in the former header file some time ago. Both are included in some places and, depending on which order they're in, either value can win.

This change drops the duplicate entry from the repeater firmware and bumps the central limit up to 32 (per the original repeater firmware value).

Changes:
- Remove MAX_CLIENTS from repeater MyMesh.h
- Increase MAX_CLIENTS limit in ClientACL.h to 32
2026-08-17 23:01:52 +10:00
tthandClaude Opus 5 e38f311563 Merge upstream v1.17.1 (origin/main)
Small one after v1.17.0: 57 files, +825/-200, and it merged with no conflicts at
all. Unlike 1.17.0, the release tags sit directly on origin/main, so no
`-s ours` is needed for git describe to see the release.

What matters for our nodes:

* fix-rxgain-setting-post-agc-reset -- rx gain no longer resets after an AGC
  adjustment. The release notes ask repeater admins to verify radio.rxgain (and
  the new radio.fem.rxgain) after updating, so that goes on the post-flash list.
* NRF52 CC310 crypto is initialised once instead of on every call, and several
  NRF52 pin maps were corrected.
* New 'get/set radio.fem.rxgain/txgain' CLI commands (companion cannot configure
  them yet).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 14:13:50 +02:00
Scott Powell cad602e416 * version 1.17.1 2026-08-14 22:19:19 +10:00
ripplebiz f8832af086 Merge pull request #3106 from ViezeVingertjes/fix/scoped-reply-routing
Fix replies dropped when flood.max.unscoped is low
2026-08-13 15:00:37 +10:00
ripplebiz d5949f93d8 Merge pull request #3137 from agessaman/feat/station-g3-fem-prefs
Station G3: Expose, persist, and apply FEM gain preferences
2026-08-12 16:11:23 +10:00
tthandClaude Opus 5 9d5491f5db Merge upstream v1.17.0 (origin/main) into the analyzer/BLE fork
Upstream shipped companion/repeater/room-server v1.17.0 today; its tree is
identical to origin/main, so that is what this merges. Our base was 7 Jul
(7b566670), i.e. 350 files / +11k lines of upstream behind.

Conflicts and how they were settled:

* Mesh.cpp -- upstream split the dedup into wasSeen() + explicit markSeen().
  Kept BOTH: their new call pair AND our payload-length bound on the TRACE
  path-hash read, which is what stops a crafted short TRACE from steering
  isHashMatch() past the buffer.
* companion_radio/main.cpp -- upstream grew its own MultiSerialInterface
  (BLE + USB + WiFi + Ethernet registered side by side), which is a superset
  of the SerialDualInterface we backported from PR #1779. Took theirs whole;
  our copy is now dead code. NOTE: envs that relied on the backport for a USB
  console alongside BLE now need an explicit -D ENABLE_USB_INTERFACE.
* ui-new/UITask.cpp -- isSerialEnabled() was renamed isBluetoothEnabled()
  upstream and DisplayDriver::RED became UIColor::warning_txt. Same intent
  either way: no BT pin on screen while Bluetooth is off.
* EnvironmentSensorManager.cpp -- upstream fixed the millis() wrap on the GPS
  update timer in the exact line our gpsDutyLoop() call sits on. Kept both,
  with their wrap-safe compare.
* NRF52Board.cpp -- upstream independently arrived at the same sd_temp_get()
  fix for SoftDevice-protected TEMP. Took their form, kept our comment, which
  is the only place recording WHY (APP_MEMACC fault -> reboot on telemetry).
* RadioLibWrappers.{h,cpp}, simple_repeater/main.cpp -- add/add. Their
  configSideDetectors()/performChannelScan()/external watchdog next to our
  irqDoneMask()/probeDio1()/BLE pump/WDT feed. The repeater console keeps the
  1032-byte reply buffer for paged analyzer output and now clears it, since a
  static buffer would otherwise reprint the previous reply.
* .vscode/extensions.json -- deleted upstream, and it is in .gitignore; our
  only change was a comment. Gone.

Built clean: Xiao_x1_rpt, Xiao_x2_cmp, Xiao_x3_obs, SenseCap_s1_rpt,
T1000E_cmp_cz. Not flashed to anything yet.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-09 22:44:07 +02:00
tthandClaude Opus 5 4fb886170f feat(clock): a node with no GPS starts at its build epoch, not in 2024
Measured 7. 8. 2026: bench-board had been running 811 days behind since it was
deployed, and every board on the bench was 812 days behind. Nobody had ever
set their clocks, because setting one was a manual step documented in two
places and performed in neither.

That is not cosmetic. Mesh.cpp stamps every advert a node transmits from the
RTC, and a receiver drops a stale timestamp as a replay -- so a wrong clock
turns into replies that vanish.

Nothing could fix it by itself. The only automatic sources in the tree are GPS
(which these nodes do not have) and BaseChatMesh, which the repeater build does
not link; and `clock sync` cannot work from the console at all, because USB and
BLE share one command buffer and pass sender_timestamp = 0, so the
`sender_timestamp > curr` guard is never satisfied.

So build_version.py now also stamps FIRMWARE_BUILD_EPOCH, and that -- not a
hardcoded 15 May 2024 -- is where a clock with no other source comes up. A
freshly flashed board is right to within "time since compile". It needs no GPS,
nothing carrying a correct time on air, and no host: the one case the host-side
tooling cannot reach. Verified on x1: build epoch 1786100869 = 11:07:49, and
after a reboot the board came up at 11:07:47.

The #ifndef fallback is load-bearing, not decoration: build_version.py is
nRF52-only and reaches 7 of the 16 local envs, so upstream envs never define it.
Verifying an integer define is not `strings` -- dump .text and look for the
word, and check the old literal is gone from all three sites.

`clock` also reports the epoch now. Its human part is minutes only, so a host
comparing clocks could not see a difference under a minute and had to leave a
59 s deadband; appended, so anything that just prints the reply is unaffected.

Also here, and DISABLED, is carrying the clock across a soft reset in retained
RAM. It was tried and measured not to work: the record at 0x2003FFE0 came back
as `00000000 10001000 00000000` after a reboot -- not zeroed, OVERWRITTEN, and
0x10001000 is the nRF52 UICR base, i.e. a UICR pointer left on the Adafruit
bootloader's stack. The bootloader runs before the app on every reset and links
against the full RAM, so it owns the top of it; being outside the app's linker
region is not enough. The code stays because it self-disables against __StackTop
and now says so at boot, and because the same doubt applies to the hardfault
record at 0x2003FFF0, which sits HIGHER -- treat a missing hardfault report as
"unknown", not as "nothing crashed".

Two things that cost a cycle each and are now designed out: the restore's
"nothing stored" branch was silent, which is indistinguishable from "working";
and `clkreboot` would have undone itself, writing the build epoch and then
having the reboot restore the value it just discarded (weak
retainedClockInvalidate() closes that).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-09 22:24:59 +02:00
Scott Powell 49319023e5 Merge branch 'dev'
# Conflicts:
#	docs/payloads.md
2026-08-09 14:36:53 -04:00
Scott Powell 68dedd3e96 * version 1.17.0 2026-08-09 15:14:46 +10:00
tthandClaude Opus 5 a49bbb914d fix(bot): size !link's reply for the longest PATH, not the longest command
BOT_FRAG_LEN was 72, chosen against the longest command name rather than the
longest answer, and it held only because !link had never been asked from
further than two hops away. An 11-hop request wanted 88 chars, so the reply
was cut at 71 -- and it cut off exactly the SNR and RSSI the command exists to
report: "... 209f:34fa:ed9c, SNR 4.0 ".

Two changes, because the size alone would not be enough:

  * 100 bytes, sized against the real worst case. botFormatPath() caps the
    path at 62 chars (21 hops at 1 B, 12 at 2 B, 9 at 3 B all land just under
    BOT_PATH_STR_LEN) and the numbers in front add 36, so 98 + NUL.
  * the path goes LAST. It is the only unbounded part of the reply -- and the
    SENDER picks the hash width, so this node does not even control how long
    it gets. With it at the tail, an overrun eats hops instead of eating the
    link budget, and a partial path is still useful where a missing SNR is not.

Both bot envs (Xiao_x1_bot, Xiao_x3_obs) build.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-07 11:11:25 +02:00
agessaman 2eb7feffe0 fix(station-g3): expose FEM gain preferences 2026-08-06 15:29:14 -07:00
tthandClaude Opus 5 1561d29218 feat(power): stop paying for a blinking LED and 6.5 Hz advertising
Two upstream defaults that cost a headless solar node around the clock:

* Bluefruit blinks LED_BLUE while advertising and holds it on while connected.
  On SenseCap Solar that pin is 12 -- the SAME pin as P_LORA_TX_LED -- so a
  sealed mast node spends charge blinking an LED nobody can see, and the LoRa TX
  indicator lies as a bonus. autoConnLed(false) by default (RPT_BLE_CONN_LED).
* The slow advertising interval sat at 244 units = 152.5 ms, i.e. three channels
  ~6.5 times a second for years. Now 1 s (RPT_BLE_ADV_SLOW); the first 30 s
  after boot or a disconnect stay fast, so discovery is unaffected in practice.

Bench boards keep both upstream behaviours via platformio.local.ini: on a desk
the blinking LED is the "this board is alive" indicator.

Also: powersaving must not sleep while the BLE console still has queued output.
WFE only wakes on an interrupt, so a half-drained rxlog/pktlog page would sit in
the ring until the next connection event -- and on the observer node the bridge
drains those on a 2-minute duty cycle, where a slower drain directly costs
collected frames.

Measured: BLE (at the new interval, LED off) is ~1.3 mA of a ~24 mA node, so
`ble off` on a mast is not worth losing remote access over.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-06 10:05:56 +02:00
tthandClaude Opus 5 c7c9b812ab feat(gps): duty-cycle the receiver, for nodes that run GPS only for the clock
Measured on a SenseCAP Solar P1-Pro: a continuously powered L76K costs 46.0 mA
(paired A/B, spread 43.7-47.5), which is more than everything else on the node
put together -- it runs at ~24 mA with GPS asleep. A mast repeater does not need
a continuous fix; it needs its volatile RTC set, or clients drop its replies.

`gps duty` powers the receiver only around a sync and cuts it in between. The
cadence matches the 30-minute re-sync MicroNMEALocationProvider already does, so
clock accuracy is unchanged while 42-45 of those 46 mA come back -- 42 even in
the pathological case where a fix never arrives.

Encoded as gps_enabled == 2 rather than a new pref, so the prefs file layout is
untouched and an older build just clamps the value.

The cadence is owned by the state machine, not by the provider's own re-arm, for
a concrete reason: with the receiver unpowered nothing feeds the parser, and
MicroNMEA keeps reporting the LAST fix as valid -- a provider-driven re-arm
would therefore set the RTC to a half-hour-old timestamp. Hence syncTime() (which
clears the parser) on every wake plus an own timer, and int32_t deltas so the
49-day millis() wrap cannot park GPS on or off forever.

Verified on hardware, both paths: with sky `duty, asleep, fix, 7 sats` (fix
taken, clock set, receiver cut); indoors `awake` for exactly 300 s and then
`asleep` with an hourly retry.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-06 10:05:26 +02:00
ripplebiz 8bf182fb41 Merge pull request #3115 from oltaco/meshnology_w12
Add support for Meshnology W12 and LR2021 Wrapper
2026-08-05 15:04:00 +10:00
taco cb7b158931 LR2021: auto-LDRO for side detectors 2026-08-05 14:23:32 +10:00
taco 5687ba3f87 LR2021 multi-SF support (side detectors) 2026-08-05 14:23:32 +10:00
tthandClaude Opus 5 bdaf1678da docs: correct the USB-vanish diagnosis, and write down what was measured
The previous commit asserted "the chip is wedged before either interface comes
up, not gone from USB", reasoning that the absence of enumeration errors ruled
out a host-side problem. That reasoning was wrong and the conclusion is
withdrawn.

The control that broke it: the identical signature -- disconnect, then nothing,
no errors, port reporting `state=not attached` -- was reproduced on a KNOWN GOOD
board by writing 1 then 0 to that root-hub port's `disable` from the host. The
board was healthy and doing nothing unusual; it went to `not attached` and
stayed there until physically replugged. So the log proves the host stopped
seeing a device and nothing more. A missing error message is not evidence of
absence.

That also kills the port-toggle as a recovery mechanism -- it takes healthy
boards off the bus with no way back. Recorded so nobody tries it again.

What survives measurement:
  - resets through the RESET pin (double tap) have never failed: 5/5
  - software resets fail in both directions, ~5/10 for `dfu` before the
    USBPULLUP change, and several times for the bootloader's own reset back
    into the application -- a path our firmware cannot reach at all
  - so USBPULLUP is aimed at a transition, not at a diagnosed chip fault, and
    n=1 since does not demonstrate anything yet

The operational rules that follow (one board at a time, never loop flashes, ask
for hands immediately, and get a hub with real per-port power switching if this
bench is to be recoverable remotely) are in tools/README.md.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 22:59:03 +02:00
tthandClaude Opus 5 f99ae9ab18 fix(repeater/dfu): drop D+ before the reset, and print RESETREAS at boot
Three of eight `dfu` commands tonight left the board dead on USB *and* BLE,
recoverable only by a physical replug. I had been calling that "the board fell
off USB" and asking for a replug -- which is a description, not a diagnosis.
The kernel log says exactly what it is and is not:

  good:  usb 7-9: USB disconnect  ->  3 s later  idProduct=0045 (bootloader)
  bad:   usb 7-6: USB disconnect  ->  nothing, ever

No failed-enumeration errors, so the host was not racing the device; the board
simply never drove D+ again. Nor was it sitting in the bootloader: a bootloader
in DFU mode advertises `AdaDFU`, and a BLE scan during the wedge found the other
two boards advertising normally and this one absent from both interfaces. So the
chip is wedged before either interface comes up, not "gone from USB".

Two changes, one a fix and one an instrument:

- reset_mcu() (core wiring.c) disables the SoftDevice and resets with USBD still
  enabled and possibly mid-transfer. Clearing USBPULLUP first drops D+ while the
  application is still alive and in control, giving the host an unambiguous
  disconnect and leaving USBD in a defined state at reset. One register write --
  that is all TinyUSBDevice.detach() does on this chip.

- readResetReason() is latched by the core in init() before RESETREAS is
  cleared, and it is the only thing that can distinguish "somebody typed `dfu`"
  from a lockup or a power cut after the fact. Printed in the boot diag window
  next to the hardfault record.

Scope, honestly: the first change removes a class of race but is NOT yet proven
to be the cause -- the failure is intermittent (~37 %), so only a run of trials
can say. The RESETREAS line is the other half of that instrument.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 22:38:47 +02:00
tthandClaude Opus 5 b9848fe79a feat(radio): DIO1-less operation + pin diagnostics, to salvage bench-board
bench-board died 29. 7. 2026 to a breadboard short that put GND on D1 (= DIO1)
and 5 V on D0. Signature: `sent 0` with tx_timeout climbing WHILE A WITNESS
HEARD THE FRAMES, plus `recv 0` at strong signal -- the radio works, the
interrupt line does not. setPacketReceivedAction() is the only thing that
ever sets STATE_INT_READY, so a dead line means nothing is ever picked up.

LORA_POLL_IRQ reads completion from the chip's IRQ status register over SPI
instead. The chip latches those events regardless of whether they are mapped
out to a DIO pin, so this bypasses the whole line and therefore works no
matter WHICH end of it broke. Rewiring DIO1 to a spare GPIO only helps if the
broken end is the MCU's input pad -- and that is the less likely end, because
grounding an input cannot damage the input, it stresses whatever drives the
net. Polling is strictly stronger: if it does not revive the node, no wire
will either. Cost is one extra SPI read per Dispatcher pass, next to the
isReceivingPacket() read already in that path.

getIrqFlags() returns the RAW chip register (SX126x bits, not RadioLib's
generic RADIOLIB_IRQ_* indices), so the mask comes from a new virtual
irqDoneMask() that only the chip-specific wrapper can fill in.

PIN_DIAG answers "which end?" without a multimeter:

  - boot-time pull-up/pull-down sweep of every header pin, placed BEFORE
    radio_init() because that halt()s when the radio does not answer -- so it
    is the only diagnostic that still runs with the module unplugged, which is
    also the only state where D1's result means anything (attached, the SX1262
    drives DIO1 low and a healthy board reads 0 too). The internal pull is the
    ohmmeter. It cannot see a lifted pad -- the resistor is on the die -- hence
    the optional PIN_DIAG_LOOP_A/B jumper loopback, which drives from outside
    and reads while pulling AGAINST the driver.

  - `dio1` has the radio assert DIO1 via a 1-byte transmit and compares the
    IRQ status register against the actual pin level. Where they disagree is
    where the break is.

All of it is behind #ifdef; a build without the flags is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 21:32:58 +02:00
tthandClaude Opus 5 fc32a1a0a8 fix(repeater/bot): cooldown per sender, not per channel
Reported symptom: "!link arrived only on the second try". Cause was the throttle
itself -- one global 10 s window per channel, so a second person asking inside it
got silence. That reads as a broken bot rather than "wait ten seconds", and it
happened twice while testing.

Now each sender has its own window, keyed on the "<name>: " prefix, over an
8-slot LRU. Spoofable by design and that is fine: this is politeness throttling,
and a channel message carries no identity beyond that prefix anyway.

The airtime guarantee that the global window used to provide is kept explicitly
as BOT_MIN_GAP_MS (2.5 s floor between any two replies, whoever asked), so N
senders can no longer produce N simultaneous transmissions. Without that, going
per-sender would have quietly traded politeness for responsiveness.

`bot` now reports both numbers plus a throttled counter, so a suppressed reply is
visible instead of looking like a dead node.

Bench-verified on the discriminating case, which is the whole point: sender A
asking twice in 3.5 s gets one answer, while sender B asking INSIDE A's window
gets answered -- 3/3.

Note on how that was measured, because it bit me: reading the console counter
costs ~2.4 s (the CDC needs a settle delay), so a probe pair with a counter read
between them is ~15 s apart and the 10 s window has legitimately expired. The
first run of this test "failed" for exactly that reason. Read counters only
before and after a pair, never inside it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 20:03:41 +02:00
tthandClaude Opus 5 27f1339ac9 feat(repeater/bot): !link, and move the path question to the node that can answer it
Correcting how I split the two bots. I gave !path to the Solo node and kept only
analyzer trivia here, which gets the direction backwards.

When you drive away with the handheld and ask "what link do I have home?", the
handheld's own !path is useless: it describes packets the handheld RECEIVED,
i.e. the reverse leg. Only a fixed node at home can answer the forward one,
because it is the thing your packet actually arrived at. So !path belongs here,
and !link joins it: hops + path + SNR + RSSI in one reply, so the question is one
command and not two while driving.

No duplicate answers in that scenario: when the question comes FROM the handheld,
the handheld is the sender and does not answer its own message, so only this node
replies. Two answers only appear when a third node asks -- which is exactly what
my earlier test did, which is why I mistook it for a general problem.

Second reason to answer from here, found while reading the Solo tree: a Solo
node's own bot reply is INVISIBLE in the phone app. tryBotReplyChannel() echoes
only to the local screen under #ifdef DISPLAY_CLASS
(MeshCore-solo/examples/companion_radio/MyMeshBot.h:220), and the only path into
a connected client is onChannelMessageRecv(), which runs for RECEIVED packets
only. A reply from a different node arrives over the air, so the app shows it
like any other message. Answering from here therefore fixes the "I cannot see
what my node said" confusion for free, with no change to the Solo firmware.

Verified live on #tth-test: !link -> "0 hop direct, SNR 13.2 dB, RSSI -43 dBm",
reply counter 2 -> 3.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 19:45:15 +02:00
tthandClaude Opus 5 355e4609eb feat(repeater/bot): sender ignore list + command whitelist so two bots share one channel
#tth-test already had a bot: tracker (Solo firmware), which also puts "Ping" on
the channel by itself. Measured consequence of running a second bot there with
no coordination, over a few minutes: the counter went 2 -> 9, i.e. seven of the
replies went to tracker rather than to a person, and because the cooldown is one
per channel, a human question then landed in a closed window. One of four probes
got no answer for exactly that reason.

Worth stating because it corrects an earlier guess of mine: that miss was NOT an
RF problem. Replies arrive DIRECT (0 hops) at SNR +13.5..14.25 dB, and SF7
demodulates down to about -7.5 dB, so at 2 dBm there is ~20 dB of margin. More
TX power would have bought nothing; the fix was arbitration, not watts.

Two build-time knobs, both defaulting to today's behaviour:

  BOT_IGNORE_SENDERS  comma-separated node names, dropped before trigger and
                      command matching. Verified live: `ignored` incremented on
                      a real tracker message.
  BOT_COMMANDS        whitelist of !commands this node answers, "" = all.

Matching for both is EXACT and case-insensitive, deliberately unlike
botTriggerMatches()' substring search -- a substring ignore list would let a node
called "TTH" silence "tracker", and a substring whitelist would let "path" enable
"!pathx".

Adds !noise (noise floor), which is in the same spirit as !snr and !heard: things
a companion bot cannot answer at all because it has no analyzer.

`bot` now also reports the whitelist, the ignore list and an ignored counter, so
the arbitration is inspectable from the console instead of inferred.

Deployed split: x3 answers only !snr/!heard/!noise and has NO bare-word trigger,
so it never speaks into ordinary traffic; !path/!ping stay with tracker. Verified
live -- !path drew exactly one answer, from tracker.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 19:26:03 +02:00
tthandClaude Opus 5 cca22dd45d feat(repeater): channel bot in the analyzer build -- listens and answers without repeating
The #tth-test bot needed a host process (slidge) plus a dedicated serial
companion node. Putting it in the firmware removes both: the observer node
answers by itself, and the serial console stays free for the CoreScope feed.

Not a port of the Solo bot. That one lives in examples/companion_radio on a
branch 610 commits diverged from ours, and it can only be configured from an
on-device BotScreen -- a XIAO has no display or buttons, so it would compile
and never arm. What made a local implementation cheap is that mesh::Mesh
already exposes everything:

  * Mesh::onRecvPacket() calls searchChannelsByHash() + onGroupDataRecv() and
    THEN routeRecvPacket() (Mesh.cpp:236-249), so reading a channel is
    independent of forwarding it. Both hooks are no-op virtuals, which is the
    only reason a repeater is normally deaf to channel traffic.
  * allowPacketForward() gates only RECEIVED packets, so a node with
    `repeat off` can still originate a reply. That is the point here: the
    observer sits metres from another repeater and must never forward, but it
    does have to answer.
  * createGroupDatagram() is in mesh::Mesh and sendFloodScoped() is a plain
    alias for sendFlood(), so none of the chat/contact machinery is needed.

Written against the mesh::Mesh API only, so it drops into
examples/simple_room_server unchanged if we ever want it there.

Commands are the ones only an analyzer can answer: !path (per-hop hashes at
the packet's own hash width, not a hardcoded 1 byte -- one node here runs 3),
!snr from the frame that carried the request, !heard from the registry.

Two guards, because this node's replies are its only transmissions:
anti-loop compares the sender prefix against _prefs.node_name (the runtime
name, so it holds even when stored prefs override the build-time one), and a
cooldown caps the reply rate. Both are needed: the cooldown alone would only
slow a ping-pong down, not stop it.

The channel key comes in as hex via -D BOT_CHANNEL_PSK, which is the form
`meshcore-cli get_channel <n>` prints -- no base64 round trip and no
base64.hpp dependency in this build. Hash derivation matches
BaseChatMesh::addChannel(); cross-checked against a live node, whose
128-bit key hashes to the same channel_hash the node reports.

All of it compiles out without BOT_CHANNEL_PSK. Costs 2.4 KB flash and 48 B
RAM over the plain analyzer build.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 18:30:47 +02:00
tthandClaude Opus 5 e217b6d6f7 fix(repeater): advertise the node's real name over BLE; harden the UF2 flasher
BLE name: Bluefruit.setName() was given BLE_DEVICE_NAME, which defaults to the
build-time ADVERT_NAME. That only ever seeds a fresh install, so once the whole
test fleet runs one image every board advertises the same string regardless of
`set name`, and a BLE scan cannot tell them apart. Four boards were advertising
"bench-board" simultaneously here -- including the one with the dead radio, which
is precisely the board you least want to mistake for a working one. Now it
advertises the prefs name, with the build constant as the fallback for a node
that has never been named. Prefs are loaded by the_mesh.begin() well before
Bluefruit.begin(), so the name is available.

xiao_uf2_flash.sh, after four rounds of it being not quite foolproof enough:
  - takes an explicit target (serial or fleet number 0..4) and refuses to write
    to any other board; the earlier version reported x4's port after flashing
    x3, which reads exactly like a successful flash of the wrong board
  - rejects a file that is not a UF2 (a .hex or .zip dropped on the drive is
    ignored by the bootloader and looks like success)
  - refuses an image older than firmware.elf, and demands the version stamp
  - resolves drives through sysfs by USB serial, never by label -- every drive
    is XIAO-SENSE, numbered in plug order
  - retries the mount (the automounter loses the race with a fresh drive) and
    the version read-back (the port enumerates seconds before the firmware
    answers on it). A check that cries wolf is worse than no check.
  - proves the flash by reading `ver` off the board and comparing it to the
    image, instead of trusting that some XIAO came back on USB

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 13:48:07 +02:00
tthandClaude Opus 5 3c27e7745f feat(repeater): dfu [uf2|serial|ota] — deterministic reboot into the bootloader
The 1200-baud touch was the wrong mechanism, not an unreliable one. The
Adafruit bootloader chooses its mode from GPREGRET at boot, and the core
already exposes exactly that (cores/nRF5/wiring.c):

  enterUf2Dfu()    0x57  DFU_MAGIC_UF2_RESET          -> mass-storage drive
  enterSerialDfu() 0x4e  DFU_MAGIC_SERIAL_ONLY_RESET  -> CDC only, no drive
  enterOTADfu()    0xA8  DFU_MAGIC_OTA_RESET          -> BLE DFU

The touch only ever requests the *serial* one. That is why no UF2 drive ever
appeared however long we waited for it, and it is the real reason today's
flashes kept going sideways -- I read "coin flip" into what was simply a
request for a different mode, and then wedged two boards proving it.

`dfu` writes the magic and resets, so the board lands in the mode you asked
for, every time. The reply goes out first and the reset happens ~700 ms later
from loop(), since reset_mcu() never returns and over BLE the notification
still has to be pumped out of the TX ring.

LOCAL ONLY (sender_timestamp == 0, the same physical-presence test CommonCLI
uses for `erase` and `set freq`). Over the mesh this would park a node in a
bootloader that waits forever, on a mast, with no way back but a visit.

Builds clean; NOT yet exercised on hardware -- the boards that could test it
are the ones still running firmware without the command.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 12:53:20 +02:00
tthandClaude Opus 5 59e974854f feat(repeater): blink on|off, txpwr with RadioLib's verdict; UF2 flash helper
blink: a fixed burst is a race against walking to the bench -- 30 blinks
(~7 s) was not enough to find the board in time. `blink on` now runs until
`blink off`, with a 10-minute backstop so a node left blinking does not
quietly eat a battery. Cap on the counted form raised to 999.

txpwr: `set tx` cannot tell you whether the radio took the value. It clamps
to -9..30, saves the pref and replies "OK", but SX1262 accepts only -9..+22
and rejects the rest WITHOUT touching the PA -- so `get tx` can report a
power the radio never had. An earlier sweep here measured +2 dBm and -9 dBm
as RSSI -44.1 and -44.0 at a witness and concluded runtime tx power "does
not work"; that conclusion rested on an instrument that could not
distinguish a refused request from a link that does not care.
RadioLibWrapper::setTxPower keeps the status now (the signature stays void,
it implements an upstream callback), and `txpwr [dBm]` reports it. It
deliberately does not write the pref, so a sweep cannot leave a node booting
at some experimental power.

xiao_uf2_flash.sh: the 1200-baud touch is roughly a coin flip on this build.
Today it worked twice, then wedged x4, then wedged x1 -- and a wedged board
is gone from USB *and* BLE, does not recover on its own (waited 400 s) and
needs a physical replug. Not a "too soon after boot" effect: x1 had been up
23 minutes. Double-tap RESET into UF2 is reliable and takes seconds, so this
makes that the easy path. It refuses to act when several UF2 drives are
present rather than guessing, since they are all labelled XIAO-SENSE.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 12:45:28 +02:00
tthandClaude Opus 5 29d620e1a6 feat(repeater): blink [n] — ask a board to identify itself
A bench of identical XIAOs cannot be told apart. The USB serial number
needs a data cable, and boards sharing power rails have none; the BLE MAC
is printed nowhere; and ADVERT_NAME is only as trustworthy as the last
flash, which is usually the thing being checked. Today two boards in the
same breadboard were both advertising "bench-board" -- one of them the
board with the burned DIO1, still happily running BLE.

`blink 10` flashes an LED ten times (default 6, clamped 1..30), and works
from serial, the BLE console and the mesh admin CLI, so it also reaches a
node that is already mounted somewhere.

Deliberately not the status LED. On XIAO that is LED_BLUE, which Bluefruit
drives as its connection indicator -- every BLE node blinks blue the same
way, which is why the LED was useless for identification in the first
place. Preference order LED_GREEN (XIAO, free) -> LED_WHITE (SenseCap, only
ever touched at boot and powerOff) -> LED_BUILTIN, which is last because on
SenseCap it is pin 12, the LoRa TX indicator. Variants may define a colour
they do not physically have by pointing it at PINS_COUNT (SenseCap does
that with LED_RED), so the chain range-checks rather than trusting #ifdef.

Driven from loop(), not inline: a blocking burst would stall the mesh for
up to ~7 s at the cap and disturb the very LoRa timing this fleet measures.
Always finishes dark. Goes through LED_STATE_ON, which is 0 on XIAO and 1
on SenseCap -- hard-coding HIGH would leave half the fleet unlit.

Verified on bench-board over the USB console: "blink 10" ->
"OK - blinking 10 times", and the build stamps v1.16.0-ttha12965f+.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 12:20:28 +02:00
ViezeVingertjes 4820f0916d Merge remote-tracking branch 'upstream/dev' into fix/scoped-reply-routing
# Conflicts:
#	examples/simple_repeater/MyMesh.cpp
2026-08-04 11:49:58 +02:00
ViezeVingertjes 34156ddb11 Fix replies dropped when flood.max.unscoped is low 2026-08-03 22:57:12 +02:00
tthandClaude Opus 5 5333a71927 fix(tools/ble_dfu): require the target address; feat: ble_cli.py; feat: silent-by-default repeater
ble_dfu find(): with want_dfu it accepted ANY device whose name contained "DFU"
and then took the first one the scan returned. With more than one board in
bootloader at the same time that reaches for someone else's hardware. It just
did: target CE:72:…:02, connected FE:11:…:C4. Caught only because the log was
being read by hand -- a few seconds later START_DFU would have overwritten a
different node. The address is now mandatory (MAC or MAC+1, covering both the
SCAP_DFU-on-MAC+1 and AdaDFU-on-same-MAC bootloaders), and foreign boards in
bootloader are listed as explicitly ignored.

ble_cli.py: the BLE console had no tool, so every ad-hoc script re-implemented
it and re-learned the same trap: a NUS write carries ATT_MTU-3 bytes and BlueZ
will not split it, so at the usual MTU 23 anything over 20 bytes fails with
"Failed to initiate write" -- which reads like a dropped link, not "command too
long". Commands up to 18 chars work, longer ones fail, deterministically.
Chunking is now in one place, with retries and the pairing/single-console
caveats documented.

simple_repeater: ADVERT_INTERVAL_DEFAULT / FLOOD_ADVERT_INTERVAL_DEFAULT /
DISABLE_FWD_DEFAULT, so a node can be built to ship silent. ENABLE_ADVERT_ON_BOOT
alone is not enough -- it only suppresses the boot advert, the periodic timer
still fires, so an `erase`d node is on the air within two minutes. Found the
hard way: a node flashed before this change and then erased spent ~44 s
transmitting on the live CZ frequency from a desk.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-03 21:46:23 +02:00
tthandClaude Opus 5 bfdaf32d30 feat(mesh): default to 2-byte path hashes (PATH_HASH_MODE_DEFAULT)
Upstream never initialises _prefs.path_hash_mode, so a fresh node came up at
mode 0 = 1 byte per hop. Nobody on the CZ mesh runs 1 B any more, which meant
every new install needed a manual `set path.hash.mode 1`. Default it to 1 at
compile time in both the repeater and the companion; the pref still overrides
it, so existing nodes are unaffected.

NOTE this is the PATH hash, not PATH_HASH_SIZE. It is used as
sendFlood(..., path_hash_mode + 1), i.e. the bytes each hop appends to the path
while flooding, and the size travels in the packet -- Packet.h:85 packs it into
the top two bits of path_len and Mesh.cpp:93 matches with getPathHashSize() --
so mixed-mode nodes still route for each other. PATH_HASH_SIZE (1) is a
different field, the destination and channel hash in Mesh.cpp:458/548, and
changing THAT would break the wire format against every other node in the mesh.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-03 19:12:15 +02:00