Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in relative positioning of Lacerta MFOC #1924

Merged
merged 1 commit into from
Aug 22, 2023

Conversation

singraber
Copy link
Contributor

Fixes issue #1842. Lacerta MFOC with newer firmware (tested with version 3.1.01, driver indi_lacerta_mfoc_fmc_focus) fails to correctly change position when a relative change in the Focus In direction is selected.

The problematic code is (ticks * (dir == FOCUS_INWARD ? -1 : 1)), where ticks is an unsigned and -1 a signed integer. -1 gets converted into a huge unsigned value before the multiplication is carried out. Hence, the new desired targetTicks value is huge instead of decreased by the desired amount.

The same code can be found in the "old" driver lacerta_mfoc.cpp, the patch is applied there as well (untested).

Avoid problematic signed to unsigned conversion of -1
when computing the new absolute focus position.
@singraber
Copy link
Contributor Author

May also fix #1834

@chkettu
Copy link
Contributor

chkettu commented Aug 22, 2023

@singraber good point - thx for the fix

@knro knro merged commit e3ab7c3 into indilib:master Aug 22, 2023
knro pushed a commit to knro/indi that referenced this pull request Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants