mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-17 18:10:47 -04:00
gah
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -11,7 +11,7 @@
|
|||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||||
<meta name="apple-mobile-web-app-title" content="Multi Roomba Rover" />
|
<meta name="apple-mobile-web-app-title" content="Multi Roomba Rover" />
|
||||||
<title>Multi Roomba Rover</title>
|
<title>Multi Roomba Rover</title>
|
||||||
<script type="module" crossorigin src="/assets/index-DKWrvzhs.js"></script>
|
<script type="module" crossorigin src="/assets/index-Vh6qd20d.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-HhAzSaxc.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-HhAzSaxc.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -103,6 +103,11 @@ export default function VideoTile({
|
|||||||
const auxCap = Number.isFinite(limiterCaps?.aux?.cap) ? limiterCaps.aux.cap : 1;
|
const auxCap = Number.isFinite(limiterCaps?.aux?.cap) ? limiterCaps.aux.cap : 1;
|
||||||
return Math.max(0, Math.min(1, 1 - Math.min(driveCap, auxCap)));
|
return Math.max(0, Math.min(1, 1 - Math.min(driveCap, auxCap)));
|
||||||
}, [limiterCaps]);
|
}, [limiterCaps]);
|
||||||
|
const limiterActive = Boolean(
|
||||||
|
Number.isFinite(limiterCaps?.drive?.cap) ? limiterCaps.drive.cap < 0.999 : false,
|
||||||
|
) || Boolean(
|
||||||
|
Number.isFinite(limiterCaps?.aux?.cap) ? limiterCaps.aux.cap < 0.999 : false,
|
||||||
|
);
|
||||||
const limiterLabels = useMemo(() => {
|
const limiterLabels = useMemo(() => {
|
||||||
if (!limiterCaps) return [];
|
if (!limiterCaps) return [];
|
||||||
const labels = [];
|
const labels = [];
|
||||||
@@ -112,12 +117,13 @@ export default function VideoTile({
|
|||||||
if (Boolean(limiterGroups?.aux) || auxCap < 0.999) labels.push('Aux motors');
|
if (Boolean(limiterGroups?.aux) || auxCap < 0.999) labels.push('Aux motors');
|
||||||
return labels;
|
return labels;
|
||||||
}, [limiterCaps, limiterGroups]);
|
}, [limiterCaps, limiterGroups]);
|
||||||
const overlayActive = Boolean(overcurrentMotors.length || (limiterFill != null && limiterFill > 0.001));
|
const overlayActive = Boolean(overcurrentMotors.length || limiterActive);
|
||||||
const overlayLabels = overcurrentMotors.length
|
const overlayLabelsRaw = overcurrentMotors.length
|
||||||
? overcurrentMotors.map((name) => OVERCURRENT_LABELS[name] || name)
|
? overcurrentMotors.map((name) => OVERCURRENT_LABELS[name] || name)
|
||||||
: limiterLabels.length
|
: limiterLabels.length
|
||||||
? limiterLabels
|
? limiterLabels
|
||||||
: ['Overcurrent'];
|
: [];
|
||||||
|
const overlayLabels = overlayLabelsRaw.length ? overlayLabelsRaw : ['Overcurrent'];
|
||||||
|
|
||||||
const scheduleRestart = useCallback(() => {
|
const scheduleRestart = useCallback(() => {
|
||||||
clearTimeout(restartTimer.current);
|
clearTimeout(restartTimer.current);
|
||||||
@@ -751,6 +757,7 @@ const OVERCURRENT_LABELS = {
|
|||||||
|
|
||||||
function OvercurrentOverlay({ labels, fill = 0, visible = false, compact = false }) {
|
function OvercurrentOverlay({ labels, fill = 0, visible = false, compact = false }) {
|
||||||
if (!visible) return null;
|
if (!visible) return null;
|
||||||
|
const safeLabels = Array.isArray(labels) && labels.length ? labels : ['Overcurrent'];
|
||||||
const containerClass = compact ? 'p-2' : 'p-4';
|
const containerClass = compact ? 'p-2' : 'p-4';
|
||||||
const textClass = compact ? 'text-lg' : 'text-4xl';
|
const textClass = compact ? 'text-lg' : 'text-4xl';
|
||||||
const subTextClass = compact ? 'text-xs' : 'text-xl';
|
const subTextClass = compact ? 'text-xs' : 'text-xl';
|
||||||
@@ -765,7 +772,7 @@ function OvercurrentOverlay({ labels, fill = 0, visible = false, compact = false
|
|||||||
</div>
|
</div>
|
||||||
<div className={`relative z-10 text-center font-semibold text-white animate-pulse ${textClass}`}>
|
<div className={`relative z-10 text-center font-semibold text-white animate-pulse ${textClass}`}>
|
||||||
<div>OVERCURRENT</div>
|
<div>OVERCURRENT</div>
|
||||||
<div className={`mt-0 font-medium text-white ${subTextClass}`}>{labels.join(', ')}</div>
|
<div className={`mt-0 font-medium text-white ${subTextClass}`}>{safeLabels.join(', ')}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user