Autofocus to Infinity (aInfinity.lua) - Mostly for astrophotography

Started by leopablo, July 31, 2020, 05:17:36 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

leopablo

Hello guys,

Been experimenting with ML for a few weeks and decided to share my first script.
If you are tired of trying to find the right focus at night for astrophotography and loosing precious time while you could be shooting, this plugin is for you.
The idea is to make your settings during the day and to be able to retrieve it at night at the push of a button.

Highlights :
- Push button-simple, no calculus needed.
- Save as many lenses you want, with as many focals you need for each lens.
- More precise that you would ever be.

Features :
- Set Infinity, saves the current focus to the database. Before running this feature you must autofocus on an distant object, or any prefered method. Each lens and each focal lenghts gets a separate focus so if you're planning to use multiple you need to think ahead a bit.
- Get Infinity, automaticly restore saved focus preset from the database.

Both functions can be found under the focus menu.

Needless to say I'm no professional developer, so this script is for sure unoptimised and you might get some errors, but I hope you can find it useful.
Here is the code, it's fairly long (mostly because of the managing presets part) but quite simple : push autofocus motor to its limit while counting steps, to restore push again to limit and go back for as many steps.
https://github.com/tgko/magic-lantern-scripts/blob/master/AINFINITY.lua

To install simply copy to the ML/SCRIPTS/ folder and activate lua.mo. (you can delete other unused lua scripts to shorten startup time.)

NB1: the script creates a FOCUS folder inside the SCRIPT folder and a settings.lua file inside this folder, don't erase it unless you want to reset your presets.
NB2: After you use SetFocus, you will not be in focus. You have to use GetFocus to come back to your focused position.

Comments & thoughts are more than welcome.
Enjoy!

PizziDellaMaremma

Focus point on lenses changes by temperature condition, or am I wrong?
I noticed a big difference from cold to hot...