Laser AF: fix autofocus live-view freeze + add Restore Full FOV button#588
Open
hongquanli wants to merge 1 commit into
Open
Laser AF: fix autofocus live-view freeze + add Restore Full FOV button#588hongquanli wants to merge 1 commit into
hongquanli wants to merge 1 commit into
Conversation
… button Two laser-autofocus live-view improvements: - core_displacement_measurement: the displacement update runs on the GUI thread per focus-camera frame and (1) rebuilt the coordinate meshgrid every frame and (2) appended to t/x/y_array without ever trimming, so per-frame work and memory grew unbounded and the UI eventually froze (~10k frames). Cache the meshgrid across same-size frames, bound the arrays to the last N samples, and guard the centroid division against a blank frame (0/0 NaN). Behaviour is otherwise unchanged. - LaserAutofocusSettingWidget: add a "Restore Full FOV" button that resets the focus camera ROI to the full sensor (camera.set_region_of_interest(0, 0, *get_resolution())), undoing the laser-AF spot crop so the whole sensor is visible when re-locating the spot. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Two laser-autofocus live-view improvements (independent of the V-308 work in #569).
1. Fix autofocus live-view freeze (
core_displacement_measurement.py)DisplacementMeasurementController.update_measurementruns on the main GUI thread for every focus-camera frame. It:meshgridon every frame (the bulk of the per-frame CPU), andt_array/x_array/y_arraywithout ever trimming, so both memory and the per-frame plot payload grew without bound.After the focus camera streamed for a while (~10k frames), the UI thread saturated and the GUI froze whenever you sat in the autofocus live view. (Diagnosed with
py-spy: MainThread stuck inupdate_measurement, all other threads idle.)Fix:
Nsamples.0/0NaNs.Behaviour is otherwise unchanged (same centroid, offsets/scaling, plot of last
N, readings averaged overN_average).2. Add "Restore Full FOV" button (
LaserAutofocusSettingWidget)Adds a button to the laser-AF live-control group that resets the focus camera ROI to the full sensor via
camera.set_region_of_interest(0, 0, *camera.get_resolution())— undoing the laser-AF spot crop so the whole sensor is visible again (handy for re-locating the spot before re-initializing). Portable (no hardcoded sensor size); failures are logged, not raised.Testing
🤖 Generated with Claude Code