Fix lock-position crosshair jump when guiding starts#1452
Open
Eyeke2 wants to merge 1 commit into
Open
Conversation
The crosshair was drawn at the stale m_lockPosition from a previous session throughout calibration, then snapped to CurrentPosition() at STATE_GUIDING entry. Anchor the lock once at STATE_CALIBRATING_PRIMARY entry (preserving sticky), and stop overwriting a valid lock at STATE_GUIDING entry. The lock is now established once per cycle and stays static through calibration and guiding (except via lock-shift). Signed-off-by: Leo Shatz <leonid.shatz@gmail.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
This PR fixes a long-standing and annoying PHD2 guiding issue:
when starting guiding from a state that already had a lock position
(e.g. after a previous guiding session or after AutoSelect/click), the
calibration crosshair was drawn at the stale lock from the previous
cycle and then visibly snapped to the new lock at the moment
STATE_GUIDING was entered.
With this change, the displayed lock/crosshair position is kept consistent
with the newly selected guide position from the start of the guiding transition,
avoiding the misleading stale crosshair and the visible snap.
Root cause
Guider::SetStateSTATE_GUIDINGentry block unconditionallyoverwrote a valid lock with
CurrentPosition()(unless sticky wasset), which is what produced the jump. Meanwhile, nothing refreshed
the lock at the start of the calibration cycle, so the crosshair
was drawn at the stale previous-session value throughout calibration.
Fix
Two paired edits in
src/guider.cpp:At
STATE_CALIBRATING_PRIMARYentry, anchor the lock on thecurrent star (skipping when sticky is set and the lock is already
valid). The calibration crosshair is now drawn at the correct
guiding target from the first frame.
At
STATE_GUIDINGentry, stop overwriting a valid lock withCurrentPosition(). Only fall back toCurrentPosition()if thelock is somehow missing.
Net effect: the lock is established once, at the start of the cycle,
and stays static through calibration and guiding (except via the
existing lock-shift mechanism). No visible snap.
Behavior preserved
sticky lock in place, and the guiding-entry fallback never fires.
ShiftLockPosition()runs inUpdateGuideState, not at state-entry.STATE_CALIBRATING_PRIMARYcase still executes the anchor beforefalling through, so the lock is set in that path too.
STATE_GUIDINGentry covers any path thatarrives without a valid lock.
Notification side-effect
EvtServer.NotifySetLockPositionfires once per cycle (at calibrationentry, only when the value differs from the previous lock) instead of
at guiding entry. No increase in notification rate.
Testing
click a new star. Click Guide.
during calibration, then snaps to the new star at GUIDING entry.
frame and does not move.
useStickyLock):lock stays where the user/controller set it.