fix(webui): don't show PSU load % until the observed peak clears idle draw

The passive collector records PSU draw at idle too, so right after boot
the "observed peak" is just idle wattage and a load % off it is
meaningless. Require the observed peak to sit >=25% above current draw
before using it as a load scale; until a real full-load run bumps it,
show plain watts.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019VHG21rgTUiR1G3qFHTVmN
This commit is contained in:
Mikhail Chusavitin
2026-09-04 12:56:25 +03:00
co-authored by Claude Sonnet 5
parent 7ed652c5b1
commit 08044c81e7
+5 -2
View File
@@ -643,11 +643,14 @@ func renderTopoPSURow(psus []schema.HardwarePowerSupply, observedMaxW map[string
if p.WattageW != nil && *p.WattageW > 0 {
rating = *p.WattageW
}
// Load scale: true rating if known, else the observed peak draw.
// Load scale: true rating if known, else the observed peak draw — but
// only once that peak sits meaningfully above the current draw. Until
// a real full-load run has bumped it, the "peak" is just idle draw and
// a load % off it would be nonsense, so fall back to plain watts.
scaleMax := float64(rating)
scaleEstimate := false
if scaleMax <= 0 {
if m := observedMaxW[strconv.Itoa(i)]; m > 0 {
if m := observedMaxW[strconv.Itoa(i)]; m > 0 && (!haveDraw || m >= draw*1.25) {
scaleMax = m
scaleEstimate = true
}