From b86eec88f8b7dc8aba30fbedbb90c4991707857b Mon Sep 17 00:00:00 2001 From: legop3 Date: Fri, 17 Jul 2026 23:33:46 -0400 Subject: [PATCH] trying to fix zoom stopping camera --- server/src/services/ptzCameraService/index.js | 30 +++++++++---------- to-do.md | 9 ++++-- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/server/src/services/ptzCameraService/index.js b/server/src/services/ptzCameraService/index.js index 5e7c2cca..0942d923 100644 --- a/server/src/services/ptzCameraService/index.js +++ b/server/src/services/ptzCameraService/index.js @@ -1223,19 +1223,7 @@ function requestMotionCommands({ fullStop = false, panTilt = false, zoom = false const zoom = desiredMotion.zoom; try { await initialize(); - if (!zoom) { - /* - Zero zoom velocity is the axis-local release. The camera's Stop - implementation is over-broad and halts pan/tilt even when the - request includes only Zoom=true. - */ - await callOnvif('continuousMove', { - profileToken: state.profileToken, - zoom: 0, - onlySendZoom: true, - timeout: ZOOM_PULSE_TIMEOUT_MS, - }); - } else { + if (zoom) { /* The TrackMix does not advertise continuous zoom, but physical testing showed each accepted zoom-only ContinuousMove advances one @@ -1290,7 +1278,7 @@ function syncZoomRepeater() { }, ZOOM_REPEAT_MS); } -function queueMotionIntent(motion, reason = 'input', options = {}) { +function queueMotionIntent(motion, reason = 'input') { const nextMotion = normalizeMotionIntent(motion); const panTiltChanged = !panTiltMatches(nextMotion, desiredMotion); const zoomChanged = nextMotion.zoom !== desiredMotion.zoom; @@ -1315,10 +1303,20 @@ function queueMotionIntent(motion, reason = 'input', options = {}) { either motor scheduler: pan/tilt already has a long continuous command, and zoom has its own 120 ms axis-only repeater. */ - const sendPanTilt = panTiltChanged || Boolean(options.forceAxes); - const sendZoom = zoomChanged || Boolean(options.forceAxes); + const sendPanTilt = panTiltChanged; + /* + A live-camera recording proved that both Stop(Zoom=true) and a zero-velocity + zoom ContinuousMove halt pan/tilt on this firmware. Zoom itself is step-based: + each non-zero pulse advances once and then settles. Releasing zoom therefore + means clearing its timer and any coalesced-but-unsent pulse, with no camera + command at all. The last transmitted pulse retains its finite one-second + timeout as a backstop. + */ + if (zoomChanged && !nextMotion.zoom) pendingZoomCommand = false; + const sendZoom = Boolean(nextMotion.zoom) && zoomChanged; if (sendPanTilt) armPanTiltRenewal(); if (sendZoom) syncZoomRepeater(); + if (zoomChanged && !nextMotion.zoom) clearZoomRepeat(); const pending = requestMotionCommands({ panTilt: sendPanTilt, zoom: sendZoom }); pending.catch(() => {}); return { ok: true, motion: desiredMotion, reason }; diff --git a/to-do.md b/to-do.md index ffd3fb16..a977c112 100644 --- a/to-do.md +++ b/to-do.md @@ -1,7 +1,12 @@ 1. assign rovers based on battery percentage, give people highest one 2. add admin ui for VIP and private requests instead of only through discord -3. add more background gap themes -4. fix this: +3. add flag in roverd for video aspect ratio + 1. either 4:3 or 16:9 + 2. default is 4:3 + 3. all it does is tell the web UI to make the rover video 16:9 or 4:3 shaped + 1. web UI should default to 4:3 if that rover doesnt yet have that config yet +4. add more background gap themes +5. fix this: `Jun 18 15:14:18 roombaserver.local node[216731]: /home/daniel/MultiRoombaRover/server/src/services/roverManager/socketHandlers.js:92 Jun 18 15:14:18 roombaserver.local node[216731]: cb({ error: err.message }); Jun 18 15:14:18 roombaserver.local node[216731]: ^