Skip to content

[1.4] core: frontend: App: Add battery information widget - #4402

Merged
joaoantoniocardoso merged 6 commits into
bluerobotics:1.4-devfrom
patrickelectric:add-battery-widget-14
Sep 3, 2026
Merged

[1.4] core: frontend: App: Add battery information widget#4402
joaoantoniocardoso merged 6 commits into
bluerobotics:1.4-devfrom
patrickelectric:add-battery-widget-14

Conversation

@patrickelectric

Copy link
Copy Markdown
Member

Battery voltage and current as a top bar widget.

Cherry-pick of #4390
Fix #4389

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
…ure getter

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Automated PR Review

0. Summary

  • Verdict: MINOR SUGGESTIONS ✏️

Cherry-pick of #4390 to 1.4-dev. Adds a Battery top-bar widget that reads SYS_STATUS.voltage_battery / current_battery from the MAVLink store and renders them in the tray. Also consolidates the "main CPU/SoC/CCD temperature" lookup into a new cpu_temperature getter on the system-information store and updates Cpu.vue, HealthTrayMenu.vue, and SystemCondition.vue to use it. SYS_STATUS is already polled globally by MavlinkUpdater.vue, so no extra subscription is required.

6. Code Quality & Style

  • 6.1 [nit] core/frontend/src/widgets/Battery.vue:41,48 — the MAVLink invalid sentinels 65535 (voltage) and -1 (current) are magic numbers. Lift them into named constants (e.g. SYS_STATUS_VOLTAGE_INVALID = 0xFFFF, SYS_STATUS_CURRENT_INVALID = -1) or add a short comment referencing the MAVLink SYS_STATUS spec so a future reader does not have to grep the protocol to know why those exact values are ignored. The pre-existing HealthTrayMenu.vue battery lines do not check these sentinels at all, so the new widget is already an improvement — worth locking in with a name.
  • 6.2 [nit] core/frontend/src/widgets/Battery.vue:38,45mavlink_store_get returns unknown. The as number cast is immediately followed by an === undefined guard, which contradicts the cast (an actual number cannot be undefined). Consider typing the local as number | undefined (as number | undefined) so the guard reads honestly.

5. UI / UX

  • 5.1 [nit] core/frontend/src/widgets/Battery.vue:57-59 vs core/frontend/src/widgets/Cpu.vue:110-112 — the Battery card uses padding-left/right: 8px, whereas the neighboring CPU widget uses 4px. Not a bug, but the two cards sit side-by-side in the tray and the asymmetric horizontal padding is visible. Aligning them would keep the tray visually consistent.
  • 5.2 [nit] core/frontend/src/widgets/Battery.vue — no visual affordance for the two failure modes (autopilot offline vs autopilot reports "no measurement"): both render Loading.. forever. Not required for this PR, but a subtle icon color change or a tooltip differentiating "waiting for data" from "unsupported by autopilot" would help users diagnose why a value never appears.

8. Documentation

  • 8.1 [nit] core/frontend/src/store/system-information.ts:107-112 — new cpu_temperature getter would benefit from a one-line comment explaining why cpu, soc, and ccd are the accepted substrings (Raspberry Pi reports cpu_thermal/soc, x86 AMD reports Tccd, etc.), since the substrings are otherwise unmotivated. Optional.

Generated by PR Review Bot. This is advisory, a human reviewer must still approve.

@joaoantoniocardoso joaoantoniocardoso left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

tested

@joaoantoniocardoso
joaoantoniocardoso merged commit c050c64 into bluerobotics:1.4-dev Sep 3, 2026
7 checks passed
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.

2 participants