laser locking and idle

This commit is contained in:
legop3
2026-06-27 18:06:24 -04:00
parent 0cfc16528b
commit 4ee4f7d06e
9 changed files with 256 additions and 152 deletions
+3 -1
View File
@@ -166,6 +166,7 @@ export function ControlSystemProvider({ children }) {
: true;
const roverId = useSessionSelector((state) => state.session?.assignment?.roverId ?? null);
const homeAssistantEntities = useSessionSelector((state) => state.session?.homeAssistant?.entities ?? []);
const roomLightsLockedOn = useSessionSelector((state) => Boolean(state.session?.homeAssistant?.lightPolicy?.lockedOn));
const { homeAssistantSetState } = useSessionActions();
const overcurrentLimiter = useOvercurrentLimiter(roverId);
const driveTransform = useCallback(
@@ -491,13 +492,14 @@ export function ControlSystemProvider({ children }) {
const setLaser = useCallback(
(laserOn) => {
if (!pipeline.laser) return;
if (roomLightsLockedOn && laserOn !== false) return;
// The laser shares the same logical toggle contract as the headlight; it
// is separate only because it has its own GPIO pin, UI control, and keybind.
const action = typeof laserOn === 'boolean' ? (laserOn ? 'on' : 'off') : 'toggle';
pipeline.sendLaser(action);
recordControlIntent();
},
[pipeline, recordControlIntent],
[pipeline, recordControlIntent, roomLightsLockedOn],
);
const toggleLaser = useCallback(() => {