The autofocus currently initializes from fixed reference lens values (IL1, ILS) and searches within a narrow interval around them. If the true optimal focus has drifted, the routine can converge to a defocused solution.
Based on recent testing, it is reasonable to assume that the user brings the beam close to focus before triggering autofocus. As suggested by Tim, a first improvement is to initialize the autofocus from the current IL1 / ILS values read from the instrument, rather than from hard-coded defaults.
This should significantly improve robustness, while keeping the existing local search strategy unchanged. Further refinements (adaptive search ranges, fallback strategies) can be considered later if needed.
The autofocus currently initializes from fixed reference lens values (IL1, ILS) and searches within a narrow interval around them. If the true optimal focus has drifted, the routine can converge to a defocused solution.
Based on recent testing, it is reasonable to assume that the user brings the beam close to focus before triggering autofocus. As suggested by Tim, a first improvement is to initialize the autofocus from the current IL1 / ILS values read from the instrument, rather than from hard-coded defaults.
This should significantly improve robustness, while keeping the existing local search strategy unchanged. Further refinements (adaptive search ranges, fallback strategies) can be considered later if needed.