Skip to content

Battery Viewer widget#58

Merged
LelsersLasers merged 21 commits intomasterfrom
millan/good_battery_viewer
Apr 22, 2026
Merged

Battery Viewer widget#58
LelsersLasers merged 21 commits intomasterfrom
millan/good_battery_viewer

Conversation

@LelsersLasers
Copy link
Copy Markdown
Member

@LelsersLasers LelsersLasers commented Apr 17, 2026

Simple widget to view all the cell voltages in the pack (+ which are being balanced) as well as overall battery status (current, pack voltage, overall min/max/diff). Designed specifically to for CCAN/charging right now. When ABOX telemetry is finalized/updated, the message names/signals may also need to update.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new “Battery Viewer” widget to visualize per-cell voltages/balancing state plus pack-level telemetry, and wires it into the app’s widget spawning flow.

Changes:

  • Introduce BatteryViewer widget (CAN decoding + egui UI) and integrate it into widget spawning (sidebar + command palette + app counters).
  • Add UI theme/color helpers and general color interpolation utilities used by the battery view.
  • Update tooling (nix flake rust-analyzer component) and adjust CAN serial driver bitrate.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/widgets.rs Add new widget variant and route show/CAN handling to BatteryViewer.
src/util.rs Add lerp + HSV→Color32 helpers used for cell color rendering.
src/ui/theme.rs New theme color model + ctx persistence helpers for semantic colors.
src/ui/sidebar.rs Add “Add Battery Viewer” button to spawn the new widget.
src/ui/scope.rs Remove stale TODO comments.
src/ui/mod.rs Export new battery and theme UI modules.
src/ui/battery.rs New BatteryViewer widget implementation (CAN parsing + UI rendering).
src/can/driver.rs Change SLCAN nominal bitrate default from 500k to 250k.
src/app.rs Add instance counter and spawn path for BatteryViewer.
src/action.rs Add WidgetType::BatteryViewer and command palette entry.
nix_flake/flake.nix Add rust-analyzer to the nix dev environment extensions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ui/battery.rs
Comment thread src/ui/battery.rs Outdated
Comment thread src/ui/battery.rs Outdated
Comment thread src/ui/theme.rs
Comment thread src/ui/battery.rs
Comment thread src/ui/battery.rs Outdated
Comment thread src/widgets.rs Outdated
Comment thread src/can/driver.rs
Comment thread src/ui/theme.rs
Comment thread src/ui/battery.rs
@LelsersLasers LelsersLasers marked this pull request as ready for review April 21, 2026 20:24
@LelsersLasers LelsersLasers force-pushed the millan/good_battery_viewer branch from 04d73c8 to 65bbb62 Compare April 21, 2026 20:25
@irvingywang
Copy link
Copy Markdown
Member

did we fix the theme thingy or nah

@LelsersLasers
Copy link
Copy Markdown
Member Author

I just cherry picked what I wanted from #54 but I think if it all works in that PR its fine

@LelsersLasers LelsersLasers merged commit bded249 into master Apr 22, 2026
1 check passed
@LelsersLasers LelsersLasers deleted the millan/good_battery_viewer branch April 22, 2026 01:44
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.

3 participants