Magic Lantern Forum

Developing Magic Lantern => Scripting Corner => Topic started by: garry23 on March 18, 2019, 11:07:34 PM

Title: Cycler
Post by: garry23 on March 18, 2019, 11:07:34 PM
Previously I published a script I called ‘The Toggler’; the idea being to gain quick access to various ML states without using the ML menus.

Although The Toggler worked, I believe it was a little too complicated, eg you would toggle forwards and backwards using various ‘hijacked’ keys.

I’ve now revisited The Toggler and simplified it, and, in the process, renamed it Cycler. Which can be downloaded here:

The idea remains the same, ie quickly gain access to various ML states. The rationale being some ML features, eg ETTR and Auto Bracketing, not work together, ie one needs to be switched off or set up correctly.

Unlike The Toggler script, Cycler only needs one button. In the published script I have used PLAY. In the version I use on my EOSM, I cycle through the following ML states by simply double pressing [PLAY]:
   1.   Null: switch off all menus under control
   2.   Switch ETTR on
   3.   Switch off ETTR and switch on Auto Bracketing
   4.   Switch off Auto Bracketing and switch on Focus Zoom
   5.   Switch off Focus Zoom and switch on Dual-ISO

Note that Cycler requires you to handle additional sub-menus, ie ‘all’ it does is switch on or off a particular ML main menu. But note you could add in sub menu changes as well.

The script ‘hijacks’ the PLAY button by looking out for double presses in the following way:
   •   [PLAY]+(<1000ms)+[PLAY] = cycle to the next ML state
   •   [PLAY]+(>1000ms)+[PLAY] = [PLAY] functions as normal

Cycler only moves through the states in one (circular) direction. The time delay can be adjusted in the script.

The script is relatively simple and additional states can be added easily. All one has to do is manage switching on/off the previous state. Just follow the script’s template.

Note, you can cycle between complex states, ie with multiple menu set calls.

Bottom line: Cycler is a simple script, that I personally find of value, especially on the EOSM with its limited buttons and when there may be clashes, eg access to the SET button or when using ETTR vs Auto Bracketing: I hope others find it of interest as well.

Finally, as usual, I welcome any feedback on the script.

Title: Re: Cycler
Post by: Jonit on March 19, 2019, 02:32:13 PM
Thank you Garry! I think I will find this very useful.
Title: Re: Cycler
Post by: garry23 on March 20, 2019, 10:00:24 PM
Just tweaked the functionality a little, ie:
    [PLAY]+[Anykey, eg half shutter press] = null/reset [PLAY]
    [PLAY]+{<button_delay}+[PLAY] = cycle
    [PLAY]+{>button_delay and < 3*button_delay}+[PLAY] = reverse cycler direction: will also see <<>> in top bar. Plus subsequent colour change to text
    [PLAY]+{>3*button_delay}+[PLAY] = normal [PLAY]: will also see [PLAY] in top bar

Still download from:

Because some of my keys are not functioning on one of my EOSMs, I find this script greatly helps. But even if you have a fully functioning cam, I hope you find this little script of some value.

BTW here is a test image I took the other day with my IR converted EOSM. I used a Mamiya Sekor 35mm medium format lens and took 8 sensor brackets. I quickly moved around the various ML states using the Scaler, ie just by pushing [PLAY].

The image is 12411 x 9891, ie rather large :-)

( (

Title: Re: Cycler
Post by: garry23 on March 22, 2019, 12:35:11 PM
Just a quick update.

As some are aware, I write my scripts for myself, but freely share in case others have an interest.

I've added in an 'extra functionality' as I find myself needing to insert (dark) bookends at the start and end of bracketing sequences.

Thus, simply using the [PLAY] button I can now quickly switch/toggle between the base exposure and the bookmark exposure, using this script.

If one presses [PLAY] once, the script is initiated.

If [PLAY] is pressed immediately then the script cycles to the next ML state.

If the second [PLAY] is delayed, then the ML top bar will change to various options over a few seconds, eg BOOK, <<>>, or PLAY

Pressing the [PLAY] button at the right time actives that option, ie if BOOK is displayed I toggle between a (dark) bookmark exposure and the base exposure; if <<>> is displayed a reverse the cycler direction.

The script is available from here as usual:
Title: Re: Cycler
Post by: garry23 on March 23, 2019, 09:13:38 AM
Just a minor tweak.

Now the script auto resets the shutter after a bookmark image has been taken.

As I say, the script works for me  ;)
Title: Re: Cycler
Post by: garry23 on March 23, 2019, 06:53:34 PM
Some may be interested in this post of mine:
Title: Re: Cycler
Post by: Danne on March 23, 2019, 07:32:55 PM
Is sensor bracketing done mechanichally or with some lua script?
Like your results but hard to follow what's going on. I guess one should take the time and get hands dirty testing.
Title: Re: Cycler
Post by: garry23 on March 23, 2019, 07:40:54 PM
Title: Re: Cycler
Post by: garry23 on March 26, 2019, 10:21:31 AM
OK I admit I really enjoy 'playing around' with Lua: it's fun  :)

In the first version of Cycler I restricted myself to just using one key to do everything, by using time delays to cycle through options.

In this version of the script, called CyclerB, I use two keys, ie PLAY and MENU to achieve the same functionality, but without time delay.

I have tried to make the script readable and have inserted comments to help those trying to learn Lua and who wish to adapt my version; which , of course, was written for my use  ;)

The script is downloadable from here:

Bottom line: if you wish to change ML states without going into the ML menu, then you may wish to try Cycler or CyclerB

As usual I welcome feedback, especially if it helps me in my Lua education and/or making the script 'better'.
Title: Re: Cycler
Post by: garry23 on March 30, 2019, 09:17:52 AM
In case some find my (personal) scripts of value, here is an update and 'tutorial' on using the Cycler.

I wrote the Cycler for a specific reason, but I see it having more general uses, ie anytime you wish to quickly change ML states, without going into the ML menu system.

My specific use case is when I using the EOSM, with its limited button UI, as a Medium Format digital back, ie using the full scope of a 645 lens with the RhinoCam and sensor bracketing.

When you first turn on the Cam, the Cycler will run (assuming you have set auto run) and 'null' all the ML states you have selected to cycle.

Note you can change/add ML state details in the script to suit your needs, ie use my script as a framework.

Cycler always displays its configuration in the right of the top ML bar. Thus at camera start up one would see the following, ie the NULL state:

( (

The Cycler uses two keys, but in doing so allows you to fully access the functionality of those keys as well.

If we now press the [PLAY] button/key we will see the following:

( (

When you see three ML states being reported, you know you are then able to cycle to another ML state. The left hand state shows the ML state that you can reverse cycle to and the right hand state the ML state you can cycle to directly. The middle state shows you the ML state you are currently in.

If you now do a half shutter press the text will turn red, like this:

( (

Do it again it will turn back to being black. Red indicates that you will cycle in reverse, ie cycle to the state shown on the left. Black text means you will cycle to the right.

To cycle to the desired state, ie to the left or right one, simply press [MENU]. The Cycler will then cycle to the selected ML state and update the ML top bar display to show you the ML state you are now in.

If you press [PLAY], rather than [MENU], you will cycle to another option for the [PLAY] button.

For my use the [PLAY] has three options. It can initiate a ML state change, as above. It can operate as a normal [PLAY] button. Or it can take a darkframe bookmark image, which is useful when bracketing, to help differentiate the start and/or end of bracketing sequences.

If [PLAY] is displayed then pressing [MENU] will operate the [PLAY] button in its normal mode.

( (

If [BOOK] is displayed then pressing [MENU] will take a bookmark image and reset the exposure.

( (

Both [PLAY] and [BOOK] options return the display to showing the ML state you are currently in. By adapting my script you can add as many additional functions to the [PLAY] button as you like ;-)

Cycler has no menus: it doesn't need any.

The latest version is always available here:

I've tried to write the script in a open way and have provided comments. I therefore hope even non-scripters will be able to tweak the script to their use, ie in a text editor.

As usual I welcome feedback and will always support questions on the Cycler.
Title: Re: Cycler
Post by: garry23 on April 02, 2019, 09:27:04 PM
Simple update to allow you to switch off The Cycler, eg if you find conflicts with other scripts that you are running.

As usual it can be downloaded from here: