Skip to content

feat(proto): decode power.status v2 (40B) — agent compatibility with v2 firmware - #1

Merged
cmd0s merged 2 commits into
mainfrom
exp
Jun 21, 2026
Merged

feat(proto): decode power.status v2 (40B) — agent compatibility with v2 firmware#1
cmd0s merged 2 commits into
mainfrom
exp

Conversation

@cmd0s

@cmd0s cmd0s commented Jun 21, 2026

Copy link
Copy Markdown
Member

Why

The firmware now emits power.status v2 (40-byte wups_power_status_v2_t, version byte = 2) — merged in Web3-Pi-UPS PR #3 (2026-06-21). The agent on main (e58083a) runs the v1-strict check_version() and rejects any frame whose version byte ≠ 1, so a Pi running an agent built from main/release v2.0.1 would drop all UPS telemetry from v2 firmware — leaving the safe-shutdown logic blind to battery state.

This branch (fe4e768) adds the matching v2 decoder.

What

  • src/proto/payloads.rs: PowerStatusV2 (40 B, offset-checked) with a known-bytes round-trip test locking the wire layout.
  • src/dispatcher.rs: branch on the version byte; down-convert v2 → PowerStatusV1 for storage so the rest of the host stays v1-native.

Verification

cargo test → 82/82 passing (incl. the v2 round-trip test).

Follow-up

After merge, tag v2.1.0 so release.yml builds the aarch64 artifact and Web3-Pi-vOS picks it up via the latest-release install path.

cmd0s added 2 commits June 21, 2026 13:45
Add PowerStatusV2 (40 B, version byte = 2) with offset-checked decode and a
known-bytes round-trip test that locks the wire layout. The dispatcher
branches on the payload version byte and down-converts v2 -> PowerStatusV1
for storage (host stays v1-native for now), so the strict decoder no longer
rejects v2 frames emitted by the CH32X.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant