(statusEl, available, templates)
| 19467 | // Reconcile the confusing case this panel can otherwise show: the SoC |
| 19468 | // reports under-voltage while the estimated budget still has plenty of |
| 19469 | // headroom. That is not a contradiction — the loss is between the PSU and |
| 19470 | // the board (cable/connector), not too much current — and saying so stops |
| 19471 | // the numbers reading like a bug. |
| 19472 | const uv = d.summary && d.summary.undervoltage; |
| 19473 | if (uv && est.headroom_ma > 0 && !est.tight) { |
| 19474 | html += `<p class="text-[12px] text-amber-300 mt-2 border-l-2 border-amber-700 pl-2"> |
| 19475 | Under-voltage <em>despite</em> headroom on paper? That points at a <strong>cable/connector voltage drop</strong>, not too much current: the draw is well under the supply's rating, but the 5 V rail still sags below spec between the PSU and the board — a thin/long micro-USB cable, a tired connector, or a flat 5.0 V supply with no margin. Try a short thick cable and a 5.1 V supply before reaching for a bigger PSU.</p>`; |
| 19476 | } |
| 19477 | html += `</div>`; |
| 19478 | |
| 19479 | // 4) Reference maxima for the two named field configs. |
| 19480 | const prof = d.profiles || {}; |
| 19481 | if (prof.stationary || prof.roaming) { |
| 19482 | html += `<div> |
| 19483 | <div class="text-xs uppercase tracking-wide text-gray-500 mb-2">Reference: your two field configs (peak, on this board)</div> |
| 19484 | <div class="space-y-1">`; |
| 19485 | [['stationary', prof.stationary], ['roaming', prof.roaming]].forEach(([, p]) => { |
| 19486 | if (!p) return; |
| 19487 | html += `<div class="flex items-center justify-between gap-2 text-xs bg-slate-800/40 rounded px-2 py-1"> |
| 19488 | <div><span class="text-gray-200">${escapeHtml(p.label)}</span> |
| 19489 | <span class="text-gray-500">· ${(p.devices || []).map(escapeHtml).join(' + ')}</span></div> |
| 19490 | <div class="font-mono whitespace-nowrap ${p.fits ? 'text-green-300' : 'text-red-300'}">${_pwMa(p.peak_ma)}${p.fits ? '' : ' ⚠'}</div> |
| 19491 | </div>`; |
| 19492 | }); |
| 19493 | html += `</div> |
| 19494 | <p class="text-[11px] text-gray-500 mt-2">On a Pi Zero / Pi 3 the Alfa is not hot-pluggable — it only enumerates if it is connected when power is applied. If a config under-volts, a powered USB hub for the dongles fixes it without a bigger PSU.</p> |
| 19495 | </div>`; |
| 19496 | } |
| 19497 | |
| 19498 | return html; |
| 19499 | } |
no test coverage detected