Linear Autofocus Abort Issue

Matthew Wong snoopy_94555 at yahoo.com
Fri Apr 3 00:30:19 BST 2020


Hello, 

This is my first time posting here, so go easy on me and let me know if I’m at the wrong place. 

I noticed that while using the linear algorithm for autofocus, if the auto select star fails, it would abort the autofocus as expected. However, unlike when autofocus fails to achieve focus, this abort does not return the focuser to its initial position. When used with the scheduler, the autofocus keeps retrying after failure. With enough retries, it moves the focuser to its stop. I’m not even sure if this is a bug rather than user error or faulty expectations, so I figured I’d bring it up here first. 

In any case, I took the liberty to read through the code on github and I think I found why this is happening. In focus.cpp, under Focus::checkAutoStarTimeout, line 2874-2876, initialFocuserAbsPosition is set to -1 before setAutoFocusResult(false) is called. Since the setAutoFocusResult is where the focuser gets returned to the initial position, line 2874 essentially disables this. Again, I’m not sure if this was done in this order for any other specific purposes, but I figure this is why the focuser runs to its stops whenever this happens. 

I’m not normally a C++ programmer outside of the occasional Arduino projects. I mostly work in C# on Win10, so I’m not tool-ed to test this readily. Hopefully, if this is indeed an issue, that this is an easy fix. If anyone want to help me get started on how to contribute, I’ll give it a shot when I get a chance. This would be my first foray into contributing to an open source project, so I’m unfamiliar with the procedures and etiquette. Again, go easy on me. Thanks!

Have a good day, 
Matt


More information about the Kstars-devel mailing list