Add tools/install_release.py, a host script that takes a release from Gitea
and puts it on a board over USB the way an update would: it downloads the
release's application image and checks it against the release checksums,
writes it to the slot that is not running, and rewrites otadata to select
that slot as a new image before resetting the board.
It reads the board's own partition table and slot selection rather than
assuming a layout, refuses a board without the A/B partition table, and
writes nothing until the image has been downloaded and verified. A dry run
shows what it would do.
This lets the A/B slots be tested with real releases while there is no
over-the-air update source. The README documents it, and the full image's
install steps now clear the slot selection, so that a board which had
switched to the second slot runs the image just written.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a Gitea Actions workflow that builds the firmware and publishes a
release whenever main changes.
The version is MAJOR.MINOR from the version in Cargo.toml plus the number of
commits on main as the patch number, so it only ever goes up and can be worked
out again from any commit. The workflow stamps it into Cargo.toml for the
build, which puts it in the app descriptor, and the firmware now logs it at
boot. The release is tagged v plus the version.
Each release carries a full image (bootloader, partition table and
application, stopping short of the storage partition so flashing it keeps the
Zigbee network), the application image alone, the unstripped build for
backtraces, and checksums.
The submodule is declared with an SSH address, so the workflow rewrites it to
HTTPS for the runner, which has no key. The README documents the scheme.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add the LICENSE file, declare the license in Cargo.toml, and say so in the
README. The Zigbee stack in vendor/zigbee-rs is a separate project and keeps
its own licenses (MIT or Apache-2.0).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Split the single app partition into two slots, ota_0 and ota_1, with an
otadata partition that tells the bootloader which to run, so an update can
be written to the idle slot while the other keeps running. The Zigbee
storage partition is unchanged, so the light keeps its network. Moving from
the old table needs one USB flash.
* src/ota.rs logs the running slot and the state of its image at boot,
marks an image valid after it has stayed up for 20 seconds, and can
switch to the other slot and restart. The slot in use is read from the
flash mapping, not from otadata.
* src/flash.rs shares the one flash handle: esp-storage allows only one, and
both the Zigbee stack and the update code need it.
* The runner clears otadata on every USB flash. A USB flash always writes
slot 0, so without this a board that had switched to slot 1 would keep
booting the old image.
* Two development features, ota-test and ota-test-crash, exercise slot
switching and an unconfirmed image without an update source. FW_LABEL tells
builds apart in the log.
Tested on the hardware: switching between two images across six reboots, each
booting the slot it had just selected, resuming its Zigbee network, and
confirming itself. Rollback is not available: the bootloader espflash installs
is not built with it, so a newly selected image reports "New" rather than
"PendingVerify", and an image that resets without confirming itself is booted
again indefinitely. Needs a rollback-enabled bootloader. Nothing delivers
updates yet. Both are recorded in TODO.md.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A light that has a network only ever rejoins that one, so there was no way
to re-pair it or move it to another coordinator without reflashing.
Holding the encoder button for 10 seconds now makes the light flash green
twice, forget its Zigbee network (saved to flash) and restart, after which
it looks for a network with an open pairing window, in ZHA with Add device.
The coordinator is not told, so Home Assistant keeps the device and
recognises it by its IEEE address when it joins again.
While the light is looking for a network the on-board LED blinks fast
instead of once a second, so a waiting pairing window can be seen to be
picked up, and the change between joined and searching is logged.
The README documents the gesture and how pairing works, and notes that the
extended PAN ID is broadcast by the network and is not a secret.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Describe what the project is, the hardware and controls, how to build and
flash it from source, how to join a Zigbee network, and how to install the
ZHA quirk for the effects cluster.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>