Evident IX85: Attempt to make AF Limits actually work.#947
Merged
Conversation
Fix 1 (FindFocusWithOffset, line ~4383): Added clamping of targetZPos to hardware limits (FOCUS_MIN_POS/FOCUS_MAX_POS) and then to the user-set AF search limits (farLimit_/nearLimit_) before the final focus move. This prevents the post-search offset move from driving the objective outside the safe range — the most likely cause of the collision. Fix 2 (Initialize, line ~3586): Removed the block that overwrote nearLimit_/farLimit_ from the hardware's AFL query (which returns the cleared full-range defaults after remote mode exits). Replaced with zdcInitNeeded_ = true, ensuring InitializeZDC() always re-applies the adapter's stored limits (restored from a saved config file) before the first AF operation. Fix 3 (OnNearLimit/OnFarLimit, lines ~4479, ~4517): The direct AFL send is now only attempted when afStatus_ == 0 (idle), respecting the hardware documentation constraint. The member variable is updated unconditionally and zdcInitNeeded_ = true guarantees limits are applied before the next AF run regardless.
…, on the IX85-Nosepiece device) - BeforeGet: reads back the stored near limit for the currently active objective, so the property always shows the current value - AfterSet: converts the typed µm value to steps, clamps to [FOCUS_MIN_POS, FOCUS_MAX_POS], updates nearLimits_[obj], and sends the NL command to the hardware - Range is enforced via SetPropertyLimits (0 to 10,500 µm) The existing Set-Focus-Near-Limit (Set/Clear) and the read-only Focus-Near-Limit-um properties are unchanged. The new property is per-objective — whatever objective is currently in position receives the new limit when the value is set.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Evident IX85 Windows device adapter to improve autofocus (AF) limit handling across remote-mode transitions and to allow setting per-objective focus near-limits numerically (in µm) from the UI/config.
Changes:
- Added a writable numeric property to set the nosepiece’s per-objective focus near-limit directly in micrometers.
- Changed ZDC autofocus initialization behavior to re-apply adapter-stored AF limits instead of reading limits from hardware at init time.
- Added clamping in “Find Focus with Offset” to keep the offset move within configured AF search limits (and hardware limits).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
DeviceAdapters/EvidentIX85Win/EvidentIX85Win.h |
Declares the new nosepiece property action handler for numeric near-limit setting. |
DeviceAdapters/EvidentIX85Win/EvidentIX85Win.cpp |
Implements numeric near-limit property, adjusts AF limit initialization/setting, and adds clamping for offset moves. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Also enable to set nosepiece limit numerically.