This commit is contained in:
legop3
2026-07-11 02:29:41 -04:00
parent 0e5f76fb2f
commit 4b8aa67c32
5 changed files with 16 additions and 10 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
+1 -1
View File
@@ -78,7 +78,7 @@
<script defer src="https://analytics.otter.land/script.js" data-website-id="82dd56a5-db44-4279-bd1e-a4d9fee39af7" data-domains="rover.otter.land"></script>
<script defer src="https://analytics.otter.land/recorder.js" data-website-id="82dd56a5-db44-4279-bd1e-a4d9fee39af7" data-domains="rover.otter.land" data-sample-rate="0.15" data-mask-level="moderate" data-max-duration="300000"></script>
<title>Roomba Rover</title>
<script type="module" crossorigin src="/assets/index-CnZfvwYB.js"></script>
<script type="module" crossorigin src="/assets/index-DA6e69VD.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DwpUkSbG.css">
</head>
<body>
+12 -6
View File
@@ -8,9 +8,9 @@ import { useSessionSelector } from '../context/SessionContext.jsx';
const PTZ_STOP = { pan: 0, tilt: 0, zoom: 0 };
const PTZ_SPEEDS = {
slow: 0.22,
medium: 0.45,
fast: 0.72,
slow: 0.15,
medium: 0.5,
fast: 1,
};
const ZOOM_PULSE_MS = 220;
@@ -104,7 +104,7 @@ export function usePtzControlAdapter() {
}, [emitPtz]);
const sendMotion = useCallback(
(payload) => {
(payload, options = {}) => {
if (!isActive) return false;
const nextPayload = {
pan: clampUnit(payload?.pan),
@@ -112,7 +112,7 @@ export function usePtzControlAdapter() {
zoom: clampUnit(payload?.zoom),
};
const nextSignature = payloadSignature(nextPayload);
if (lastMotionSignatureRef.current === nextSignature) return true;
if (!options.force && lastMotionSignatureRef.current === nextSignature) return true;
lastMotionSignatureRef.current = nextSignature;
if (isIdlePayload(nextPayload)) {
emitPtz('ptzCamera:stop');
@@ -141,7 +141,13 @@ export function usePtzControlAdapter() {
stopMotion();
return true;
}
sendMotion({ pan: 0, tilt: 0, zoom: sign * PTZ_SPEEDS.medium });
/*
Zoom is different from pan/tilt because it is driven by repeated nudge
events from existing camera controls. Force each pulse through even when
the payload is identical, otherwise holding "camera up" only sends the
first zoom command and every later nudge is de-duped away.
*/
sendMotion({ pan: 0, tilt: 0, zoom: sign * PTZ_SPEEDS.medium }, { force: true });
if (zoomStopTimerRef.current) clearTimeout(zoomStopTimerRef.current);
/*
Existing rover camera controls are nudge/slider based, not hold-based.