Update a repeater's firmware from the app, as its admin, over the mesh -- typically standing under a mast with a companion (T1000-E, Wio L1, ...) 0 hops from the repeater. The firmware side exists in meshcore-tth (*-ota / *-observer-ota images, fw ... admin commands); the reference client is a Python tool. This issue is about porting that client into the app.
Admin login to a repeater and a CLI screen (repeater_login_dialog.dart, repeater_cli_screen.dart).
Binary requests through the companion: cmdSendBinaryReq and pushCodeBinaryResponse (meshcore_protocol.dart). The firmware chunks travel as exactly these.
http, crypto (sha256) and cryptography (Ed25519) as dependencies.
What to add
1. Find the package (~1 day)
fw status on the node gives the running image's size and sha256 prefix (its delta base).
From the public releases of tth-pub/meshcore-tth (no token needed), pick the delta <artifact>-<tag>.from-<base tag>.mcfw that starts from that base, download it and check its sha256 against SHA256SUMS.
Checking the ssh signature of SHA256SUMS (namespace meshcore-ota, key in tools/ota_allowed_signers) is nice to have but not a safety requirement. The node checks the package's own Ed25519 manifest signature, target, base and version, and refuses a wrong package after its first chunks.
Only deltas: the node refuses a full image over the mesh (fw begin > 64 kB).
2. Transfer (~1-2 days), port of ota_mesh_push.py
fw begin <bytes> <sid>.
Binary chunks REQ_FW 'w': sid, offset, crc16 and 128 B of data. They get no reply.
Bitmap query 'm' for the missing units. Further rounds while the list shrinks; text fw w <off> <base64> as the fallback.
fw verify (poll fw status while it says verifying), then fw apply. Wait ~60 s, log in again, ver and fw status confirm the new image.
Also needed:
Airtime budget: a token bucket, as --duty in the tool. The default must stay polite on a shared channel.
Resume: the node keeps received chunks until the next fw begin or a reboot, so a stopped transfer continues with fw missing + text chunks, no new begin (--resume in the tool).
Lost replies are normal: retry the bitmap query, never throw away a whole round because of one missing answer.
3. UI (~1 day)
Repeater hub: "Firmware update" -- current version, the target version, delta size, estimated airtime/time.
Progress with chunks, rounds and airtime used; Cancel; an explicit confirmation before fw apply.
Keep the screen on or run a foreground service for the transfer: Android drops the BLE link to the companion when the app goes to the background.
Numbers and constraints
0 hops at SF7: a 25 kB delta is about 40 s on air, i.e. roughly 7-10 minutes at the 10 % duty cycle of 869.4-869.65 MHz.
fw apply refuses below 3.8 V on battery; force is local-console only and must not be offered over the mesh.
A power cut during the ~30 s rewrite leaves the node in its bootloader: no half image runs, but recovery needs USB/BLE DFU on site. The UI should say so before apply.
Testing
On the bench: phone -> companion -> XIAO repeater on an *-observer-ota image. Cover a clean run, a transfer interrupted mid-way and resumed, a package for the wrong base (refused after the manifest), and the app going to the background mid-transfer.
## Goal
Update a repeater's firmware from the app, as its admin, over the mesh -- typically standing under a mast with a companion (T1000-E, Wio L1, ...) 0 hops from the repeater. The firmware side exists in [meshcore-tth](https://git.rfa.cz/tth-pub/meshcore-tth) (`*-ota` / `*-observer-ota` images, `fw ...` admin commands); the reference client is a Python tool. This issue is about porting that client into the app.
Firmware side and protocol:
- https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/docs/ota.md
- https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/src/helpers/FwUpdate.cpp
- reference client: https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/tools/ota_mesh_push.py
- package lookup and checks: https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/tools/ota_pack.py (`fetch`)
## What the app already has
- Admin login to a repeater and a CLI screen (`repeater_login_dialog.dart`, `repeater_cli_screen.dart`).
- Binary requests through the companion: `cmdSendBinaryReq` and `pushCodeBinaryResponse` (`meshcore_protocol.dart`). The firmware chunks travel as exactly these.
- `http`, `crypto` (sha256) and `cryptography` (Ed25519) as dependencies.
## What to add
### 1. Find the package (~1 day)
- `fw status` on the node gives the running image's size and sha256 prefix (its delta base).
- From the public releases of `tth-pub/meshcore-tth` (no token needed), pick the delta `<artifact>-<tag>.from-<base tag>.mcfw` that starts from that base, download it and check its sha256 against `SHA256SUMS`.
- Checking the ssh signature of `SHA256SUMS` (namespace `meshcore-ota`, key in `tools/ota_allowed_signers`) is nice to have but not a safety requirement. The node checks the package's own Ed25519 manifest signature, target, base and version, and refuses a wrong package after its first chunks.
- Only deltas: the node refuses a full image over the mesh (`fw begin` > 64 kB).
### 2. Transfer (~1-2 days), port of `ota_mesh_push.py`
1. `fw begin <bytes> <sid>`.
2. Binary chunks `REQ_FW 'w'`: sid, offset, crc16 and 128 B of data. They get no reply.
3. Bitmap query `'m'` for the missing units. Further rounds while the list shrinks; text `fw w <off> <base64>` as the fallback.
4. `fw verify` (poll `fw status` while it says `verifying`), then `fw apply`. Wait ~60 s, log in again, `ver` and `fw status` confirm the new image.
Also needed:
- **Airtime budget:** a token bucket, as `--duty` in the tool. The default must stay polite on a shared channel.
- **Resume:** the node keeps received chunks until the next `fw begin` or a reboot, so a stopped transfer continues with `fw missing` + text chunks, no new `begin` (`--resume` in the tool).
- **Lost replies are normal:** retry the bitmap query, never throw away a whole round because of one missing answer.
### 3. UI (~1 day)
- Repeater hub: "Firmware update" -- current version, the target version, delta size, estimated airtime/time.
- Progress with chunks, rounds and airtime used; Cancel; an explicit confirmation before `fw apply`.
- Keep the screen on or run a foreground service for the transfer: Android drops the BLE link to the companion when the app goes to the background.
## Numbers and constraints
- 0 hops at SF7: a 25 kB delta is about 40 s on air, i.e. roughly 7-10 minutes at the 10 % duty cycle of 869.4-869.65 MHz.
- `fw apply` refuses below 3.8 V on battery; `force` is local-console only and must not be offered over the mesh.
- A power cut during the ~30 s rewrite leaves the node in its bootloader: no half image runs, but recovery needs USB/BLE DFU on site. The UI should say so before apply.
## Testing
On the bench: phone -> companion -> XIAO repeater on an `*-observer-ota` image. Cover a clean run, a transfer interrupted mid-way and resumed, a package for the wrong base (refused after the manifest), and the app going to the background mid-transfer.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Goal
Update a repeater's firmware from the app, as its admin, over the mesh -- typically standing under a mast with a companion (T1000-E, Wio L1, ...) 0 hops from the repeater. The firmware side exists in meshcore-tth (
*-ota/*-observer-otaimages,fw ...admin commands); the reference client is a Python tool. This issue is about porting that client into the app.Firmware side and protocol:
fetch)What the app already has
repeater_login_dialog.dart,repeater_cli_screen.dart).cmdSendBinaryReqandpushCodeBinaryResponse(meshcore_protocol.dart). The firmware chunks travel as exactly these.http,crypto(sha256) andcryptography(Ed25519) as dependencies.What to add
1. Find the package (~1 day)
fw statuson the node gives the running image's size and sha256 prefix (its delta base).tth-pub/meshcore-tth(no token needed), pick the delta<artifact>-<tag>.from-<base tag>.mcfwthat starts from that base, download it and check its sha256 againstSHA256SUMS.SHA256SUMS(namespacemeshcore-ota, key intools/ota_allowed_signers) is nice to have but not a safety requirement. The node checks the package's own Ed25519 manifest signature, target, base and version, and refuses a wrong package after its first chunks.fw begin> 64 kB).2. Transfer (~1-2 days), port of
ota_mesh_push.pyfw begin <bytes> <sid>.REQ_FW 'w': sid, offset, crc16 and 128 B of data. They get no reply.'m'for the missing units. Further rounds while the list shrinks; textfw w <off> <base64>as the fallback.fw verify(pollfw statuswhile it saysverifying), thenfw apply. Wait ~60 s, log in again,verandfw statusconfirm the new image.Also needed:
--dutyin the tool. The default must stay polite on a shared channel.fw beginor a reboot, so a stopped transfer continues withfw missing+ text chunks, no newbegin(--resumein the tool).3. UI (~1 day)
fw apply.Numbers and constraints
fw applyrefuses below 3.8 V on battery;forceis local-console only and must not be offered over the mesh.Testing
On the bench: phone -> companion -> XIAO repeater on an
*-observer-otaimage. Cover a clean run, a transfer interrupted mid-way and resumed, a package for the wrong base (refused after the manifest), and the app going to the background mid-transfer.Chybi tlacitko na zjisteni verze ktery by rovnou napsalo ze fw je aktualni a neni potreba update