feat: wireview pin-imbalance warning, per-pin rating bars, pin_imbalance_a

- Per-pin bar now scales against the 9.2 A per-pin rating (10 A full
  scale, red at/over rating) instead of the 55 A total connector OCP
- Debounced app-wide warning banner (visible on all tabs) when the
  current between two pins diverges by > 2 A for ~7 s - the signature
  of a bad pin contact that can overheat and melt the 12VHPWR
  connector; 5 s grace period after clearing
- New pin_imbalance_a sample field (max - min pin current) in both the
  serial and hwmon sample builders, plus frontend type
- Docs: README + WireView.md cover the warning and threshold; fresh
  screenshot with the new per-pin labels
- Tests: vitest setup + 9 unit tests for the debounce state machine;
  3 new backend checks for pin_imbalance_a
This commit is contained in:
ARIA committed 2026-10-03 22:13:13 +02:00
1 parent 92356d1409
commit b69b7502b3
14 files changed
+810 -18

No files matched your search

@@ -8,8 +8,10 @@ interface Props {
history: WireViewSample[];
}
// Per-pin over-current protection of the 12 VHPWR connector (A).
const PIN_OCP_A = 55;
// Per-pin current rating of the 12 VHPWR connector (A). The bar's
// full scale is 10 A (rating + headroom); red at/above the 9.2 A rating.
const PIN_RATED_A = 9.2;
const PIN_BAR_MAX_A = 10;
const FAULT_NAMES: Record<number, string> = {
0: "Chip over-temperature",
@@ -87,9 +89,13 @@ function PinCard({
current: number;
power: number;
}) {
const loadPct = Math.min(100, (current / PIN_OCP_A) * 100);
const loadPct = Math.min(100, (current / PIN_BAR_MAX_A) * 100);
const barColor =
loadPct >= 90 ? "#f87171" : loadPct >= 75 ? "#fbbf24" : "#34d399";
current >= PIN_RATED_A
? "#f87171"
: loadPct >= 75
? "#fbbf24"
: "#34d399";
return (
<div className="bg-zinc-900 rounded-lg p-3 flex flex-col gap-1.5 min-w-0">
<div className="flex items-center justify-between">
@@ -97,7 +103,7 @@ function PinCard({
Pin {index + 1}
</span>
<span className="text-[10px] font-mono text-zinc-600">
{current.toFixed(1)} / {PIN_OCP_A} A
{current.toFixed(1)} / {PIN_RATED_A} A
</span>
</div>
<div className="grid grid-cols-3 gap-1 text-center">