A couple of days ago, I was imaging the rosette nebula, and I added 20x 5 minutes frames for each HA, R, G, and B filters. I was planning on taking all those frames in 2-3 nights, so after the first batch was done (I was away and didn't inspect the images), I was disappointed to find that the focus was awful. But I was pretty sure I had good focus when I began. I opened the frames and I checked the HFR value from the Statistics tool in the FITS Viewer. The HFR kept increasing by almost 0.1 pixels from one frame to another. Was this due to temperature change?? Unlikely, as the temperature difference did not sufficiently change throughout the night, and certainly not enough in 5 minutes! The reason was far simpler: Gravity!
As the mount tracked, the heavy QSI583 was pulling on the drawtube which I thought was locked tightly but apparently not enough. This caused the HFR to worsen naturally as the mount kept tracking the object as it rises up in the sky. This got me thinking about Autofocus between exposures. Of course, I have to tighten the drawtube to hold the CCD and that would resolve the issue, but you never know what other factors might affect your focusing. So instead of re-focusing every X frames, or Y minutes, or when temperature difference is more than Z degrees, I thought I'd settle on a more direct and reliable metric: the HFR!
So I added a new option to Ekos CCD module to perform auto focusing when HFR increases beyond a certain value. So what happens is that after, say, a 5 minute exposure is complete, Ekos will capture a subframe around the focus star selected earlier when performing the initial focusing procedure, it measures HFR and checks if it exceeds the user-set value, and if it is, it starts autofocus algorithm. When it is complete, the exposure is resumed! I haven't had the chance to test this as it was raining in the last few days, but hopefully will do soon!