// Overcurrent Protection Panel // Purpose: Presents detailed server-calculated motor stress and command-tracking diagnostics. // Scope: Read-only status surface for the assigned rover; protection and recovery remain server-owned. import { useControlSelector } from '../../controls/index.js'; import CardFrame from '../CardFrame/index.jsx'; const MOTOR_LABELS = { leftWheel: 'Left wheel', rightWheel: 'Right wheel', mainBrush: 'Main brush', sideBrush: 'Side brush', }; function formatPct(value) { if (!Number.isFinite(value)) return '--'; return `${Math.round(value * 100)}%`; } function formatSpeed(value) { if (!Number.isFinite(value)) return '--'; return `${Math.round(value)} mm/s`; } function formatClassification(value) { if (value === 'stalled') return 'Stalled'; if (value === 'partial') return 'Partial'; if (value === 'moving') return 'Moving'; return 'Unknown'; } function ProgressBar({ value, color = 'bg-emerald-500' }) { const width = `${Math.round(Math.max(0, Math.min(1, Number(value) || 0)) * 100)}%`; return (
Assign a rover to view protection status.
) : ({protection.drive.requiresNeutral ? 'Drive is stopped. Release controls to neutral before resuming.' : 'Drive is stopped while the wheel condition clears.'}
) : null}