VolatileRTCClock ukládá čas do g_retained_clock (sekce .noinit, linker
ji dá hned za .bss) a při prvním čtení po warm resetu ho obnoví; po
power-on (RESETREAS 0) ne. Dřívější pokus 7. 8. na vrcholu RAM selhal,
protože tam sahá zásobník bootloaderu — střed RAM přežije: x1 (XIAO,
companion) nastaven +30 dní, reboot, hodiny zpět +30 dní.
BaseChatMesh::bootstrapRTCfromContacts posouvá hodiny už jen dopředu:
bezpodmínečný set vracel čas pod build epoch a rušil obnovu, která
ještě neproběhla (první test proto vyšel negativně).
Repeater: mrtvý mechanismus s pevnou RETAINED_CLOCK_ADDR nahrazen
výpisem stavu obnovy při bootu; ukládání obstarává tick().
Podle weebl2000/meshcore 9a561fd7.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PG7 drží RF240, ale SMA konektor jí neprojde. PG11 s vyjmutou a
naříznutou vložkou ano. V hlavičce těsnění silikonem v drážce.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- záda 8 mm se třemi zapuštěnými tunely na stahovací pásky (do 9 mm),
vstupy šikmo 45°, záda zvenku rovná a interiér neproražený
- náběh 45° pod přírubou, díry pro vývodky jako slzy
- víko i filtr na zatavených vložkách M3x5x5 (uši filtru 4,1 mm => M3x10)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Spona obejme tyč libovolného průřezu (zábradlí i stožár). Tunel celý
v liště, záda zůstanou celá. Verze s třmeny M6 je v 967962d8.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Lichoběžníkový profil (zkosené bočnice, vývodky PG7 šikmo dolů = odkapová
smyčka), víko s TPU těsněním a šrouby vně těsnění, dno jako trychtýř do
odtokové dírky, lišty pro hranaté třmeny M6 na tyč zábradlí. Rozměry
filtru z fotek a měření 17. 10.: díry 4 mm 95 x 51, výška 45, osa SMA 18.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keyless doplněk k ChannelFilter: payload[0] u GRP_TXT/GRP_DATA je hash
kanálu v čistém, takže repeater může odmítnout přeposílat celý kanál bez
znalosti PSK (soukromý 0x43 = 43 % provozu CZ meshe). Kontrola sedí
v MyMesh::allowPacketForward(), tedy bez zásahu do core a před
takeForwardingRateLimit() -- zahozený paket nežere tokeny FairnessLimiteru.
Příjem a rxlog/pktfeed zůstávají nedotčené.
Za běhu přes konzoli i RF admin: `filter hash [add|del <hex>|list|clear]`,
max 8 bajtů, persistováno v prefs (f_dhash, f_dhash_n). Nezávislé na
FILTER_CHANNEL_PSKS.
Lavice 14. 10. (866.5/SF8): x1 DUT, x4 companion posílá do 0x75 a 0x09,
x2 svědek přes rxlog. Bez listu x2 slyší oba i s cestou 8704 (x1);
s `add 75` jen 0x09 přes x1, 0x75 jen přímo; x1 si 0x75 dál loguje;
po rebootu list drží; po `del 75` zase oba.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Prázdná hodnota (`v1=`) se už nebere jako 0, `#error` při ENV_INCLUDE_GPS
(oba chtějí Serial1), komentář u hasMotion()/lastLineMillis() říká, co
funkce vrací, a příklad řádku má neutrální id místo skutečné desky.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Budka teď posílá všechny připojené UC96 jako v<k> i<k> w<k> wh<k>, číslované
podle ID. Čidla budky (t/h/p/mot) zůstávají na jednom kanálu, měřák k dostane
k-tý kanál za ním. Kanály se drží i když měřák chvíli chybí, aby čísla mezi
dvěma dotazy nepřeskakovala jinam. Řádek až 256 B.
Ověřeno na benchi: dva měřáky přes x1 a LoRa do companionu x4 jako ch3/ch4.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Budka posílá každých ~30 s po jednosměrném UARTu řádek
`CB1 id=… t= h= p= v= i= w= wh= mot= up=…*XX` (NMEA XOR součet).
BudkaLinkSensorManager je EnvironmentSensorManager + Serial1 RX: řádek se
špatným součtem zahodí celý, hodnoty starší než 2 min do telemetrie
nedává. Všechno z budky jde na jeden LPP kanál za čidly na desce; výkon
jako analog input (LPP_POWER má rozlišení 1 W). TX UARTu je LED_GREEN —
nic se nevysílá a klidová jednička ji drží zhasnutou.
Zapíná se jen -D BUDKA_LINK_RX_PIN=<pin>; bez něj se nic nemění. Nový env
Xiao_nrf52_sensor (upstream pro XIAO nRF sensor neměl).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Druhé kolo review-three: soubor držel jen odchylku od build defaultu, takže
`blepwr 8` na mast-three (default 8) soubor smazal, odpověděl „saved" — a obraz
s jiným RPT_BLE_CONN_TX_POWER by uzel vrátil na 0 dBm. Teď se uloží každá
zadaná hodnota; návrat na default buildu je výslovně `blepwr default`.
static_assert hlídá RPT_BLE_CONN_TX_POWER při buildu, selhané smazání
starého souboru = NOT saved.
Ověřeno na x1: 6 → reboot → 6; default → reboot → 0; 216 → ERR.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- `blepwr` parsuje striktně (strtol + kontrola celého argumentu a platné
hodnoty) — `atoi` udělal z „216" −40 a z „abc" 0, a teď se to ukládá.
Stará syntaxe `blepwr -20 hold` skončí ERR místo tichého uložení −20.
- „saved" jen když zápis do InternalFS opravdu prošel, jinak „NOT saved".
- mast-three env: RPT_BLE_CONN_TX_POWER=8, aby po flashi nenaběhl na 0 dBm,
na kterých most z bridge-host přes zavřené okno padá.
- FairnessLimiter: opravené odůvodnění 0x00/0xFF — náš companion identitu
přegeneruje, ale na CZ meshi za 30 dní prošlo 50 floodů od takových
odesílatelů a u ANON_REQ je payload[1] bajt náhodného klíče (2/256 všech).
Test přejmenován (cap 100 je teď pod defaultem).
- tools/fairness_replay.py: přehrání floodů z CoreScope přes model limiteru,
odkud jsou výchozí hodnoty; pro přepočet, až se provoz změní.
Ověřeno na x1: 216/264/abc/„-20 hold"/1 → ERR; 6 → saved → reboot → 6.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
simple_repeater/main.cpp si advertising nastavuje natvrdo na 8 dBm
(Bluefruit.setTxPower(8)) a BLE_TX_POWER čte jen SerialBLEInterface (companion).
Slabé místo je výkon SPOJENÍ (výchozí 0 dBm), ten se mění za běhu přes `blepwr`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Přehráním 207k floodů z CZ meshe (ob1, 6. 9.–6. 10.) přes limiter: staré
výchozí hodnoty by zahodily 9 % kanálových zpráv, 15 % přímého provozu
a 15 % advertů. Nové výchozí (group 100/30 s, sender 150/10 s, advert
30/600 s) mají za 30 dní nula zahozených s ~2× rezervou; zaseklý odesílatel
nebo bot je pořád oříznutý.
Odesílatel s hashem 0x00/0xFF byl zamítnutý vždy, jenže companiony si
takovou identitu nepřegenerují — jejich uživatelům repeater zahazoval každou
flood DM, PATH i REQ.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
Z improvizace 26. 9. (remote-mast) do opakovatelné sady: sběr přes HTTP API
observeru ob2 (exportér se nezastavuje), cíle jen prefixem klíče, flood
jen po advertu/přeučení v rozpočtu za hodinu, reset uvízlé cesty, surové
pakety od chodce (i nedoručené), hlášení do Jabberu přes systemd --user
(nepadá s tlakem na paměť), report s d/az/el k repeateru a prvním hopem.
walk-data/ je gitignored (polohy).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
1) Rozpočet na jméno se počítal na DVOU místech. `advertNameBudget()`
v BatteryIcon.h zrcadlil `encodeTo()`, ale nevěděl o ADV_FEAT1/FEAT2
(2 B každé), takže by po jejich zapnutí tvrdil o 2-4 bajty víc, než je
pravda -- a UTF-8 clamp by uřízl blokový glyf vpůli. Přesně to tiché
selhání, které hlavička BatteryIcon.h jinde odmítá.
Teď rozpočet hlásí `AdvertDataBuilder::nameBudget()`, tedy ten, kdo jméno
kóduje. Builder se staví bez jména, zeptá se na remainder a jméno se doplní
přes `setName()`. `set`/`get`/advert berou totéž přes `CommonCLI::nameBudget()`.
Nové testy: rozpočet se s FEAT1/FEAT2 zmenší (23 -> 21 -> 19) a jméno přesně
na doraz projde encoderem nedotčené.
2) `set name` mlčel, když nové jméno vytlačilo zapnutou ikonku. `set batt.icon`
i `get batt.icon` na to upozorňují, ale rename je ta cesta, kterou operátor
jde později -- indikátor by mu zmizel ze vzduchu bez hlášky. Teď odpoví
"OK - ALE jméno má N B, s ikonkou se vejde jen M B".
3) `serial_cli.py` byl pátá kopie tabulky sériových čísel a doslovná kopie
`board_probe.py::_open()`. Tabulka je teď v `tools/fleet.py` (jeden zdroj
pravdy pro python), sekvence otevření portu se importuje. `mesh_sniffer.py`
taky. Bash skripty a hooky mají kopii dál -- python z nich neimportuje --
ale fleet.py je to, podle čeho se srovnávají.
103/103 testů, buildy pro x4, remote-mast i mast-three env procházejí, serial_cli
ověřen na živém x4.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Dvoustavová ikonka nesla málo informace a ☀️ v ní znamenalo "baterka OK", ne
"jsem solár", jak bylo zamýšleno. Teď je ☀ trvalá značka solárního uzlu
a za ní jedna z osmi úrovní ▁▂▃▄▅▆▇█.
Proč ne emoji: Unicode má přesně DVĚ baterková emoji (U+1F50B, U+1FAAB),
žádné "napůl", a po 4 B se dvojice ☀️+🪫 nevejde (7 B suffixu proti 6 B, co
jména dovolují). Blokové znaky jsou v BMP, tedy 3 B, a je jich osm -- nejvíc
stavů za nejmíň bajtů. Suffix zůstal 6 B, takže se nic nepřejmenovává.
⚡ místo úrovně, když uzel běží na externím napájení. Bere se z VBUS detektu
(`MainBoard::isExternalPowered()`, nRF52 to má v hardwaru), ne z heuristiky
nad šumem. Řeší to lavici, kde deska bez článku čte plovoucí VBAT a jakákoli
úroveň z toho by byla vymyšlená -- a zároveň to na stožáru pozná nabíjení.
Hystereze je teď na sedmi hranicích a je asymetrická: úroveň padá hned pod
hranicí, stoupá až hyst_mv nad ní. Klesající baterka je ten směr, kde je
optimistická ikonka horší než pesimistická. 50 mV pokryje naměřený denní
rozkmit 38-46 mV a vejde se do kroku 112 mV.
Prefs `bicon_mv` (práh) nahrazeno `bicon_lo`/`bicon_hi` (konce škály),
CLI `set batt.icon.lo|.hi`. Default 3300..4200 = táž škála, kterou počítají
dashboardy, takže ikonka a Grafana říkají totéž.
Ověřeno na lavici svědkem (x4 čte advert z x1): `bench-board☀⚡` opakovaně.
Úrovně zatím jen unit testy -- deska na USB vždycky hlásí externí napájení,
takže ▁..█ se na lavici ukázat nedá; to ověří až uzel na článku.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Napětí uzlu je v telemetrii, jenže tu přečte jen ten, kdo se umí přihlásit.
Ikonka v advertu doletí každému, kdo uzel slyší, za pár bajtů app_data.
Vypnuté defaultem (`set batt.icon on`), práh `set batt.icon.mv` (3700 mV).
Rozpočet je těsný a plný pastí, proto `BatteryIcon.h` s testy:
* app_data má 32 B, z toho 1 B flagy a 8 B lat/lon -> na jméno zbývá 23 B;
* ☀️ je ŠEST bajtů (U+2600 + neviditelný variation selector), 🪫 čtyři;
* budgetuje se vždy ta DELŠÍ z ikonek. Kdyby se rozhodovalo podle aktuální,
jméno by při každém přechodu změnilo délku a klienti by přepsali kontakt;
* když se ikonka nevejde, zahodí se CELÁ a `set`/`get` to řeknou. Tiché
uříznutí UTF-8 clampem je zvlášť ošklivé: jméno vypadá v pořádku.
Přepínání je hysterezní (100 mV), aby ikonka nesledovala denní cyklus
solárního uzlu: změřený denní rozkmit je 38-46 mV a drift 13 mV/den, takže
dvoustavová ikonka překlopí zhruba jednou za měsíc. 25h flood advert je proti
tomu jemný, ne hrubý.
Vzorkuje se jedním čtením záměrně. Deska bez článku na USB čte bimodálně
(4160/3760, dvě úrovně 390 mV od sebe) a medián z pěti vzorků to NEŘEŠÍ
(420 -> 380 mV) -- není co odfiltrovat, je to plovoucí VBAT proti nabíječce.
Uzel s článkem drží rozptyl 0-22 mV v 10min oknech, což hystereze pokrývá
několikanásobně; podrobnosti v BatteryIcon.h, ať to nikdo nezkouší znovu.
Ověřeno na lavici svědkem (x1 čte advert z x4, ne x4 sám o sobě): celý cyklus
☀️ -> 🪫 -> ☀️ -> bez ikonky, fleet_test 13/14 shodně s baseline.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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>
nRF52 CI buildy (RAK_4631*, wio_wm1110) padaly na
`PackageException: Can not create a symbolic link for
/home/user/projects/meshcore-nrf52-fw` — lokální build hack
(`framework-...@ symlink:///home/user/...`) byl commitnutý v
platformio.ini a na runneru ta cesta neexistuje. Pre-existing, ne
antispam změna; buildovalo jen lokálně.
- [nrf52_fw] pkg proměnná: committed default = fetchable git pin
(plný SHA d541301…, tip meshcore-dev fork masteru s BLE patchem).
Plný SHA schválně — shallow fetch krátkého SHA byl důvod symlinku.
- Symlink override přesunut do gitignorovaného platformio.local.ini
([nrf52_fw] pkg = symlink://…), takže lokální build jede dál a hack
už neleakne do CI.
- TxtDataHelpers.cpp: `ltoa` (nedeklarované na STM32/newlib-nano,
rozbíjelo wio-e5 build) → přenositelné `sprintf("%lu")`. int_part je
nezáporná magnituda, znaménko se řeší zvlášť výš.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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>
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>
CI pouštělo `pio test -e native -e native_kiss_modem`. Guardy v Packet::readFrom
zamerne nemeni navratovou hodnotu -- odmitnou presne to, co upstream odmitne az
po precteni -- takze pod `native` projdou i BEZ nich; rika to i hlavicka
test_packet_readfrom.cpp. Slo je tedy odstranit a CI zustalo zelene.
Overeno mutaci: po odstraneni tri guardu z Packet.cpp `native` porad PASSED,
`native_asan` skonci rc=1 a binarka hlasi
"heap-buffer-overflow ... src/Packet.cpp:93 in mesh::Packet::readFrom".
Doplneno `-fno-sanitize-recover=all`: bez toho UBSan nalez jen VYPISE a test
dobehne uspesne, takze z te poloviny sanitizeru byla ozdoba.
A poznamka do ini o pasti v diagnostice: `pio test` u padu sanitizeru vypise jen
"Program received signal SIGHUP" a ASAN report SPOLKNE -- necti z toho, ze
sanitizer nic nenasel, spust binarku primo.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
snprintf vraci delku BEZ koncove nuly, takze n == sizeof(buf) znamena "presne se
to nevleslo". `if (n > (int)sizeof(buf)) n = sizeof(buf);` to propustilo a
clampovalo na 96, takze u dost dlouheho vyrobce + verze sel na drat i terminator
z buf[95] -- odpoved HW_CMD_GET_DEVICE_NAME s koncovou nulou a tise urizlou verzi.
Spravne `n >= (int)sizeof(buf)` a clamp na sizeof(buf) - 1.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`312a1ef9` pripojil FIRMWARE_VERSION do `handleGetDeviceName()`, aby sla KISS
deska verzne identifikovat. Na desce to jede, na hostu ne: `[env:native_kiss_modem]`
nemel stamping skript (FIRMWARE_VERSION nedefinovan) a `snprintf` si na desce
tahne Arduino.h, kdezto na hostu ho musi dodat `<cstdio>`. Test env tim od
1. 9. 2026 ERRORoval uz ve fazi prekladu -- osm testu, ktere pritom prochazi.
Env dostal `pre:tools/build_version.py` (stejne jako nRF52 envy), zdroj
`#include <cstdio>`. Zadny fallback literal: kdyby stamping vypadl, build spadne,
misto aby deska hlasila verzi, ktera nikdy nebyla pravda.
`pio test -e native_kiss_modem` 8/8.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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>
`xiao_uf2_flash.sh` odmítá hádat cílovou desku a verzi si po flashi přečte
z desky. Serial DFU cesta (`pio run -t upload`) žádnou takovou pojistku
neměla — a dneska to stálo desku: upload s `--upload-port <x4>` ohlásil
FAILED a obraz přistál na x2, desce, která na té příkazové řádce nebyla.
Obě spadly z USB naráz, x2 pak neodpovídal konzoli ani companion protokolu
(KISS modem nemá ani jedno), vypadal jako zaseklý a tři replugy nepomohly,
protože mu nic nebylo. Trvalo hodinu si toho všimnout.
Přibývá `xiao_serial_flash.sh`: cíl se resolvuje ze SÉRIOVÉHO ČÍSLA, před
flashem se otiskne CELÁ sběrnice, po flashi musí cíl hlásit novou verzi
z desky — a všechny ostatní desky musí mít otisk, jaký měly. Ta poslední
kontrola je ta, co chyběla. Selhaný upload se neopakuje (jeden touch na
power session), jen se ohlásí a znovu se zkontrolují ostatní desky.
Otisk dělá nový `board_probe.py`, který se ptá VŠEMI protokoly, co na
lavici jezdí (text / companion / KISS), a openhop_modem s bootloaderem
rozlišuje podle JMÉNA portu, ne podle idProduct — obojí drží 0044.
K tomu dvě věci, na které se přitom přišlo:
- `fleet_test.py` u mlčící desky říkal jen „neodpovida ani konzoli, ani
companion protokolu", což u KISS modemu vypadá jako porucha. Teď se
doptá a napíše, co tam běží.
- KISS build byl z hlediska verzí neidentifikovatelný: `GetVersion` vrací
verzi KISS PROTOKOLU, konzoli nemá, a protože se `FIRMWARE_VERSION`
nikde nepoužívala, linker ji z obrazu vyhodil — takže `xiao_uf2_flash.sh`
ten obraz rovnou odmítl. `handleGetDeviceName` ji teď připojuje k výrobci.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`sendDirect()` u TRACE paketu lepí `path` na konec payloadu bez kontroly, že
se to vejde. Cesta TRACE paketu není omezená na MAX_PATH_SIZE (má to tam
i v komentáři), takže tu kontrolu nikdo jiný neudělá.
Companion guard na CMD_SEND_TRACE_PATH pustí path_len až 178 a hlavička
TRACE má 9 bajtů: 9+176 skončí jeden bajt za `payload[184]`. Ověřeno na
hostu přes všech 194 kombinací path_len/path_sz, které ten guard propustí --
dvě z nich zapíšou mimo a prokazatelně přepíšou `_snr`, člen, který u nás
leží hned za tím polem. Takový paket pak sendPacket() zahodí, protože
překročil MTU, takže zvenčí nikdy nebylo nic vidět. Zápis mimo pole to ale
je, a jde vyvolat z připojeného companion klienta.
ASAN to sám nechytí -- je to přetečení pole uvnitř jedné alokace, ne za její
konec; test to musel doložit tak, že sousedovi nastavil známou hodnotu a
podíval se, jestli zůstala.
Druhou půlku upstream PR #1662 (weebl2000) neberu: kontrola path_len proti
MAX_PATH_SIZE v ne-TRACE větvi je u nás nadbytečná, ta cesta jde přes
Packet::copyPath -> writePath, které víc než MAX_PATH_SIZE odmítne zapsat.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Upstream přečte hlavičku, transport codes, path_len i celou cestu, a teprve
pak se zeptá `if (i >= len)`, jestli v rámci něco z toho bylo. Krátký rámec
se tedy přečte za svým koncem a výsledek se zahodí až potom.
Změřeno ASAN harnessem, který readFrom předává heap buffer alokovaný přesně
na `len` bajtů: na 5 242 880 vygenerovaných rámcích to sáhlo mimo na ČTYŘECH
různých místech (hlavička, oba transport codes, path_len, memcpy cesty).
S kontrolami je stejný průchod čistý a přijme přesně stejných 1 351 424
rámců -- neodmítne nic, co dřív prošlo, jen přestane číst paměť, která nikdy
nepřišla.
Na desce je zdrojem `raw[MAX_TRANS_UNIT+1]` v Dispatcheru, tedy 256bajtové
pole na zásobníku, a tohle do něj sáhne nejvýš ~70 bajtů. Takže se četly
zbytky po předchozím paketu, ne paměť mimo pole -- proto se to nikdy
neprojevilo jako pád a proto je to hygiena, ne díra.
Testy jsou v `test/test_packet/`, ale POZOR: pod `-e native` projdou i bez
téhle změny, protože návratová hodnota je záměrně stejná. Rozdíl je vidět
jenom pod sanitizerem, proto přibyl env `native_asan` -- tam testy krmí
parser bufferem na přesnou délku rámce a bez opravy běh spadne na
`heap-buffer-overflow` hned v prvním případu. Celá sada: 49/49 v obou envech.
Totéž řeší upstream PR #1666 (weebl2000), otevřený a nesloučený od února
2026 -- zasekl se na "chtělo by to unit testy", které tehdy neměl kde psát.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1.17 rozdělil původní `hasSeen()` -- který hash vkládal jen tehdy, když
v tabulce nebyl -- na `wasSeen()` + `markSeen()`, a ten druhý vkládá
bezpodmínečně. Na příjmu se nic nezměnilo, tam je každé volání pod
`!wasSeen()`. Jenže SEND cesty (`Mesh::sendFlood`, `sendDirect`,
`sendZeroHop`) volají `markSeen()` bez brzdy, takže každé opakované
odeslání téhož paketu zabere další slot ze 160položkového kruhu.
Dopady jsou dva. Kruh se plní rychleji, takže se zkracuje dedup okno pro
všechno ostatní a pozdní echo vlastního floodu se může přečíst jako nový
provoz -- na repeateru to znamená, že ho přepošle. A `clear()` maže jen
první nález, takže paket zapsaný dvakrát po jednom `clear()` zůstane
"viděný".
Cena je jeden sken 160x8 B navíc při odeslání, což je proti airtime nic.
Testy pokrývají obojí a bez téhle změny oba padají.
Převzato z ALLFATHER-BV/meshcomod e62be9b (MIT). Upstream to pořád má;
tamní issues #35 a #53 (duplicitní zprávy) na to sedí.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Funkce je nová v 1.17 a krmí `_preambleMillis` / `_maxPayloadMillis` do
stavového `isReceiving()` každého SX126x a LR11x0 wrapperu. Její fallback
pro případ, kdy `getTimeOnAir()` ještě není použitelný, byl napsaný jako
`4000 - preamble_us` -- mělo to znamenat "4 sekundy v nejhorším případě",
jenže jednotka jsou MIKROsekundy, takže to byly 4 ms. Oba operandy jsou
unsigned.
Náš CZ preset (SF8 / BW62.5) má symbol ~4,1 ms a preambuli ~116 ms, takže
odečtení přeteče na ~4,29e9 us a `_maxPayloadMillis` vyjde ~4,29 milionu
sekund. `isReceiving()` pak zachycený header nikdy nevytimeoutuje, hlásí
"právě přijímám" napořád, RX se už nikdy nepřezbrojí -- a uzel ohluchne,
i když dál normálně vysílá. Žádné acky, žádné kanálové zprávy, žádné
adverty, a přitom je ve vzduchu všechno vidět.
Spustí se to jen na desce, kde `getTimeOnAir()` v okamžiku `setParams()`
nevrátí použitelnou hodnotu, což u nás zatím nenastalo. Ale míří to přesně
na náš preset a na všechna naše rádia (SX1262 i LR1110), tak ať tam ta
past neleží.
Převzato z ALLFATHER-BV/meshcomod d6a72f8 (MIT). Upstream to pořád má.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Uzel s `gps duty` odpovídal na telemetrii polohou starou až celý
GPS_DUTY_SYNC_INTERVAL_SECS (u nás 30 min). Dotaz s LOCATION právem teď
předsune nejbližší okno na hned, takže NÁSLEDUJÍCÍ dotaz dostane čerstvou
polohu. Při periodickém sběru to stojí jeden cyklus a nepotřebuje to,
aby uzel cokoli věděl o rozvrhu sběru.
Čekat na fix v rámci té odpovědi nejde: odpověď se skládá a odesílá
synchronně (BaseChatMesh.cpp:290), zatímco warm fix trval na T1000-E
změřených ~65 s -- a klient čeká 10 s. Meshtastic to ostatně řeší stejně,
position request tam vrací poslední známou polohu a GPS jede na vlastním
`gps_update_interval`.
Metoda je na SensorManageru, takže ji mají obě implementace: T1000
(vlastní manager) i EnvironmentSensorManager (SenseCAPy). Budí jen když
uzel opravdu duty-cykluje -- `gps on` už běží a `gps off` je přání
uživatele, které telemetrický dotaz nemá přebíjet.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pwhe5XoCuuEbBCNLvsJBPL
9c033063 spravil persistenci prefs, jenže na T1000-E nebylo co
persistovat: tahle varianta má vlastní T1000SensorManager a celá duty
mašinérie žila jen v EnvironmentSensorManager, který nepoužívá. Slovo
"duty" se ve variants/t1000-e/ nevyskytovalo ani jednou.
Projevilo se to tiše, protože setSettingValue bral všechno nenulové jako
"zapni": `gps:2` tedy vrátilo OK a rozsvítilo GPS naplno. Ověřeno na
a-card — po nastavení i po rebootu hlásila `gps:1`.
Konstanty GPS_DUTY_* se stěhují do SensorManager.h, aby je viděly obě
implementace místo duplikátu.
Jeden záměrný rozdíl proti environment verzi: off-stavem je tady
sleep_gps(), ne stop_gps(). Sleep drží GPS_VRTC_EN, takže si přijímač
nechá almanach a další okno chytá teplý fix; stop shodí i VRTC a platil
by se studený start každých 30 minut — přesně to, čemu se duty vyhýbá.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pwhe5XoCuuEbBCNLvsJBPL
Duty přidal c7c9b812 (6. 8.), ale jen čtecí stranu: MyMesh.h:182 umí
gps_enabled == 2, zapsat ho tam ale nešlo. Dvě upstream místa to mařila,
každé samo o sobě:
* CMD_SET_CUSTOM_VAR uložil `gps:2` jako 0 (podmínka byla boolean),
takže duty se runtime zapnul, ale do prefs se dostala nula;
* a i kdyby se 2 uložila, sanitizace po loadPrefs ji clampovala na 1.
Výsledek: `gps duty` byl na companionu nedosažitelný přes jedinou cestu,
kterou karta má — companion build nemá textovou konzoli ani USB rozhraní.
Karty probe-card i a-card proto jely GPS naplno, tedy o ~46 mA víc,
než je potřeba (měřeno na SenseCAP P1-Pro, viz docs/power-saving.md).
Clamp 0..2 je i v CommonCLI.cpp:137, takže tohle jen srovnává companion
se zbytkem stromu. Displejová cesta (ui-tiny/UITask.cpp:811) zůstává
boolean — karta má NullDisplayDriver, takže na ni nedosáhne.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pwhe5XoCuuEbBCNLvsJBPL
Zadání: projet celý projekt, zarovnat dokumentaci, přidat skilly a hooky —
od zítřka je vzdálené stanoviště dlouho bez rukou, chyby si nemůžeme dovolit.
ZAROVNÁNÍ (místa, kde dokumentace tvrdila něco, co 22. 8. realita vyvrátila):
* AGENTS.md pravidlo o T1000-E portu zpřesněno: „-BOOT" v názvu má APLIKACE;
zakázaný je 1200baud touch a `pio -t upload`, konzole a `dfu uf2` jsou
v pořádku (ověřeno na probe kartě). Desky rozlišovat sériákem: domácí
B612AE… (identita, wedge) vs probe B3F160….
* docs/upstream-prs.md: kandidát na upstream přepsán na skutečný stav —
chyba šířky path hashe je širší než zerohop (i DIRECT s prázdnou cestou
a defaultní argumenty), naše oprava 6aaa8163 hotová a změřená na vzduchu
(0x00→0x40, 18/18); pro PR zbývá port proti `dev`.
* docs/mesh-review-2026-08-19.md: dovětek, že mechanismus 1B hlášení je
u nás opravený; pro čtení cizích uzlů platí dál.
* docs/ble-flash-plan.md: hlavička PROVEDENO 22. 8. s verzemi celé flotily.
* skill mesh-evidence: doplněna záměrná 3B výjimka (MeshCore-TTH doma).
* skill flash-node: poznámka o matoucím jménu portu.
* memory: t1000e-wedge-recovery a cz-mesh-deployment-nodes aktualizovány —
tvrzení, že úsporná vlna Plešivci chybí, UŽ NEPLATÍ (verify prošel celý).
NOVÉ VYNUCENÍ:
* hooks/secrets-guard.sh (PreToolUse, Bash|Read): deny na dump i Read
souborů se secrety (transkript je nešifrovaný a už dvakrát držel heslo),
deny na zakázané příkazy z globálních pravidel (inspekce env kontejnerů,
ykman fido), ask na rotaci hesla přes echující konzoli (únik 22. 8.).
Kanonické vzory (sed do roury, mesh_admin, grep -c) projdou — 10/10 testů.
* hooks/hw-state.sh: varuje u přímého použití ttyACM portů a rovnou přidá
mapu by-id, aby se dalo opravit bez dalšího kola.
* VŠECHNY tři Bash hooky: heredoc těla se před testem VYSTŘIHNOU — hook
zablokoval vlastní commit, protože message nesla názvy zakázaných příkazů;
testuje se kód, ne data. Ověřeno obousměrně (text projde, příkaz spadne).
* skill remote-admin: správa uzlů na dálku — cesty per uzel, pravidlo
jednoho klienta na companion port (stop/start exportéru trapem), co přes
RF nejde, zlaté pravidlo posledních dveří, hodiny, heslo, dohled v Mimiru.
* .gitignore: lokální stav .claude/ (settings.local.json, RESUME.md).
ODJEZDOVÝ STAV (ověřeno čísly, ne službami): second-mast AKTIVNÍ a kompletní
(gps duty s fixem, 8 sat), remote-mast verify-cz-silent 100 % + checklist
~/mc/MAST.md na laptop pro aktivaci bez asistence, karta tichá (repeat off,
0/0), exportér na cabin-host publikuje uptime+battery+scrape-success obou
mast-jednotek do Mimiru, identita probe karty zachráněna do keys.yml
(home-scripts 6c11dc4).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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>
`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>
`ver` on a bench board reported the literal from the upstream header, so
there was no way to tell which build was actually on it -- which is exactly
what AGENTS.md says must never happen for a flashed env. The audit was worse
than expected: of 585 envs in the repo, TWO stamped. The T1000-E only looks
right because it is flashed from a local env in platformio.local.ini.
So the stamping moved into [nrf52_base], where every nRF52 env inherits it,
and the two per-env copies are gone (they would have run the script twice).
Verified on hardware, not just in the ELF: after reflashing, x4 reports
ver -> v1.17.1-tthec20d77+ (Build: 260819 1957)
and x2's device query returns v1.17.1-tthec20d77+ / 260819 2003. The `+`
marks a dirty tree, the sha is the commit that built it.
ESP32/RP2040/STM32 bases can take the same one-liner if boards on those
platforms ever get flashed from here; not done blind.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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>
ContactInfo is filled field by field in three places, and none of them
writes every member:
- CMD_ADD_UPDATE_CONTACT, for a contact the node does not know yet
(companion_radio/MyMesh.cpp): the frame's lat/lon/lastmod are optional,
and clients omit them when the contact has no location -- so
gps_lat/gps_lon keep whatever was on the stack.
- DataStore::loadContacts(), and the same loop in simple_secure_chat: the
on-disk record carries no shared_secret/shared_secret_valid, so those
two members are never written. For every contact, on every boot.
shared_secret_valid is the dangerous one. getSharedSecret() computes the
secret only while the flag is false, so a non-zero byte there makes it
hand out an uninitialised buffer as the ECDH shared secret, and DMs to
that contact go out encrypted with garbage -- no error, no log.
populateContactFromAdvert() already memsets for exactly this reason; do
the same at the other three sites.
Found in the field: a room server whose advert carries no location showed
up at 0.255433, 0.0 in two independent companion clients. 255433 is
0x0003E5C9, straight off the stack. Verified the advert itself is clean by
decoding it in a third, unrelated tool.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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>
room-server-v1.17.0 won describe, and find("v") landed inside "server" --
so every board built tonight would have called itself ver-v1.17.0-tth56e1.
Earlier upstream tags (companion-, repeater-) have no 'v' in the prefix, which
is why this only surfaced now.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`git describe --match '*v[0-9]*'` happily matched
backup/feat-ble-diag-pre-v117-merge -- the safety tag written minutes earlier --
and being the newest tag it won the base version. The T1000-E flashed tonight
therefore reports 'v117-merge-tth7c50c': the sha is right, the base is a tag
name. A pre-flight safety tag must never name the firmware it was protecting.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The v1.17.0 tags sit on da1fc9c0, whose tree is byte-identical to origin/main but
whose history is not an ancestor of ours -- so `git describe` could not see the
release we are actually running, and tools/build_version.py fell back to whatever
tag came next. That was the backup tag from the merge, which is how the T1000-E
ended up reporting 'v117-merge-tth7c50c' instead of a v1.17.0 base.
-s ours because the content question is already settled: our tree came from
origin/main, which has the same tree as this tag. Nothing changes here except
that describe can now find the release.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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>
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>
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>
`i2c` on a SenseCap answered `no I2C device answered; expected-empt`. The cut
is not in transport: the node emits those 37 bytes.
The expected-empty list's first entry is `"; expected-empty %02X"` -- 19 chars
plus a NUL -- assembled in a 16-byte scratch buffer. snprintf() stored 15 chars
and returned 19, the length it WANTED. Using that return as a byte count did
two things: memcpy read 20 bytes out of a 16-byte stack buffer, and the write
cursor advanced past the NUL that had actually been stored, so every following
address landed after the string terminator where nothing would ever read it.
So the list has been invisible on every board since it was added, not just this
one -- which matters, because the whole point of printing the addresses the
build expects is to tell "sensor absent" from "sensor at the wrong address".
Fixed by appending through a helper that measures the source with strlen() and
writes only whole entries, plus buffers sized for the real worst case. A host
reproduction under ASan flags the old path as a 20-byte read of a 16-byte
frame and the new one comes back clean, printing the full
`expected-empty 40 44 76`; in a buffer too small it now stops on an entry
boundary instead of mid-word.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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>
begin() already scans I2C before touching any sensor library, but only into a
MESH_DEBUG log nobody has on a deployed node. So "is that sensor actually there?"
was answerable only by inference from telemetry, and inference is what produced
`TELEM_INA226_ADDRESS=0x40` in our SenseCap envs: a guard against false-detecting
SHT41 at the library default 0x44, written as if an INA226 existed.
It does not. `i2c` on bench-rpt answers "no I2C device" -- the variant has a
single bus (WIRE_INTERFACES_COUNT 1) and nothing on it. That closed a whole line
of "measure the solar node with its own current sensor" work.
Output leads with what answered, then lists the table addresses that stayed
quiet, deduplicated and as bare hex: names for three entries sharing 0x76 alone
overran the 150 B mesh reply and truncated the interesting part.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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>
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>
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>
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>
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>
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>
Correcting a deployment choice I got wrong. I set BOT_IGNORE_SENDERS="tracker"
after observing "tracker: Ping" traffic and assuming the Solo node emitted it
periodically on its own. It does not -- a human types those pings in the mobile
app attached to that node.
Filtering on the sender name therefore gagged the user's own app: every question
typed there would have gone unanswered, which is the exact opposite of what the
node is for. My live !snr test passed only because I sent it from the T1000-E
(name "TTH"), so the misconfiguration never showed up.
The ignore list was also unnecessary for its stated purpose. With BOT_TRIGGER
empty this node reacts only to an explicit !command, and no bot reply ever
contains one, so bot-to-bot feedback cannot start. Empty trigger IS the
arbitration; the filter added nothing but a gag.
Deployed config now has BOT_IGNORE_SENDERS="". The mechanism stays in the
firmware -- it is tested and it would be the right tool if a bare-word trigger
were ever enabled here -- but it must key on something a bot says, not on who
owns the radio a human is typing into.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
#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>
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>
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>
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>
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>
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>
Two halves of the same problem: the stamped version reached the device but
not the client.
RESP_CODE_DEVICE_INFO carries the build date in 12 bytes and the version in
20, NUL included -- 11 and 19 usable characters. The version field is
written with strzcpy() and truncates safely; the build date was a bare
strcpy() into a memset region, so a longer string simply ran past the end
into the manufacturer-name field. It never showed because strzcpy()
overwrote that field on the very next line. Benign today, and driven by a
compile-time constant rather than anything remote, but it is an unbounded
copy into a fixed frame slot and the only reason it was invisible is luck
about the write order. Now strzcpy(..., 12) like every other string there.
The stamp then had to fit. "v1.16.0-tth-0dbaba04" is 20 chars, so the node
reported "v1.16.0-tth-0dbaba0" -- readable, but a character short of the SHA
it was built from. "04 Aug 2026 11:28" is 17, so the time was cut clean off.
Now a 7-char SHA with a "-tth" marker (19 with the dirty '+', 18 without)
and a yymmdd hhmm date (11). The budget never sacrifices the base version or
the dirty marker -- a lost '+' would make an uncommitted build look
reproducible -- and warns instead of truncating silently if it ever cannot
fit.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
build_version.py replaced one hardcoded version with another: it stamped
"v1.16.0-tth-<sha>" with v1.16.0 written into the script. The SHA made the
build identifiable, but the base would have kept claiming v1.16.0 for as
long as nobody remembered to edit this file -- the same stale-by-
construction string the script exists to eliminate.
Now taken from the newest upstream release tag HEAD descends from
(`git describe`, upstream tags them per-example as companion-v1.16.0 /
repeater-v1.16.0, so match any *v[0-9]* and strip the prefix). Our own
release tags carry '+tth.<timestamp>' and are excluded so they cannot
shadow the upstream base.
Also documents the wiring in the header, because the failure mode is
silence: an env that forgets the script builds fine and ships a node that
lies about its own version.
Verified stamping on all nine envs we flash -- T1000E_cmp_cz, the four
XIAO test nodes plus oldble, and the three SenseCap repeaters.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The script has nothing SenseCap-specific in it -- it reads the git SHA and
the clock -- but it sat under variants/sensecap_solar/ and only that
variant referenced it. Everything else silently shipped the hardcoded
literals from examples/*/MyMesh.h ("v1.16.0", "6 Jun 2026"), identical in
every build.
That cost real time tonight. After a 14-minute BLE DFU onto the T1000-E
tracker, every field the node reports back -- ver, fw_build, model,
max_contacts -- was byte-for-byte what it had said before the flash, so
`ver` could not distinguish the new image from the old one. The only
evidence the image had actually landed was the bootloader's own IMAGE ok /
VALIDATE ok. That is sound evidence, but it lives in a log that scrolls
away, not on the device you can query a month later.
Verified after the move: SenseCap_Solar_repeater_ble, SenseCap_ples_rpt and
T1000E_cmp_cz all stamp v1.16.0-tth-<sha> and a build timestamp.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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>
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>
Two diagnostic levers for the BLE/LoRa coexistence work, plus a correction to
what the existing tx power call actually does.
Bluefruit.setTxPower(8) is ADVERTISING power only. Bluefruit stores the value
and BLEAdvertising::start() hands it to sd_ble_gap_tx_power_set() with
BLE_GAP_TX_POWER_ROLE_ADV; nothing in the library ever sets the CONN role, so an
established link runs at the SoftDevice default of 0 dBm. The +8 buys discovery
range and nothing else. Confirmed on hardware: `blepwr` reports
"conn tx: 0 dBm, adv tx: 8 dBm".
- RPT_BLE_CONN_TX_POWER (default 0 = unchanged behaviour), applied per
connection on every 'secured' since the handle is new each time.
- `blepwr [dBm]` sets it at runtime over serial, the BLE console or the mesh
admin CLI. Runtime rather than a build flag because a dose-response sweep
needs many points and reflashing the XIAO costs a physical UF2 dance.
- Auto-revert after 5 min (`blepwr <p> hold` opts out). Without it the command
locks you out of the console you would need to undo it: the value is
re-applied on every 'secured', at -20 dBm the node's replies stop arriving and
at -40 dBm a connection cannot be established at all. Hit this on the bench;
recovery was over USB, and on the mast the only way back would be `reboot`
over the mesh admin CLI.
- `bleconn` reports the connection parameters actually in force. bleOnSecured()
only REQUESTS 15-30/60-80 ms and the central may refuse, so without reading
them back "the pre-fix interval showed no loss either" cannot be told apart
from "the pre-fix interval was never in force". Latched once a second from
loop() so it can be read over USB after the central is gone -- reading it over
the BLE console while connected would collide on the shared command[160].
Measured with these: at a verified 22.50 ms interval, sweeping the connection
tx power from 0 to -20 dBm (RSSI -67..-87 at the central, covering the whole
-75..-90 window the mast sits in) produced zero lost DIRECT forwards, with
tx_timeout and tx_start_fail at zero in every cell.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
bleWriteAll used to spin-retry with delay(3) when the SoftDevice
notification queue was full, stalling loop() up to ~0.9 s per call
while a client streamed the console (rxlog/pktlog drains). That is
long enough to disturb LoRa RX/TX timing on the relay path.
Replace with a 4 KB ring buffer: bleWriteAll only enqueues, and
bleTxPump() (each loop pass) hands the SoftDevice as much as it will
take right now — zero waiting. Overflow truncates the newest bytes;
a torn page loses its 'E,' trailer so the bridge re-requests the
same cursor.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fewer SoftDevice connection events = fewer LoRa TX collisions (the
measured driver of the direct-forward loss); the Dispatcher TX retry
covers the residue. Bigger pktfeed ring buys margin for the bridge's
new connect->drain->disconnect duty cycle (~3-4 min between drains).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A TX that fails to start (startTransmit error) or never completes
(send-complete IRQ lost) was released permanently — with an nRF52
SoftDevice servicing BLE connection events this silently ate ~40 % of
DIRECT-route forwards (measured A/B on mast-three: direct_rx +5 / direct_tx
+3 with an idle BLE connection, 5/5 with BLE off). Flood redundancy
masked the same loss for flood traffic.
Retry up to MESH_TX_RETRIES (3) with a short growing backoff; a
duplicate on air is harmless (hasSeen dedup). New tallies
tx_start_fail/tx_timeout in stats-packets + ERR_EVENT_TX_* flags make
this failure class visible at last.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Small sibling ring to rxlog (PKTFEED_SIZE=32, ~8.6 KB) that keeps the FULL
raw frame bytes: staged pre-parse in logRxRaw, committed post-parse in logRx
(radio garbage never enters). Paged `pktlog [cursor]` mirrors rxlog paging;
the bridge derives route/type/payload and the MeshCore SHA packet hash
(analyzer correlation key) from raw, so the radio hot path stays SHA-free.
No 'always emit >=1' here: a ~550 B record line would overflow the 150 B
mesh-CLI budget — there the reply degrades to a bare trailer.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The BLE bridge drain was throttled by three multiplied costs: 150 B pages
(~3 rxlog records), 20 B NUS notification chunks, and the bridge waiting for
line silence per page. This fixes the firmware half:
- handleCommand() takes an explicit reply_max (default 150). The local console
(USB/BLE) passes ~1000 B -> ~20 rxlog records / ~7 nodes lines per round
trip; the mesh admin CLI keeps 150 so its reply still fits one LoRa packet.
Explicit parameter on purpose: a forged sender_timestamp==0 from the mesh
path must never be able to grow the reply past its 166 B buffer.
- bleWriteAll() chunks by negotiated MTU (247 -> 244 B) instead of fixed 20 B.
- Tables sized from channel physics instead of last week's traffic:
RXLOG_SIZE 512 = ~2 min of a saturated SF8/62.5k channel (~2-4 frames/s),
MAX_HEARD_NODES 128 > distinct nodes heard per neighbour advert period
(48 filled in <2 h and churned out real 0-hop neighbours).
- Page-sort scratch arrays moved off the loop-task stack into BSS.
RAM 17.7% -> 25.3% (59.6 KB / 235 KB). Flashed via BLE DFU 2026-07-15.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Daytime advert bursts (an advert plus its copies from surrounding repeaters
arrive within seconds) overflowed the 96-slot ring between BLE bridge drains --
~250 dropped records/h in meshcore_rxlog_dropped_total, zero at night. 256
records at ~32 B each costs +5 KB RAM (17.7% total on nRF52840). Paired with
bridge-side tuning (drain page cap 20 -> 60, poll 5 s -> 2 s in home-scripts).
Flashed to mast-three.example via BLE DFU 2026-07-14.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The path field emitted raw hex, but the hop-hash width (1/2/3 B, top 2 bits of
path_len) wasn't visible in it -- the bridge couldn't tell "A31FC2" from three
1-byte hops vs one-and-a-half 2-byte hops. Emit hops colon-separated instead
("A3:1F:C2" vs "A31F:C204"): each token is one hop, its width is len/2. Field
order/count is unchanged (path stays the same column), so the bridge only
changes how it splits that one token. Shared helper analyzer_path_hex() used by
both nodes and rxlog. (`HEX` had to be a local name other than the Arduino
Print.h `HEX` macro.)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Two related improvements to how heard nodes are represented:
1. Multi-path. A node's advert reaches us via several paths at once, but the
mesh dedups by payload hash (path not hashed) so onAdvertRecv sees only the
first copy -> `nodes` kept one path. rxlog, however, is fed pre-dedup and
logs every copy with its own path+SNR. Add the advert's FNV id (`pkt_hash`)
to each `nodes` row as a JOIN KEY: the bridge groups rxlog by pkt_hash and
joins to nodes to reconstruct every route a named node arrived by. New
`nodes` field: N,...,<age>,<pkthash>,<path>,<name> (name now after 10th comma).
2. Prefer direct. onAdvertRecv often processes a relayed copy first (stronger),
so the direct 0-hop link was being overwritten by a relayed path -- the
direct neighbours only showed up via the old `neighbors` path. Track
`direct_heard`; keep the direct (empty) path + its SNR for
HEARD_DIRECT_TTL_SECS after last hearing the node 0-hop.
Shared FNV helper (analyzer_frame_id) now used by both captureRx and
putHeardNode so nodes.pkt_hash == the rxlog copies' pkt_hash exactly.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
btmon shows the disconnects are HCI reason 0x3E (Connection Failed to be
Established / lost sync), not supervision timeout -- so widening the timeout
didn't help. The mast link is weak (RSSI -75..-90) and the node is busy with
LoRa; with slave latency 4 the peripheral may skip connection events, so the
central loses sync and reports 0x3E. Respond on every event (latency 0) to
maximise sync on a weak/busy link.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
6 s cut the reconnect churn from every 15-30 s to every ~60 s but didn't
eliminate it: under the bridge's real polling load the node shows a
periodic multi-second stall (advert TX airtime / SoftDevice-LoRa
coexistence) that occasionally exceeds 6 s. Widen the supervision timeout
to 16 s so those stalls are tolerated; a genuine freeze is still caught by
the 20 s hardware watchdog (16 s < 20 s).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The BLE console link dropped every ~15-30 s and the bridge kept
reconnecting. Root cause: Bluefruit's default supervision timeout is only
2 s, and this repeater relays heavy LoRa flood traffic, so main-loop /
radio coexistence stalls past 2 s and the central tears down the link.
Mirror the companion's proven approach (explicit sd_ble_gap_conn_param_update
on 'secured', since some centrals ignore the advertised PPCP) but widen the
supervision timeout to 6 s (a repeater is far busier than a client), with a
15-30 ms interval and slave latency 4. PPCP is also set before advertising.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
captureRx() ran calculatePacketHash() (SHA-256) on every received frame in
the logRx hot path. The mesh core already computes that SHA once per frame
in hasSeen() during routing, so the analyzer was doubling the crypto load
on the radio-shared main loop for no benefit.
Replace pkt_hash with a cheap FNV-1a over (type||payload): same purpose
(dedup / correlation across nodes running this FW), a fraction of the CPU.
RAM-only, no flash writes, still main-loop (not ISR) -- so this does not by
itself explain BLE link drops (those match the known SoftDevice/LoRa
coexistence instability the BLE watchdog already guards), but it removes
the one real RX-path cost the analyzer added.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Two RAM-only, opt-in tables fed from the normal RX path and pulled out
over the text console (serial / BLE) for a BLE bridge + map to consume.
Both are compiled out unless the build sets a non-zero size; enabled on
SenseCap_Solar_repeater_ble (-D MAX_HEARD_NODES=48 -D RXLOG_SIZE=96,
~6 KB RAM).
nodes [offset] -- registry of heard REPEATERS and ROOM SERVERS (chat
clients are deliberately skipped: personal/mobile devices, privacy).
Per node: pubkey prefix, name, type, lat/lon, last SNR/RSSI, seconds
since heard, and the path the advert arrived by. Fed from onAdvertRecv
(adverts are signature-verified upstream). -> map dots + topology
edges + link quality.
rxlog [cursor] -- circular firehose of EVERY parsed frame heard, fed
from logRx() (synchronous, so SNR/RSSI belong to that frame). Per
record: monotonic seq (paging cursor), time, packet hash, header
(route|type), SNR/RSSI, hop path. -> live traffic / analyzer view.
Both replies are paged to stay within the ~160 B console reply cap and
carry a trailer (next cursor + totals) so the bridge can drain and detect
if it fell behind the ring. Reachable over serial, the PIN-paired BLE
console and the admin mesh CLI, same as `neighbors`.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
SNR was already stored on the Packet at parse time, but RSSI was only
transiently available via Radio::getLastRSSI() -- valid synchronously in
checkRecv(), but stale by the time a score-delayed flood packet reaches
its handler (onAdvertRecv etc.). Store RSSI alongside _snr so downstream
code (e.g. the mesh analyzer) gets the correct last-hop RSSI regardless
of when it reads it.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sensor read only called querySensors(), so it missed the node's own battery voltage and built-in MCU temperature (added separately in the mesh-telemetry path) — hence only one temperature showed. Now mirror that assembly (addVoltage + querySensors + MCU addTemperature). Decode keys every field by its LPP channel (temperature.1 = MCU, temperature.2 = ambient, etc.) so same-type values no longer collide, and skip unknown LPP types by their known size instead of break-ing (which silently dropped everything after e.g. INA226 power).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add [secrets] ble_pin mechanism: envs use ${secrets.ble_pin}, the committed default is a non-secret placeholder, and the real PIN lives only in the git-ignored platformio.local.ini. Move INA226 to 0x40 (frees 0x44 for SHT41), skip flaky GPS detection on SenseCap, and use a local framework symlink for the nRF52 short-SHA fork.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Repeater can be queried over BLE Nordic-UART (advert/neighbours/stats) without USB. Fix SoftDevice-protected TEMP peripheral access (sd_temp_get) that crashed BLE repeater telemetry, add USB-connected detection to ArduinoSerialInterface, and adjust the nRF52 ldscript/extra FS.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Backport of PR #1779 (BLE companion usable over USB while BLE disconnected), plus: track the active transport (secure-transport gating), and stop BLE advertising while a USB host is connected (docked) so the node stays quiet on 2.4 GHz; resume advertising when undocked. An active BLE link is never force-disconnected.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add virtual BaseSerialInterface::isConnectionSecure() (default true). On the dual interface it is true only for MITM-paired BLE. Gate CMD_EXPORT_PRIVATE_KEY and CMD_SET_DEVICE_PIN, and hide the BLE PIN in CMD_DEVICE_QUERY, when the frame arrived over unauthenticated USB.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>