mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 09:31:20 -04:00
redoe
This commit is contained in:
@@ -1,14 +1,8 @@
|
||||
import { useDriveControl } from '../context/DriveControlContext.jsx';
|
||||
import { useTelemetryFrame } from '../context/TelemetryContext.jsx';
|
||||
|
||||
const manualOiButtons = [
|
||||
{ key: 'safe', label: 'Safe' },
|
||||
{ key: 'passive', label: 'Passive' },
|
||||
{ key: 'full', label: 'Full' },
|
||||
];
|
||||
|
||||
export default function DrivePanel() {
|
||||
const { roverId, speeds, stopMotors, sendOiCommand, runStartDockFull, seekDock } = useDriveControl();
|
||||
const { roverId, runStartDockFull, seekDock } = useDriveControl();
|
||||
const frame = useTelemetryFrame(roverId);
|
||||
const sensors = frame?.sensors || {};
|
||||
const drivingMode = (sensors.oiMode?.label || '').toLowerCase() === 'full';
|
||||
@@ -16,7 +10,6 @@ export default function DrivePanel() {
|
||||
const charging = Boolean(
|
||||
sensors.chargingState?.label && sensors.chargingState.label.toLowerCase() !== 'not charging',
|
||||
);
|
||||
const updated = frame?.receivedAt ? new Date(frame.receivedAt).toLocaleTimeString() : null;
|
||||
|
||||
return (
|
||||
<section className="rounded-sm bg-[#242a32] p-1 text-base text-slate-100">
|
||||
@@ -32,7 +25,6 @@ export default function DrivePanel() {
|
||||
tone="emerald"
|
||||
onClick={runStartDockFull}
|
||||
disabled={!roverId}
|
||||
// footnote={updated ? `Sensor ping ${updated}` : null}
|
||||
/>
|
||||
<ActionCard
|
||||
title="Dock and Charge"
|
||||
@@ -45,35 +37,7 @@ export default function DrivePanel() {
|
||||
onClick={seekDock}
|
||||
disabled={!roverId}
|
||||
/>
|
||||
{/* <SpeedRow left={speeds.left} right={speeds.right} /> */}
|
||||
{/* <div>
|
||||
<p className="text-sm text-slate-300">Manual OI</p>
|
||||
<div className="mt-1 flex flex-wrap gap-1">
|
||||
{manualOiButtons.map((btn) => (
|
||||
<button
|
||||
key={btn.key}
|
||||
type="button"
|
||||
onClick={() => sendOiCommand(btn.key)}
|
||||
disabled={!roverId}
|
||||
className="rounded-sm bg-black/40 px-1 py-0.5 text-sm text-slate-200 disabled:opacity-30"
|
||||
>
|
||||
{btn.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div> */}
|
||||
{/* <div className="flex flex-wrap gap-1">
|
||||
<button
|
||||
type="button"
|
||||
onClick={stopMotors}
|
||||
disabled={!roverId}
|
||||
className="flex-1 rounded-sm bg-red-600/70 px-1 py-1 text-sm text-white disabled:opacity-40"
|
||||
>
|
||||
Stop motors
|
||||
</button>
|
||||
</div> */}
|
||||
</div>
|
||||
{/* <p className="mt-1 text-sm text-slate-400">Sensor streaming auto-starts after each OI change.</p> */}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -105,30 +69,3 @@ function ActionCard({ title, description, statuses, tone, onClick, disabled, foo
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
function SpeedRow({ left, right }) {
|
||||
return (
|
||||
<div className="grid grid-cols-2 gap-1 rounded-sm bg-black/40 p-1 text-base">
|
||||
<div>
|
||||
<p className="text-sm text-slate-300">Left</p>
|
||||
<p className="font-semibold text-slate-100">{left}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-sm text-slate-300">Right</p>
|
||||
<p className="font-semibold text-slate-100">{right}</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function StatusPill({ label, active }) {
|
||||
return (
|
||||
<span
|
||||
className={`rounded-sm px-1 py-0.5 text-xs ${
|
||||
active ? 'bg-emerald-500/30 text-emerald-100' : 'bg-black/40 text-slate-500'
|
||||
}`}
|
||||
>
|
||||
{label}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user