ups-live: macOS live dashboard for the UPS (WUPS over USB-CDC) - #3
Merged
Conversation
Second binary in the crate: a single-screen ANSI terminal dashboard for bench use. With the PD_DataRole firmware a laptop attached to the UPS output takes the USB host role via DR_Swap, so the WUPS stream is readable directly on macOS — this renders it live: - auto-detects the Web3_Pi_UPS CDC (VID:PID 2e8a:000a; prefers /dev/cu.* on macOS), or takes an explicit port path - power.status v2: input path (mains/USB-C flags, HUSB238 PD-in contract), output rail (PD-out contract, TPS set/read/ilim), battery, charge state, temps, faults, UPS uptime + stale-frame indicator - scrolling tail of system.log frames (includes the CH32X "PD: ..." event trace) and highlighted power.event broadcasts - frame/CRC counters from the shared deframer Protocol code is reused, not duplicated: new src/lib.rs exposes the existing proto module as a library target consumed by the bin. The agent binary keeps its private module tree and is byte-for-byte unaffected; all 52 proto tests pass against the lib target. Verified live on macOS against a UPS powering the MacBook at 15 V.
The startup clear was a bare print! — the escapes sat in the stdout buffer and the first frame raced the shell prompt, intermittently eating the title row (seen on first bench run). Use the alternate screen buffer (?1049h/?1049l) with an explicit flush: the dashboard gets a clean empty screen and the user's terminal content is restored intact on exit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
New binary in the crate:
ups-live— a single-screen terminal dashboard that opens the UPS's USB-CDC port directly on a desktop machine and renders the WUPS v1 stream live.Primary use case: macOS bench/diagnostics. With the
PD_DataRolefirmware (Web3-Pi-UPSc98e7fc) a laptop plugged into the UPS output takes the USB host role via PD DR_Swap, so the full telemetry stream is available without a Raspberry Pi in the loop — while the laptop is simultaneously powered by the UPS.How
src/lib.rsexposes the existingprotomodule as a library target — the tool reuses the agent's deframer/Fletcher-8/payload catalogue, zero protocol duplication; the agent binary keeps its private module tree and is unaffected (all 52 proto tests pass against the lib target)system.logframes (includes the CH32XPD: ...event trace) + highlightedpower.eventbroadcastsTesting
Verified live on macOS 26.5.2 (MBP M4) against a UPS powering the MacBook at 15 V: auto-detect, 1 Hz refresh, CRC counters at zero over multi-minute sessions, PD trace visible on attach. Not exercised on a Pi (out of scope — the installed agent owns the port there; documented in README).