mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 09:31:20 -04:00
wawa
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -11,8 +11,8 @@
|
|||||||
<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-DqjDfNt5.js"></script>
|
<script type="module" crossorigin src="/assets/index-DNjDcUqU.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-DsyhauXw.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-HhAzSaxc.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
|||||||
@@ -88,22 +88,13 @@ export default function VideoTile({
|
|||||||
// batteryCapacity,
|
// batteryCapacity,
|
||||||
// config: batteryConfig,
|
// config: batteryConfig,
|
||||||
// });
|
// });
|
||||||
const limiterOvercurrentMotors = useMemo(() => {
|
|
||||||
const motors = overcurrentLimiter?.overcurrent?.motors;
|
|
||||||
if (!motors) return null;
|
|
||||||
const active = Object.entries(motors)
|
|
||||||
.filter(([, flag]) => Boolean(flag))
|
|
||||||
.map(([key]) => key);
|
|
||||||
return active.length ? active : null;
|
|
||||||
}, [overcurrentLimiter]);
|
|
||||||
const wheelOvercurrents = sensors?.wheelOvercurrents || null;
|
const wheelOvercurrents = sensors?.wheelOvercurrents || null;
|
||||||
const overcurrentMotors = limiterOvercurrentMotors ?? (
|
const overcurrentMotors =
|
||||||
wheelOvercurrents == null
|
wheelOvercurrents == null
|
||||||
? []
|
? []
|
||||||
: Object.entries(wheelOvercurrents)
|
: Object.entries(wheelOvercurrents)
|
||||||
.filter(([, active]) => Boolean(active))
|
.filter(([, active]) => Boolean(active))
|
||||||
.map(([key]) => key)
|
.map(([key]) => key);
|
||||||
);
|
|
||||||
const limiterCaps = overcurrentLimiter?.caps || null;
|
const limiterCaps = overcurrentLimiter?.caps || null;
|
||||||
const limiterGroups = overcurrentLimiter?.overcurrent?.groups || null;
|
const limiterGroups = overcurrentLimiter?.overcurrent?.groups || null;
|
||||||
const limiterFill = useMemo(() => {
|
const limiterFill = useMemo(() => {
|
||||||
@@ -113,12 +104,7 @@ export default function VideoTile({
|
|||||||
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(overcurrentLimiter?.isActive);
|
const limiterActive = Boolean(overcurrentLimiter?.isActive);
|
||||||
const overlayVisible = Boolean(overcurrentMotors.length || limiterActive);
|
const overlayMotors = overcurrentMotors.length ? overcurrentMotors : limiterActive ? ['limiter'] : [];
|
||||||
const overlayLabels = overcurrentMotors.length
|
|
||||||
? overcurrentMotors.map((name) => OVERCURRENT_LABELS[name] || name)
|
|
||||||
: limiterActive
|
|
||||||
? ['Overcurrent limit']
|
|
||||||
: [];
|
|
||||||
const overlayFill = limiterFill ?? (overcurrentMotors.length ? 1 : 0);
|
const overlayFill = limiterFill ?? (overcurrentMotors.length ? 1 : 0);
|
||||||
|
|
||||||
const scheduleRestart = useCallback(() => {
|
const scheduleRestart = useCallback(() => {
|
||||||
@@ -446,13 +432,7 @@ export default function VideoTile({
|
|||||||
labelScale={hudLabelScale}
|
labelScale={hudLabelScale}
|
||||||
/>
|
/>
|
||||||
<HudChatInput compact={mobileHud} />
|
<HudChatInput compact={mobileHud} />
|
||||||
<OvercurrentOverlay
|
<OvercurrentOverlay motors={overlayMotors} fill={overlayFill} compact={mobileHud} />
|
||||||
labels={overlayLabels}
|
|
||||||
fill={overlayFill}
|
|
||||||
visible={overlayVisible}
|
|
||||||
compact={mobileHud}
|
|
||||||
debug={overcurrentLimiter ? { active: limiterActive, count: overcurrentMotors.length, fill: overlayFill } : null}
|
|
||||||
/>
|
|
||||||
<LowBatteryOverlay charge={batteryCharge} config={batteryConfig} compact={mobileHud} />
|
<LowBatteryOverlay charge={batteryCharge} config={batteryConfig} compact={mobileHud} />
|
||||||
{showVerticalBattery && batteryVisual.available ? (
|
{showVerticalBattery && batteryVisual.available ? (
|
||||||
<BatteryBarVertical visual={batteryVisual} />
|
<BatteryBarVertical visual={batteryVisual} />
|
||||||
@@ -750,11 +730,12 @@ const OVERCURRENT_LABELS = {
|
|||||||
rightWheel: 'Right wheel',
|
rightWheel: 'Right wheel',
|
||||||
mainBrush: 'Main brush',
|
mainBrush: 'Main brush',
|
||||||
sideBrush: 'Side brush',
|
sideBrush: 'Side brush',
|
||||||
|
limiter: 'Overcurrent limit',
|
||||||
};
|
};
|
||||||
|
|
||||||
function OvercurrentOverlay({ labels, fill = 0, visible = false, compact = false, debug = null }) {
|
function OvercurrentOverlay({ motors, fill = 0, compact = false }) {
|
||||||
if (!visible) return null;
|
if (!motors?.length) return null;
|
||||||
const safeLabels = Array.isArray(labels) && labels.length ? labels : ['Overcurrent'];
|
const safeLabels = motors.map((name) => OVERCURRENT_LABELS[name] || name);
|
||||||
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';
|
||||||
@@ -770,11 +751,6 @@ function OvercurrentOverlay({ labels, fill = 0, visible = false, compact = false
|
|||||||
<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}`}>{safeLabels.join(', ')}</div>
|
<div className={`mt-0 font-medium text-white ${subTextClass}`}>{safeLabels.join(', ')}</div>
|
||||||
{debug ? (
|
|
||||||
<div className="mt-0 text-[0.55rem] font-normal text-red-100">
|
|
||||||
{`dbg a:${debug.active ? 1 : 0} m:${debug.count} f:${Math.round(debug.fill * 100)}%`}
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user