mirror of
https://github.com/jhuebert/MeshCore.git
synced 2026-12-03 10:54:13 +00:00
docs: document the online OTA commands and asset rename
Add ONLINE_OTA.md with setup, the ver/sha/start flow, digest syntax, errors, fleet recipes and limits. Update the README, fleet recipe, docs map and pending release notes. The tag prefix stays filter-v for now; the planned rename away from filter naming is noted in the code and docs.
This commit is contained in:
1 parent
12130c15ed
commit
6bae4e8a77
5 files changed
+271
-12
No files matched your search
@@ -81,6 +81,11 @@ should not need to explore beyond them before making a change.
|
||||
bits, never change existing ones; (5) `REQ_TYPE_OTA` is fork-private `0xA0`,
|
||||
outside upstream's `0x01..0x09` REQ range (`0x08` is upstream's `subscribe`);
|
||||
the app's `reqTypeOta` constant changes with it.
|
||||
- `ONLINE_OTA.md`: online OTA over WiFi for repeater observer builds. The user
|
||||
manual for the three commands (`ota fetch ver`, `ota fetch sha`,
|
||||
`ota fetch start`), `ota net` progress, the frozen `ota status` line, digest
|
||||
syntax, errors 10 to 16, fleet recipes and limits. Observer-only: setting
|
||||
ver/sha touches no WiFi, and non-observer builds compile no adapter.
|
||||
|
||||
**New top-level features need two docs in the same commit:** a paragraph in
|
||||
`README.md` describing the feature, and a dedicated, user-focused guide (like
|
||||
@@ -144,7 +149,20 @@ same commit**. The guides are user-facing API documentation, not optional docs.
|
||||
(`Esp32SlotIo`) and the all-state `OP_INFO` negotiation handshake. Ops ride
|
||||
inside admin REQ/RESPONSE datagrams (`REQ_TYPE_OTA`, dispatched by
|
||||
`handleRequest`); the boot health probe is the one zero-hop RAW_CUSTOM
|
||||
OP_NOP. The wire contract is frozen in the header; treat it as such.
|
||||
OP_NOP. The wire contract is frozen in the header; treat it as such. It also
|
||||
exposes the local staging API (`beginLocalStage`/`appendLocalStage`/
|
||||
`finishLocalStage`/`cancelLocalStage`) used by the online download and the
|
||||
appended `0x40` feature bit. Frozen replies and report layouts are unchanged.
|
||||
- `OnlineOtaPolicy.h`: pure, Arduino-free version normalization, SHA-256 token
|
||||
parsing and release URL construction. The tag prefix (`filter-v`) is one
|
||||
macro here, pending the planned rename away from "filter" naming.
|
||||
- `OnlineOtaCore.h/.cpp`: RAM-only async download state machine (wifi, clock,
|
||||
asset, verify, ready, error) driven one bounded step per `loop()`. Three CLI
|
||||
steps (ver, sha, start) store inputs before any network work. No persistence.
|
||||
- `OnlineOtaNet.h/.cpp`: narrow network interface and its ESP32 observer
|
||||
adapter: station request, HTTPS GET with the framework CA bundle, bounded
|
||||
redirects, Content-Length via `contentLength()` and one reused 2 KiB chunk.
|
||||
Compiled only under `ESP32 && WITH_MQTT_OBSERVER`.
|
||||
- `MyMesh.cpp/.h`: upstream files carrying the fork's hook lines
|
||||
(`allowPacketForward`, `onGroupDataRecv`, `logRx` (profile stamp + ack repeat
|
||||
detector), `logRxRaw`/`logRx`/`logTx` observer capture, `searchChannelsByHash`,
|
||||
@@ -222,7 +240,9 @@ timing bounds, scheduler states, deferred apply, persistence and the `radio2`
|
||||
CLI) and `test/test_mqtt_observer/` (config codec +
|
||||
record framing, URI/topic builders, CLI and slot parsing, JWT renewal, the
|
||||
connect gates, queue/retry policy, the liveness probe, and the
|
||||
status/packet/raw JSON schema). Test-only shims:
|
||||
status/packet/raw JSON schema) and `test/test_online_ota/` (version and digest
|
||||
parsing, URL construction, every core phase and error with a fake network,
|
||||
CLI replies and local staging on the real OTA engine). Test-only shims:
|
||||
`NativeShim.h`, `NativeTestStubs.cpp`, `RegionMapStub.cpp`,
|
||||
`FilterTestHelpers.h`, `CliReplyHelper.h`.
|
||||
|
||||
@@ -231,13 +251,14 @@ native_battery_gate` / `-e native_ham_mode` / `-e native_fleet` /
|
||||
`-e native_fleet_noack` (the fleet
|
||||
suite with `FLEET_ACK_RETRY=0`, whose test bodies live in `#else` branches no
|
||||
other env compiles) / `-e native_mesh_clock` / `-e native_rx_power_saving` / `-e
|
||||
native_radio2` / `-e native_mqtt_observer`
|
||||
(host-native, no hardware), plus `-e
|
||||
native_radio2` / `-e native_mqtt_observer` / `-e native_ota` / `-e
|
||||
native_online_ota` (host-native, no hardware), plus `-e
|
||||
native_packet_filter_san` / `-e native_battery_gate_san` / `-e native_ham_mode_san` /
|
||||
`-e native_fleet_san` /
|
||||
`-e native_mesh_clock_san` / `-e native_rx_power_saving_san` / `-e
|
||||
native_radio2_san` / `-e
|
||||
native_mqtt_observer_san` for ASan+UBSan;
|
||||
native_mqtt_observer_san` / `-e native_ota_san` / `-e native_online_ota_san`
|
||||
for ASan+UBSan;
|
||||
firmware via `bash build.sh build-firmware <target>` (`bash build.sh list`;
|
||||
`build.sh` uses bash arrays, so `sh` is not a contract), the filter fork's flash
|
||||
target being `Xiao_S3_WIO_repeater` (observer builds add
|
||||
@@ -262,6 +283,11 @@ shut down). The build job prints the tail of a failed target's log, prunes a
|
||||
failed target's build tree, and retries the failed set once with two workers
|
||||
(`--retry-failed`) after the main pass, so runner-resource flakes do not leave
|
||||
assets missing; a deterministic failure simply fails again.
|
||||
App images are uploaded as `<env>-v<version>.bin`, without the short commit
|
||||
sha; the firmware's own version string still carries it. `scripts/rename-ota-assets.py`
|
||||
renames existing assets in place through the GitHub API. The planned rename
|
||||
away from the `filter` prefix is a separate migration; the tag prefix is one
|
||||
macro in `OnlineOtaPolicy.h`.
|
||||
`RELEASE_NOTES.md` holds the pending release notes and `filter-release.yml` uses
|
||||
it verbatim as the body of every dev release. A stable release collects the
|
||||
bodies of the dev releases since the previous stable one, so it needs no
|
||||
@@ -324,16 +350,18 @@ Fork-owned file set (free to edit):
|
||||
- `examples/simple_repeater/MeshClockSync.h/.cpp`, `MeshClockSyncConfig.h`,
|
||||
`BuildEpoch.h`
|
||||
- `examples/simple_repeater/Radio2.h/.cpp`, `Radio2Config.h`
|
||||
- `examples/simple_repeater/OnlineOtaPolicy.h`, `OnlineOtaCore.h/.cpp`,
|
||||
`OnlineOtaNet.h/.cpp`
|
||||
- `src/helpers/PowerProfile.h/.cpp`,
|
||||
`src/helpers/radiolib/RXPowerSaving.h/.cpp`, `RXPowerSavingCLI.h/.cpp`,
|
||||
`src/helpers/radiolib/SX1262RxPowerSaving.h`, `src/helpers/radiolib/RadioProfileControl.h`
|
||||
- `test/test_packet_filter/`, `test/test_fleet/`, `test/test_battery_gate/`,
|
||||
`test/test_mesh_clock/`, `test/test_rx_power_saving/`, `test/test_radio2/`,
|
||||
`test/test_mqtt_observer/`
|
||||
`test/test_mqtt_observer/`, `test/test_online_ota/`
|
||||
- `examples/mqtt_observer/`, `observer_targets.ini`
|
||||
- `FILTER.md`, `FLEET.md`, `BATTERY.md`, `MESHCLOCK.md`, `POWER.md`,
|
||||
`RADIO2.md`, `MQTT_OBSERVER.md`
|
||||
- `scripts/local-release-build.sh`, `scripts/tests/`
|
||||
`RADIO2.md`, `MQTT_OBSERVER.md`, `ONLINE_OTA.md`
|
||||
- `scripts/local-release-build.sh`, `scripts/rename-ota-assets.py`, `scripts/tests/`
|
||||
- `.github/workflows/filter-release.yml`,
|
||||
`sync-upstream.yml`, `.github/workflows/promote-stable.yml`
|
||||
- `.github/actions/open-conflict-issue/` (the conflict issue the two sync
|
||||
@@ -625,13 +653,14 @@ pio test -e native_mesh_clock # mesh clock sync
|
||||
pio test -e native_radio2 # second radio preset (policy/scheduler/persistence/CLI + core profile byte)
|
||||
pio test -e native_mqtt_observer # observer config/format/policy
|
||||
pio test -e native_ota # LoRa OTA engine (branch lora-ota)
|
||||
pio test -e native_online_ota # online fetch policy, core, CLI and local staging
|
||||
```
|
||||
|
||||
All green, and every touched line required, together with the full host-env
|
||||
run, since the generic envs are where a broken selection shows up:
|
||||
|
||||
```
|
||||
pio test -e native -e native_kiss_modem -e native_packet_filter -e native_battery_gate -e native_ham_mode -e native_fleet -e native_fleet_noack -e native_mesh_clock -e native_rx_power_saving -e native_radio2 -e native_mqtt_observer -e native_ota -e native_ota_san
|
||||
pio test -e native -e native_kiss_modem -e native_packet_filter -e native_battery_gate -e native_ham_mode -e native_fleet -e native_fleet_noack -e native_mesh_clock -e native_rx_power_saving -e native_radio2 -e native_mqtt_observer -e native_ota -e native_ota_san -e native_online_ota -e native_online_ota_san
|
||||
```
|
||||
|
||||
Touching firmware-hook or persistence code additionally warrants compile checks
|
||||
|
||||
@@ -589,6 +589,35 @@ The obvious footgun (a script that runs `fleet chan clear` on the whole
|
||||
fleet) is the same class as deleting the filter rule that delivered it:
|
||||
documented here, not special-cased in code. Don't.
|
||||
|
||||
### Online firmware download (observer builds)
|
||||
|
||||
An observer target uses three CLI lines to start a release download. The
|
||||
`start` reply is immediate, so a script never waits for the download; image
|
||||
bytes never travel over LoRa. Target only observer nodes, since a plain
|
||||
repeater replies `Err - unsupported`.
|
||||
|
||||
```text
|
||||
!id 2026-11-24-online-fetch
|
||||
!tags canary
|
||||
!ack err
|
||||
ota fetch ver 1.18.0-dev.11
|
||||
ota fetch sha sha256:39483a72f358ea976125928a45394115d452ec29b4dbe4bf35c9e2ddf3f2d826
|
||||
ota fetch start
|
||||
```
|
||||
|
||||
Then, once `ota status` shows `ready`, apply with a second job that `!at` can
|
||||
schedule:
|
||||
|
||||
```text
|
||||
!id 2026-11-24-online-apply
|
||||
!tags canary
|
||||
ota apply
|
||||
```
|
||||
|
||||
Each node fetches independently over its own WiFi. The fleet PSK remains full
|
||||
admin access. See [ONLINE_OTA.md](./ONLINE_OTA.md) for the digest syntax,
|
||||
errors and limits.
|
||||
|
||||
## Status, logs and troubleshooting
|
||||
|
||||
`fleet` is the feature's dashboard; `fleet seen <key>` over a normal admin
|
||||
|
||||
+179
@@ -0,0 +1,179 @@
|
||||
# Online OTA over WiFi (repeater observer builds)
|
||||
|
||||
Online OTA lets a repeater observer download a release over HTTPS and install
|
||||
it, without a phone or a LoRa transfer. It takes three short commands:
|
||||
|
||||
```text
|
||||
ota fetch ver 1.18.0-dev.11
|
||||
ota fetch sha sha256:39483a72f358ea976125928a45394115d452ec29b4dbe4bf35c9e2ddf3f2d826
|
||||
ota fetch start
|
||||
ota status # watch progress, ends at state=ready
|
||||
ota apply # flip the A/B slot and reboot
|
||||
```
|
||||
|
||||
The first two commands only store values in RAM. They do not touch WiFi. The
|
||||
third starts a background download. All three work from the serial CLI, an
|
||||
authenticated remote admin CLI message, and a fleet script. Only **repeater
|
||||
observer builds** support them. Plain repeaters, Pico W, nRF52, STM32 and
|
||||
companion firmware do not.
|
||||
|
||||
## How it works
|
||||
|
||||
Release app images are named `<env>-v<version>.bin`, where `<env>` is the
|
||||
board's PlatformIO environment name. Firmware knows its own `OTA_PIO_ENV`, so
|
||||
it builds the download URL from the version token alone:
|
||||
|
||||
```text
|
||||
https://github.com/jhuebert/MeshCore/releases/download/filter-v<version>/<own-env>-v<version>.bin
|
||||
```
|
||||
|
||||
There is no manifest, no GitHub API call and no JSON in firmware. The digest
|
||||
you supply is the expected SHA-256 of the image. The node streams the download
|
||||
into the inactive app slot through the same staging session a LoRa transfer
|
||||
uses, then verifies the bytes it actually wrote against that digest. Only a
|
||||
verified image can be applied. `ota apply`, the boot health probe and the
|
||||
automatic rollback are unchanged.
|
||||
|
||||
Every step is bounded and at most one 2 KiB chunk is processed per `loop()`, so
|
||||
the radio keeps running. The observer remains the only owner of WiFi: online
|
||||
OTA requests the station at `start`, uses the observer's clock and heap gate,
|
||||
and releases the request when the job finishes. With no broker and no request,
|
||||
the node still powers WiFi down as before. A download is refused while the
|
||||
battery gate is suspended and is aborted if suspension starts mid-download.
|
||||
|
||||
## Setup
|
||||
|
||||
1. Flash a `*_repeater_observer` target. See
|
||||
[MQTT_OBSERVER.md](./MQTT_OBSERVER.md) for the observer build.
|
||||
2. Set the station credentials (shared with the MQTT client):
|
||||
|
||||
```text
|
||||
set wifi.ssid <your-ssid>
|
||||
set wifi.pwd <your-password>
|
||||
```
|
||||
|
||||
3. Check the link and the clock:
|
||||
|
||||
```text
|
||||
get wifi.status
|
||||
get mqtt.ntp
|
||||
```
|
||||
|
||||
The observer configures NTP whenever the station is up. A download starts
|
||||
only once the clock is past 2025-01-01, because TLS needs a valid time.
|
||||
|
||||
## Commands
|
||||
|
||||
| Command | Reply | Notes |
|
||||
|---|---|---|
|
||||
| `ota fetch ver <version>` | `OK - online version set ver=<version>` | Stores the version. No network work. |
|
||||
| `ota fetch sha [sha256:]<hex>` | `OK - online sha set sha=<16hex>` | Stores the expected digest. No network work. |
|
||||
| `ota fetch start` | `OK - online fetch armed ver=<version>` | Starts the background job. Requires both values. |
|
||||
| `ota net` | `net=<phase> ver=<version> sha=<8hex> got=<n> size=<n> err=<n>` | Detailed progress: `idle`, `wifi`, `clock`, `asset`, `verify`, `ready`, `error`. |
|
||||
| `ota status` | unchanged | The frozen line. Progress shows as `state=staging size=<n> off=<n>`; failures as `state=error err=<n>`. |
|
||||
| `ota apply` | unchanged | Works for a verified image from either source. |
|
||||
| `ota abort` | `OK - aborted` | Clears the stored version and digest, cancels a running job and releases the station. |
|
||||
| `ota rollback`, `ota stage` | unchanged | Existing LoRa OTA surface. |
|
||||
|
||||
The two setup commands can be given in either order and can be repeated before
|
||||
`start`. A second `start` while a job is running, or while an image is staged,
|
||||
is refused. A verified image is never silently discarded: use `ota abort`.
|
||||
After an error the stored values remain, so you can fix one and start again.
|
||||
Nothing is persisted: a reboot drops the values and the job.
|
||||
|
||||
### Version syntax
|
||||
|
||||
The version token selects the release tag `filter-v<version>`. One leading
|
||||
`v` or `V` and a trailing `-filter-<sha>` are stripped, so a version copied out
|
||||
of `ota status` works:
|
||||
|
||||
```text
|
||||
ota fetch ver 1.18.0-dev.11
|
||||
ota fetch ver v1.18.0-dev.11
|
||||
ota fetch ver v1.18.0-dev.11-filter-10d4da2
|
||||
ota fetch ver 1.18.0-r4
|
||||
```
|
||||
|
||||
Only `[A-Za-z0-9._-]` is accepted, up to 63 bytes. There is no `latest` keyword,
|
||||
no downgrade check and no version comparison. URLs are never accepted.
|
||||
|
||||
### Digest syntax
|
||||
|
||||
The digest is 64 hex characters, with or without a `sha256:` prefix. Uppercase
|
||||
hex is accepted. It must be the SHA-256 of the exact `.bin` file for this
|
||||
board. The app already has this value from the GitHub API; the companion app
|
||||
should send it in the `ota fetch sha` command.
|
||||
|
||||
## Errors
|
||||
|
||||
Failures appear in both `ota net` (`err=<n>`) and the frozen `ota status` line
|
||||
(`state=error err=<n>`). Fix the cause and issue `start` again.
|
||||
|
||||
| Code | Name | Meaning |
|
||||
|---|---|---|
|
||||
| 10 | CFG | Online OTA unavailable on this build |
|
||||
| 11 | WIFI | Station could not be associated in time |
|
||||
| 12 | CLOCK | No valid time for TLS |
|
||||
| 13 | TLS | Secure connection could not be set up |
|
||||
| 14 | HTTP | HTTP error, bad Content-Length or too many redirects |
|
||||
| 15 | DOWNLOAD | Short body or image write failed |
|
||||
| 16 | HEAP | Not enough contiguous heap for a secure connection |
|
||||
|
||||
A suspended battery gate uses the existing code 2, and a SHA-256 mismatch uses
|
||||
the existing code 4. The companion app shows "unknown error N" for 10 to 16
|
||||
until its labels are updated; the firmware surface needs no app change.
|
||||
|
||||
## Fleet recipes
|
||||
|
||||
A script line is one CLI command, so the three setup lines run in one pass and
|
||||
`start` returns as soon as the job is armed. Target observer nodes with
|
||||
`!tags`; a non-observer node replies `Err - unsupported`.
|
||||
|
||||
```text
|
||||
!id 2026-11-24-online-fetch
|
||||
!tags canary
|
||||
!ack err
|
||||
ota fetch ver 1.18.0-dev.11
|
||||
ota fetch sha sha256:39483a72f358ea976125928a45394115d452ec29b4dbe4bf35c9e2ddf3f2d826
|
||||
ota fetch start
|
||||
```
|
||||
|
||||
Then, once `ota status` shows `ready`, apply with a second job that `!at` can
|
||||
schedule:
|
||||
|
||||
```text
|
||||
!id 2026-11-24-online-apply
|
||||
!tags canary
|
||||
ota apply
|
||||
```
|
||||
|
||||
Each node downloads independently over its own WiFi. Image bytes never travel
|
||||
over LoRa and `!ack` carries only short command replies. The fleet PSK remains
|
||||
full admin access. See [FLEET.md](./FLEET.md).
|
||||
|
||||
## Companion app
|
||||
|
||||
The app reaches these commands through its existing admin TXT path. It should
|
||||
take the version and `digest` it already reads from the GitHub API and send
|
||||
`ota fetch ver <version>`, `ota fetch sha sha256:<digest>` and
|
||||
`ota fetch start`. Do not treat the `start` reply as success: poll `ota status`
|
||||
until `state=ready`, apply, then compare the running hash.
|
||||
|
||||
No new OTA op codes, report fields or frozen CLI replies were added. `OP_INFO`
|
||||
reports one appended feature bit, `0x40`, so the app can detect support. A free
|
||||
form remote CLI screen is not in the app yet, so that flow still needs an app
|
||||
change.
|
||||
|
||||
## Limits
|
||||
|
||||
- Observer repeaters only. A node without `WITH_MQTT_OBSERVER` has no online
|
||||
fetch and replies `Err - unsupported`.
|
||||
- Release assets must be named `<env>-v<version>.bin`. New releases do this
|
||||
automatically; existing assets were renamed in place, without re-uploading.
|
||||
- Merged images, `.uf2`, `.zip` and `.hex` are never selected. The URL is built
|
||||
from validated tokens, so a wrong board or a merged image cannot be named.
|
||||
- One job at a time, in RAM only. A verified image needs `ota abort` before a
|
||||
second fetch.
|
||||
- A chunked response is refused rather than mis-staged; release assets carry a
|
||||
Content-Length. The connect and header waits are bounded by short socket
|
||||
timeouts; the body is read incrementally.
|
||||
@@ -148,6 +148,17 @@ for diagnostics.
|
||||
> See [OTA.md](./OTA.md#action-required-esp32-repeater-partition-change) for the
|
||||
> affected targets and the backup procedure.
|
||||
|
||||
### 🌐 Online OTA (observer builds)
|
||||
|
||||
Observer repeaters can update straight from a GitHub release over WiFi. Set
|
||||
the version and the expected SHA-256 with `ota fetch ver` and `ota fetch sha`,
|
||||
then `ota fetch start` downloads the board's image in the background; `ota
|
||||
status` shows progress and `ota apply` reboots into the verified image. No
|
||||
manifest, GitHub API call or phone is needed, and the usual SHA-256 gate and
|
||||
rollback still apply.
|
||||
|
||||
→ Full guide: **[ONLINE_OTA.md](./ONLINE_OTA.md)**
|
||||
|
||||
### 🤖 Chat bot
|
||||
|
||||
An opt-in responder that answers `test`/`ping`/`help` chatter on one keyed
|
||||
@@ -198,6 +209,7 @@ Flash as you would stock firmware, then follow
|
||||
[FLEET.md](./FLEET.md) if you are running a fleet,
|
||||
[POWER.md](./POWER.md) if the node runs on solar or battery,
|
||||
[RADIO2.md](./RADIO2.md) if it should listen on a second preset,
|
||||
[HAM.md](./HAM.md) if you are a licensed operator using dual TX power, or
|
||||
[MQTT_OBSERVER.md](./MQTT_OBSERVER.md) if you flashed an observer build.
|
||||
[HAM.md](./HAM.md) if you are a licensed operator using dual TX power,
|
||||
[MQTT_OBSERVER.md](./MQTT_OBSERVER.md) if you flashed an observer build, or
|
||||
[ONLINE_OTA.md](./ONLINE_OTA.md) to update one over WiFi.
|
||||
Observer builds ship in the same releases as the plain repeater firmware.
|
||||
+11
-1
@@ -1 +1,11 @@
|
||||
|
||||
- **Online OTA for repeater observer builds.** `ota fetch ver <version>`,
|
||||
`ota fetch sha <digest>` and `ota fetch start` download a release over HTTPS,
|
||||
stage it with the existing SHA-256 gate, and `ota apply` reboots into it with
|
||||
the usual boot health check and rollback. No manifest, GitHub API call or
|
||||
app change is needed. See [ONLINE_OTA.md](./ONLINE_OTA.md).
|
||||
- **Release app assets are now named `<env>-v<version>.bin`**, without the
|
||||
short commit sha. Existing assets were renamed in place, so their bytes and
|
||||
digests are unchanged. Old asset URLs stop working after the rename. The
|
||||
firmware's own version string still carries the sha.
|
||||
- `OP_INFO` reports one appended feature bit (`0x40`) for online fetch. No OTA
|
||||
op codes, report layouts or frozen CLI replies changed.
|
||||
Reference in new issue
Block a user