hud adjustments

This commit is contained in:
legop3
2026-05-17 13:55:11 -04:00
parent d67c4dd815
commit ba5865c397
7 changed files with 42 additions and 17 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -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="Roomba Rover" /> <meta name="apple-mobile-web-app-title" content="Roomba Rover" />
<title>Roomba Rover</title> <title>Roomba Rover</title>
<script type="module" crossorigin src="/assets/index-D16xiOSW.js"></script> <script type="module" crossorigin src="/assets/index-79XNkqrd.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DaH8DgR4.css"> <link rel="stylesheet" crossorigin href="/assets/index-CkqCBh_q.css">
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
@@ -1,7 +1,7 @@
// Drive Dock Action // Drive Dock Action
// Purpose: Defines the Drive Dock Action module and the local helpers/components used in this file. // Purpose: Defines the Drive Dock Action module and the local helpers/components used in this file.
// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. // Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit.
import { useMemo, useState } from 'react'; import { useEffect, useMemo, useState } from 'react';
import { useControlSystem } from '../../controls/index.js'; import { useControlSystem } from '../../controls/index.js';
import { useTelemetryFrame } from '../../context/TelemetryContext.jsx'; import { useTelemetryFrame } from '../../context/TelemetryContext.jsx';
import { formatKeyLabel } from '../../controls/keymapUtils.js'; import { formatKeyLabel } from '../../controls/keymapUtils.js';
@@ -138,6 +138,12 @@ export default function DriveDockAction({
const chargeValue = charging ? 'Charging' : docked ? 'Charging soon...' : '—'; const chargeValue = charging ? 'Charging' : docked ? 'Charging soon...' : '—';
const chargeTone = charging ? 'good' : docked ? 'warn' : 'bad'; const chargeTone = charging ? 'good' : docked ? 'warn' : 'bad';
useEffect(() => {
if (!manualAssistActive) return;
if (!docked) return;
actions.setManualDockAssistActive(false);
}, [actions, docked, manualAssistActive]);
const handleReturnToDrive = async () => { const handleReturnToDrive = async () => {
if (!roverId || pending) return; if (!roverId || pending) return;
setPending('drive'); setPending('drive');
@@ -1,21 +1,40 @@
import React from 'react'; import React from 'react';
import { useControlSystem } from '../../../controls/index.js'; import { useControlSystem } from '../../../controls/index.js';
import { useSessionSelector } from '../../../context/SessionContext.jsx';
import { useTelemetryFrame } from '../../../context/TelemetryContext.jsx';
function ManualDockAssistOverlay({ mobileHud = false }) { function ManualDockAssistOverlay({ mobileHud = false }) {
const { const {
state: { manualDockAssist }, state: { manualDockAssist },
} = useControlSystem(); } = useControlSystem();
const roverId = useSessionSelector((state) => state.session?.assignment?.roverId ?? null);
const frame = useTelemetryFrame(roverId);
const sensors = frame?.sensors || {};
const chargingLabel = sensors?.chargingState?.label || '';
const docked = Boolean(sensors?.chargingSources?.homeBase);
const charging = docked && chargingLabel.toLowerCase() !== 'not charging' && chargingLabel !== '';
const active = Boolean(manualDockAssist?.active); const active = Boolean(manualDockAssist?.active);
if (!active) return null; if (!active && !docked) return null;
const status = charging
? 'Docked and charging'
: docked
? 'Docked'
: 'Docking assist active';
const toneClass = charging
? 'border-emerald-200/70 bg-emerald-900/85 text-emerald-50'
: docked
? 'border-amber-200/70 bg-amber-900/85 text-amber-50'
: 'border-indigo-200/70 bg-indigo-900/85 text-indigo-50';
return ( return (
<div className="pointer-events-none absolute inset-0"> <div className="pointer-events-none absolute inset-0">
<div <div
className={`absolute left-2 rounded-lg border border-amber-200/70 bg-amber-900/85 px-2 py-1 font-semibold tracking-wide text-amber-50 shadow-lg ${ className={`absolute right-2 top-1/2 -translate-y-1/2 rounded-lg border px-2 py-1 font-semibold shadow-lg ${toneClass} ${
mobileHud ? 'top-2 text-[0.65rem]' : 'top-2 text-xs' mobileHud ? 'text-[0.65rem]' : 'text-xs'
}`} }`}
> >
DOCKING ASSIST ACTIVE {status}
</div> </div>
</div> </div>
); );
+1 -1
View File
@@ -12,7 +12,7 @@ export const DRIVE_LIMITS = {
boostSpeed: 400, boostSpeed: 400,
}; };
export const MANUAL_DOCK_ASSIST_MAX_SPEED = 85; export const MANUAL_DOCK_ASSIST_MAX_SPEED = 70;
export const COMMAND_DELAY_MS = 100; export const COMMAND_DELAY_MS = 100;