Commit Graph
1032 Commits
Author SHA1 Message Date
tthandClaude Opus 5 fae1828a5d fix(kiss): off-by-one v clampu delky jmena zarizeni
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>
2026-09-02 18:19:40 +02:00
tthandClaude Opus 5 3865b012cf fix(kiss): host testy se od 1. 9. neprekladaly, nikdo si toho nevsiml
`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>
2026-09-02 02:22:05 +02:00
tthandClaude Opus 5 a043033910 Merge remote-tracking branch 'origin/dev' into main
58 commitů upstreamu nad v1.17.1. Šest konfliktů, všechny ručně:

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

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

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

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 02:19:04 +02:00
tthandClaude Opus 5 312a1ef9d6 fix(tools): flash přes serial DFU teď dokáže, že šel tam, kam měl
`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>
2026-09-01 22:52:51 +02:00
tthandClaude Opus 5 9383ec2221 feat(telemetry): dotaz na polohu nahřeje duty-cyklovanou GPS na příště
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
2026-09-01 00:19:09 +02:00
tthandClaude Opus 5 9c0330631c fix(companion): gps duty jde konečně uložit — dvě místa ho přepisovala
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
2026-08-31 22:20:49 +02:00
fdlamotte dcd931fa2e Merge branch 'dev' into node_discover_ui 2026-08-29 11:02:58 -04:00
liamcottle 599ecfcb65 fix cad cli command on companion 2026-08-27 19:05:18 +12:00
Liam Cottle 5edc936301 Merge pull request #3298 from meshcore-dev/companion-cli
Companion CLI
2026-08-27 18:17:10 +12:00
Scott Powell 6239b462f2 * companion: fix for setSpreadFactor(). "set cad ..." and "board" now implemented. 2026-08-24 20:44:17 +10:00
Scott Powell 71deb27b7e * prefs, custom dirty state 2026-08-24 17:22:15 +10:00
Scott Powell 5a7bc507d1 * new DynamicConfigSerializer
* board/variant KeyValueStore now can write to 'custom' object in Json prefs
2026-08-24 17:12:56 +10:00
liamcottle 2136978378 add UI_NO_HIBERNATE build flag to disable hibernate screen on wio tracker l1 2026-08-24 13:45:19 +12:00
Scott Powell 8c73c948b4 * T096, and Station G3: refactoring the 'FEM' prefs to variant-specific code
* CommonCLI: 'FEM' commands removed
* introduced static no-op attachDynamicPrefs() for all boards
2026-08-24 01:50:22 +10:00
Florent a9c977db51 ui: opt-out for discover screen 2026-08-23 10:42:00 -04:00
Scott Powell ae61e1a61c support for CMD_SEND_TXT_MSG and new TXT_TYPE_CLI_COMMAND 2026-08-23 22:49:45 +10:00
Scott Powell 644e68d0ff * new TXT_TYPE_CLI_COMMAND (3) 2026-08-23 22:04:05 +10:00
Scott Powell 2c43bf1ba1 legacy queueMessage() case, eg. repeater replies 2026-08-23 20:07:28 +10:00
Scott Powell a29ccab178 onCommandDataRecv() use '>' prefix for CLI replies. 2026-08-23 20:03:49 +10:00
Scott Powell df507deac9 "Unknown command" replies 2026-08-23 19:35:43 +10:00
Scott Powell f66ed7ca88 * CommonRadioPrefs refactors done 2026-08-23 17:30:30 +10:00
Scott Powell 414e91fd5d * adding new CommonRadioPrefs
* refactor: moving various radio CLI handling to CommonRadioPrefs
2026-08-23 14:45:15 +10:00
tthandClaude Opus 5 6aaa816386 fix(mesh): šířku path hashe bere každá TX cesta z prefs uzlu, ne z konstanty
Ranní 4caf52bb spravil jen sendZeroHop() a jen tam, kde mu volající šířku
předal. Zbylo dvoje místo, kde uzel s `path.hash.mode 1` pořád vysílal
hlavičku s 1 B:

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

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

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

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

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

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

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

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

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

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

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-22 15:04:52 +02:00
Florent 2678be75bd ui: repeater discover screen 2026-08-21 18:24:46 -04:00
entr0p1 93bd279d34 Duplicate MAX_CLIENTS definition
MAX_CLIENTS is defined in both src/helpers/ClientACL.h and examples/simple_repeater/MyMesh.h. Appears it was centralised in the former header file some time ago. Both are included in some places and, depending on which order they're in, either value can win.

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

Changes:
- Remove MAX_CLIENTS from repeater MyMesh.h
- Increase MAX_CLIENTS limit in ClientACL.h to 32
2026-08-21 15:11:57 -04:00
Scott Powell 5eaf5a86fb * initial wiring/routing of CLI commands to companion (either via app/serial interface, or remotely via txt message) 2026-08-21 20:55:57 +10:00
ripplebiz 1a8d860d8d Merge pull request #3233 from entr0p1/fix/centralise-max-clients
Fix duplicate MAX_CLIENTS definition
2026-08-20 14:09:30 +10:00
tthandClaude Opus 5 f80fcc0587 feat(repeater): report the TX-failure counters in the RF status reply
A repeater that keeps failing to get its transmits out looks perfectly
healthy over RF: sent/airtime just stop growing and nothing in the status
says why. The Dispatcher already counts those failures (n_tx_start_fail,
n_tx_timeout, from the requeue path); this puts them on the air.

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

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

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

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

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 19:42:20 +02:00
hansimgamrandClaude Opus 4.8 cdff1a5f4f Show plug at >=95% instead of exactly 100%
Boards without a charge-complete signal only infer "full" from voltage, and
a real pack rarely reads the full BATT_MAX_MILLIVOLTS (4.2V), so the plug icon
was effectively never shown. Treat "full" as a high band (>= 95%) so the plug
appears when the battery is charged rather than requiring an exact 100%.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-19 12:44:41 -04:00
hansimgamrandClaude Opus 4.8 0c72b517e8 Add charging indicator to companion_radio battery icon
Show a small lightning-bolt icon to the left of the battery indicator on
the ui-new home screen while the device is externally powered, and a plug
icon once the battery reads full. The bolt/plug sits beside the battery so
the fill bar stays clean and uninterrupted. When a buzzer is present, the
mute icon shifts one slot further left so the two never overlap.

Charging state is derived from board.isExternalPowered(), so this works on
any board that reports external power (e.g. the nRF52 VBUS-detect path).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-19 12:44:41 -04:00
tthandClaude Opus 5 1614cb3e48 fix(contacts): zero ContactInfo before a partial fill
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>
2026-08-19 12:27:43 +02:00
liamcottle b123971e21 fix for 3-byte paths passed to CMD_SEND_RAW_DATA 2026-08-19 18:59:24 +12:00
Huw Duddy eea89dfd1c Merge pull request #3235 from meshcore-dev/send-raw-direct-fix
Fix for CMD_SEND_RAW_DATA and multi-byte paths
2026-08-19 11:32:34 +10:00
fdlamotte ed227b9cb6 Merge pull request #3180 from fdlamotte/thinknode_m8
thinknode_m8: initial support

adds some functionalities to ui_task and epddisplay:

epd display, 
- supports screen off, and clear screen
- supports forcing full refresh every N partial refreshes (off by default, configured to 60 for M8)

ui_task
- UI_SHOW_CLOCK flag to display clock on first screen
- rotary button can act like joystick (with regards to Enter key), defaults to old config for existing nodes
- screen off on long press when using rotary button (very handy for the watch)
2026-08-18 09:33:42 -04:00
Rastislav Vysoky d1a2a0c20b repeater: set loop.detect to minimal as default for new installs 2026-08-18 14:56:58 +02:00
Scott Powell 44bbf74fbf Fix for CMD_SEND_RAW_DATA and multi-byte paths 2026-08-18 13:11:15 +10:00
Florent c54139f7db M8: preview messages up to 164 cars 2026-08-17 09:24:17 -04:00
entr0p1 11a02eeaba Duplicate MAX_CLIENTS definition
MAX_CLIENTS is defined in both src/helpers/ClientACL.h and examples/simple_repeater/MyMesh.h. Appears it was centralised in the former header file some time ago. Both are included in some places and, depending on which order they're in, either value can win.

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

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

What matters for our nodes:

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

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 14:13:50 +02:00
Scott Powell cad602e416 * version 1.17.1 2026-08-14 22:19:19 +10:00
Scott Powell 5ff2d7109b * commenting out the load/save of the fem_ properties, until they can be set 2026-08-14 16:30:12 +10:00
ripplebiz f8832af086 Merge pull request #3106 from ViezeVingertjes/fix/scoped-reply-routing
Fix replies dropped when flood.max.unscoped is low
2026-08-13 15:00:37 +10:00
ripplebiz d5949f93d8 Merge pull request #3137 from agessaman/feat/station-g3-fem-prefs
Station G3: Expose, persist, and apply FEM gain preferences
2026-08-12 16:11:23 +10:00
Florent 109ed685b2 thinknode_m8: initial support 2026-08-11 17:37:35 -04:00
agessaman f82950f311 feat(companion_radio): add external FEM gain preferences for RX and TX for companions
Introduced consistent preferences for external LoRa FEM RX and TX gain settings in NodePrefs. Updated companion MyMesh to apply these settings during initialization and transmission. Added unit tests to verify the round-trip serialization of these new preferences.
2026-08-10 11:59:26 -07:00
tthandClaude Opus 5 9d5491f5db Merge upstream v1.17.0 (origin/main) into the analyzer/BLE fork
Upstream shipped companion/repeater/room-server v1.17.0 today; its tree is
identical to origin/main, so that is what this merges. Our base was 7 Jul
(7b566670), i.e. 350 files / +11k lines of upstream behind.

Conflicts and how they were settled:

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

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

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

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

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

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

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

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

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

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

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-09 22:24:59 +02:00
Scott Powell 49319023e5 Merge branch 'dev'
# Conflicts:
#	docs/payloads.md
2026-08-09 14:36:53 -04:00
Scott Powell 68dedd3e96 * version 1.17.0 2026-08-09 15:14:46 +10:00