Skip to content

fix: hide the power block when every sample is 0 W - #14

Open
salmun-nister wants to merge 1 commit into
nulluserid:mainfrom
salmun-nister:fix/power-not-reported
Open

salmun-nister wants to merge 1 commit into
nulluserid:mainfrom
salmun-nister:fix/power-not-reported

Conversation

@salmun-nister

Copy link
Copy Markdown

Fixes #10

Change

Panel.qml - require a positive sample instead of mere presence. A live idle draw is tens of watts, so this cannot hide a dish that does measure:

   readonly property bool hasPower: {
     var p = h ? h.powerW : []
-    for (var i = 0; i < p.length; i++) if (p[i] !== null && p[i] !== undefined) return true
+    for (var i = 0; i < p.length; i++) if (p[i] > 0) return true
     return false
   }

Both existing consumers follow the flag, so no layout surgery: visible: root.hasPower on the section, and the adjacent chart's width (parent.width when hidden, half when shown).

Model.js - keep the bar tooltip consistent:

-  if (live.powerW !== null && live.powerW !== undefined) parts.push(fmtW(live.powerW))
+  // 0 means the dish does not meter draw (see Panel.qml hasPower): leave it
+  // out of the tooltip rather than reporting a false 0.0 W.
+  if (live.powerW > 0) parts.push(fmtW(live.powerW))

README.md - one line under Requirements, where dish-capability notes belong:

- A dish that reports power draw (optional; the power block is hidden when
  every sample is 0 W, since such hardware does not meter draw)

Testing

case expected
all-zero ring (affected hardware) block hidden, neighbouring chart full width, tooltip has no power segment
metered ring (one sample at 15.3 W) block shown, tooltip unchanged
empty ring / hist.json not yet read unchanged (hidden)
powerW absent from status.json no exception, no power segment

Scope

Display only; backend/bin/starlinkd untouched. Independent of the other open PRs.

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.

panel claims 0.0 W on dishes that do not meter power draw

1 participant