motor.cgi: press-and-hold instead of one-step-per-click#55
Open
moontwister wants to merge 1 commit into
Open
Conversation
The previous click-handler fires gpio-motors once per mouse click, which means smooth-panning a motorized camera requires repeatedly clicking the arrow buttons. On most PTZ cameras this is impractical — users want to hold a direction button and have the gimbal pan continuously until released. Replace with a mousedown/touchstart → setInterval(250ms) loop that fires gpio-motors steps as long as the button is held, with mouseup, mouseleave, touchend, touchcancel, and window blur all stopping it. An inflight flag prevents queuing if a previous request hasn't returned yet (slow links / slow PTZ daemons). Step size and phase timing preserved at upstream defaults (5 steps, 10 ms phase). Center button preserved as a single fire (boards that implement a "home" / "park" position in their gpio-motors wrapper can interpret the x=0/y=0 call accordingly; most use this slot for a stop or no-op). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The current motor arrow buttons fire `gpio-motors` once per click, which is impractical on most motorized cameras — you have to repeatedly click an arrow to pan smoothly.
Replace with a mousedown/touchstart → `setInterval(250 ms)` loop that re-fires while the button is held, with mouseup / mouseleave / touchend / touchcancel / window-blur all stopping the loop. An inflight guard prevents queueing if a previous request hasn't returned yet (slow links, slow PTZ daemons).
Step size and phase timing preserved at the upstream defaults (5 steps, 10 ms phase). The 🆗 center button keeps its existing single-fire behaviour, so any board that maps `gpio-motors 0 0 N` to a "home" / "stop" / "no-op" in its wrapper keeps that behaviour.
Test plan
Context
Split out from the closed OpenIPC/firmware#2151 (KC110 board package, re-filed at OpenIPC/builder#99 per @widgetii's review). This particular change is fully generic — useful on any motorized camera using the upstream `gpio-motors` interface.
🤖 Generated with Claude Code