Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - garry23

#201
Share Your Videos / IR Timelapse Test
February 04, 2017, 06:51:02 PM
Just a simple IR timelapase test, thanks to ML's ETTR capability.

https://www.facebook.com/garry.george.75/videos/1260648377376035/
#202
Scripting Q&A / Lua API test
January 24, 2017, 08:47:35 AM
@A1ex

I continue to have problems with moving the lens in my scripts. The issue is around lens.focus reporting back, ie ok or not, but specifically how to test it has reached the macro of infinity ends.

So I went back to the API test (which I believe you wrote?)

In looking at the code, I think there is an error in there (but I may be wrong). Here is te snippet:

for i,step in pairs{3,2,1} do
            for j,wait in pairs{true,false} do
                printf("Focusing forward with step size %d, wait=%s...\n", step, wait)
                local steps_front = 0
                while lens.focus(1,step,true) do
                    printf(".")
                    steps_front = steps_front + 1
                end
                printf("\n")
                printf("Focus distance: %s\n",  lens.focus_distance)
               
                msleep(500)
               
                printf("Focusing backward with step size %d, wait=%s...\n", step, wait)
                local steps_back = 0
                while lens.focus(-1,step,true) do
                    printf(".")
                    steps_back = steps_back + 1
                end
                printf("\n")
                printf("Focus distance: %s\n",  lens.focus_distance)

                msleep(500)

                printf("Focus range: %s steps forward, %s steps backward. \n",  steps_front, steps_back)
            end
        end


I think the lens.focus in the while loops should be:

lens.focus(-1,step,wait)

That is at the moment it only tests the AF true state.

Irrespective of this, however, your API worked (either way, ie with or without wait), and I keep getting issues, which I will keep trying to debug  ;)

BTW here is my code snippet, which moves the lens towards the macro, stopping when certain dof conditions are meet and (hopefully) exiting when the macr0 end soft error is meet: but it doesn't stop, it just hangs on the error reporting.

repeat
a1=a2
b1=b2
fp = lens.focus_distance
while (b2 > a1) do
if lens.focus(1,1,false) then
lens_ok = true
else
lens_ok = false
end
b2 = lens.dof_far
a2 = lens.dof_near
end
lens.focus(-1,1,false)  -- move one step forwards for focus bracket overlap
take_brackets()
until not lens_ok


Cheers

Garry
#203
General Help Q&A / FRSP + Audio Triggering
January 21, 2017, 09:29:02 PM
@A1ex

I'm sure I'm doing something wrong with FRSP.

I'm using the latest Lua fix branch in the Experimental area.

I'm triggering the shutter via the ML Audio trigger, ie from the Radian 2 timelapse unit.

I've set FRSP to Full and DNG.

The first FRSP is taken and I see a message flashed up that I can't fully read, something about a long half shutter press.

Subsequent Audio triggers don't trigger the FRSP, in fact no picture taking.

Hope you can throw some light on this behaviour.

Cheers

Garry
#204
Tutorials and Creative Uses / EOSM and Radian 2
January 21, 2017, 07:20:31 PM
For those of you that use the EOSM for timelapse, you may be interested in my latest post that shows the EOSM can work with the Radian 2 http://photography.grayheron.net/2017/01/a-killer-combination.html
#205
General Help Q&A / Audio Trigger
January 21, 2017, 02:40:33 PM
I'm trying to get the EOSM working with the Radian 2 timelapse device.

I'm using the shutter signal from the Radian into the EOSM Audio port.

The problem I'm having is that the Radian shutter line appears really noisy.

A limit of 20dB is not enough.

If it is possible, is there some who could tweak the ML Audio Trigger code to increase the limit from 20dB to, say, 30dB, so I can prove the concept of the EOSM being triggered via the Radian.

BTW I have proved the Audio triggering works of a cheap wifi triggers, the problem is the noisy Radian.

#206
General Help Q&A / EOSM & Timelapse
January 17, 2017, 08:35:37 AM
A potentially dumb question.

Without any Lua scripting, ie using the Canon and ML settings, it it possible to switch off LV when doing a ML Timelapse?

At the moment, the screen seems to stay on all the time.

As I say, a potentially dumb question.
#207
Scripting Q&A / ML Menu interactions
January 11, 2017, 06:16:42 PM
Just some feedback on ML use.

I have a script running that detects I'm in the ML menu and (on the EOSM) converts the [INFO] button into a dedicated [Q] button, so I can go in and out of the ML menus with ease, ie without touching the screen, eg if I have gloves on.

Here is the relevant redacted part of the script:

if menu.visible then
if key == KEY.INFO then -- sim [Q] test
q_pressed = true
return false
else
return true
end
end


All is OK, until you switch on the intervalometer, whilst staying in the ML menu: then the above code doesn't work.

Strange  ???
#208
General Help Q&A / FRSP
January 10, 2017, 06:54:36 PM
Forgive this potentially dumb question.

When saving FRSP in individual DNGs or DNGs in an MLV folder, I thought the ISO and Tv were saved now.

But it looks like I'm wrong.

Or am I right?

BTW I'm using the EOSM latest experimental build.
#209
Scripting Q&A / Latest Lua fix and step size
January 07, 2017, 05:13:41 PM
Didn't know where to post this.

I'm using the latest nightly experimental: https://builds.magiclantern.fm/jenkins/job/manual_lens_info/5/artifact/platform/EOSM.202/magiclantern-manual_lens_info.2017Jan06.EOSM202.zip

I'm using this test script:

test_menu = menu.new
{
    name = "Show keypress",
    choices = { "Off", "On" },
    value = "On",
}

function event.keypress(key)
    if key == KEY.INFO then
        repeat
lens.focus(-1,3,false)
until lens.focus_distance >= lens.hyperfocal
    return false
    else
        return true
    end
end


All it does is move the lens to the hyperfocal after pushing the [INFO] button.

The thing is: change the step size, 1 vs 3, doesn't seem to change the lens drive on my EOSM.

Not sure why?

Any ideas?

Cheers

Garry
#210
General Help Q&A / Focus/Spotmeter for Manual lens
January 06, 2017, 04:27:02 PM
Does anyone know if it is possible to move the ML focus point around on an EOSM is one is using a manual lens.

Either through the UI or Lua.

If this is not possible, I wonder if 'someone' (who can) could consider adding this to the Lua inerface?

At the moment, with a manual lens, unless I'm missing something, you can move this focus point or (ML) spot meter around.
#211
General Help Q&A / FPS Override Question
January 06, 2017, 01:16:12 PM
@A1ex

I'm seeing if switching FPS override on will indeed help me use LV 'in the dark'.

It looks promising, but what I'm finding is that the 'brighter boost' is only active for a couple of seconds, and then LV returns to 'normal' t on my EOSM. On my 5D3 the boosted LV image remains constantly active/on.

Any feedback on this would be welcome, ie I'm using it wrong or will it not work on the EOSM?
#212
Scripting Corner / Simulated Q Button for EOSM
January 05, 2017, 09:27:39 PM
Although the EOSM is rather limited in the number of buttons, many say this is made up for via the touch screen.

Maybe: but if you have 'fat fingers' or just like using buttons (like me), you may like to try this small helper script.

All it does is convert one of the EOSM buttons into a Q button: I use [INFO].

To use, simply put in the script folder, make sure Lua module is running and the script is in autorun mode.

The [INFO] is only switched to be a simulated [Q] when the ML menu is active: at all other times [INFO] acts like [INFO].

You can easily change KEY.INFO to, say, KEY.PLAY if you wish - your choice :)

With the script running, it is very easy to move through the ML menu on the EOSM simply using the main wheel and the [INFO/Q] button.

Usual caveats: works for me and I provide no guarantees  ;)

Cheers

Garry

q_pressed = false

function sim(arg)
if q_pressed == true and menu.visible then
key.press(KEY.Q)
q_pressed = false
return false
else
return true
end
end

function test4Q(key)
    if key == KEY.INFO and menu.visible then
q_pressed = true
return false
else
return true
end
end

event.keypress = test4Q
event.shoot_task = sim
#213
Scripting Corner / Bulb_ND Script
January 05, 2017, 03:12:31 PM
Some time ago David M wrote a ND_Bulb module, but it never got into the nightlies :(

Although I have the module, it now seems to interact with the latest builds I am using, ie the toggle runs all over the place. I have thus had to 'give up' David's module...until now.  :)

The attached is a simple script I have written to 'emulate' David's module, at least for taking ND images.

It is pretty self explanatory, ie set the camera up without the filter on, put the filter on and run the script.

Note, because we have several Lua builds out there, you may need to adjust the script, ie to account for camera.shoot formating.

As usual, I value any feedback.

Cheers

Garry

--[[
Bulb ND Script V1
Release 0.1
Jan 2017

Simply takes an ND image using the currently set shutter value, but assumes an ND filter is fitted.
To use:
1. Compose and set shutter WITHOUT the ND filter fitted
2. Set ND values in menu and delay (in LV delay is automatically 3s)
3. Press SET to intiate script
4. Fit ND filter
5. Run script by doing a half shutter press

Pushing any button, other than the halfshutter, clears the script, ie you will need to renter the menu to rerun

*******************************************************************************************************
*     *
* If you reference this script, please consider acknowledging me at http://photography.grayheron.net/ *
*     *
*******************************************************************************************************
--]]

temp = 0
ND_shutter = 0

function my_shoot()
if ND_shutter > 30 then
camera.bulb(ND_shutter)
else
camera.shutter.ms = ND_shutter*1000
camera.shoot(false) -- Note may need to change to camera.shoot(64,false) on some Lua builds
end
end

function run_script()
menu.close()  -- just in case
    local save_current_shutter = camera.shutter.apex
ND_shutter = camera.shutter.apex - scriptmenu.submenu["ND Full Stop Value?"].value - scriptmenu.submenu["ND Fractional value?"].value/10
msleep(scriptmenu.submenu["Delay?"].value * 1000)
ND_shutter = 2^(-ND_shutter) -- convert to seconds
    my_shoot()
camera.shutter.apex = save_current_shutter -- reset to non ND shutter value
end

function mytest(key)
if key == KEY.HALFSHUTTER then
run_script()
event.keypress = nil
return false
else
event.keypress = nil
return true
end
end

function start()
menu.close()  -- just in case
if  scriptmenu.submenu["ND Full Stop Value?"].value ~= 0 then
event.keypress = mytest -- set up keypress handler
end
end

scriptmenu = menu.new
{
    parent = "Shoot", -- change this to position the script into other ML menu locations
    name = "Bulb ND",
    help = "Set shutter without ND fitted",
    submenu =
{
{
name = "Run Script",
select = function(this)
if key.last == KEY.SET then task.create(start) end
end,
help = "Runs the main script after pressing SET",
help2 = "Now fit ND and press halfshutter",
},
{
name = "ND Full Stop Value?",
help = "In stops",
min = 0,
max = 16,
value = 0,
warning = function(this)
temp = camera.shutter.apex - scriptmenu.submenu["ND Full Stop Value?"].value - scriptmenu.submenu["ND Fractional value?"].value/10
temp = math.ceil((2^(-temp))*1000)/1000
if temp > 30 then temp = math.ceil(temp) end
return "ND Shutter (s): ".. tostring(temp)
end,
},
{
name = "ND Fractional value?",
help = "In tenths",
min = 0,
max = 9,
value = 0,
warning = function(this)
temp = camera.shutter.apex - scriptmenu.submenu["ND Full Stop Value?"].value - scriptmenu.submenu["ND Fractional value?"].value/10
temp = math.floor((2^(-temp))*1000)/1000
if temp > 30 then temp = math.floor(temp) end
return "ND Shutter (s): ".. tostring(temp)
end,
},
{
name = "Delay?",
help = "In seconds",
min = 0,
max = 5,
value = 0,
}
}
}
#214
Scripting Corner / NEW: Toggler for the EOSM
January 04, 2017, 03:26:17 PM
We all know the EOSM is a great (ML) camera: apart, that is, from having a rather basic UI and lack of buttons; compared to other EOS cameras.

Although I do not use my EOSM from videography (most probably like most ML users with an EOSM) I do like using the EOSM for timelape, with or without FRSP, in DNG or MLV mode.

The downside for me is the accessing the ML menu is rather fiddly, especially if you have 'fat fingers'.

This is why I have updated my 'Toggler' script specifically for the EOSM: although the script will work on other cameras.

The script has no menus, ie it is always on, once ML Lua autoload is set in the ML menu.

The first thing you will need to do is set up your preferred ML states. The script below shows you mine (in the preset table). Note you can set any number of ML menus and sub-menus for each condition.

You should make sure you control the ML menus as you 'toggle' through the states, ie switching menus on and off. One approach I have found is to set up a base configuration and use this in each state condition, ie switching on or off, or to specific menu conditions. BTW you will need to know the number that each ML menu uses. O is a safe off and 1 a safe on. Most menus with more than one state start at 0 and move up, ie 1, 2 etc. The best bet if you don't know is to set it to 0 in the script and see what happens. The script still works if you are in the ML menu, so you can see things change :-)

I personally use the [MENU] and [PLAY] buttons, but you can change these, but note things are rather limited on the EOSM, eg you could use KEY.INFO.

You can change the on-screen notification display time: the default is 2 sec.

To use the script simply note the following sequences:

[MENU] = normal use of [MENU]
[PLAY][PLAY] = normal use of [PLAY]
[PLAY][MENU] = enter toggler interactive mode
In interactive mode [PLAY] will toggler through your ML condition states giving you an on-screen message
In interactive mode [MENU] will set that condition (and give an on-screen message) and leave interactive mode.
In interactive mode pressing any other key (not [MENU] or [PLAY]) will leave interactive mode

As I say above, you can use the toggle mode at any time, including when you are in the ML menu.

As usual I welcome feedback to help me become a better Lua scripter.

--[[
Simple (no menu) script to reset EOSM to your ML favorite states 'just' using the MENU and PLAY buttons on the EOSM
Change/set the preset table below to your liking
Version 0.1
Garry George Jan  2017
http://photography.grayheron.net/
--]]

last_key_pressed = 999
imode = false
config = 0
button_1 = KEY.MENU
button_2 = KEY.PLAY
message_time = 2000 -- in ms

presets =
{
    {
        name = "All off",
        menus=
        {
{ menu = "Shoot", item = "Advanced Bracket", value = 0},
{ menu = "Shoot", item = "Silent Picture", value = 0},
{ menu = "Expo", item = "Auto ETTR", value = 0},
{ menu = "Expo", item = "Dual ISO", value = 0},
{ menu = "Shoot", item = "Intervalometer", value = 0},
        }
    },
    {
        name = "Auto ETTR", -- Only Auto ETTR
        menus=
        {
{ menu = "Shoot", item = "Advanced Bracket", value = 0},
{ menu = "Shoot", item = "Silent Picture", value = 0},
{ menu = "Expo", item = "Auto ETTR", value = 1},
{ menu = "Expo", item = "Dual ISO", value = 0},
{ menu = "Shoot", item = "Intervalometer", value = 0},
}
    },
    {
        name = "Dual ISO", -- Only DUAL ISO
        menus=
        {
{ menu = "Shoot", item = "Advanced Bracket", value = 0},
{ menu = "Shoot", item = "Silent Picture", value = 0},
{ menu = "Expo", item = "Auto ETTR", value = 0},
{ menu = "Expo", item = "Dual ISO", value = 1},
{ menu = "Shoot", item = "Intervalometer", value = 0},
        }
    },
    {
        name = "Dual + ETTR", -- Both DUAL + ETTR
        menus=
        {
{ menu = "Shoot", item = "Advanced Bracket", value = 0},
{ menu = "Shoot", item = "Silent Picture", value = 0},
{ menu = "Expo", item = "Auto ETTR", value = 1},
{ menu = "Expo", item = "Dual ISO", value = 1},
{ menu = "Shoot", item = "Intervalometer", value = 0},
        }
    },
    {
        name = "MLV FRSP Timelapse", -- Silient timelapse in MLV FR mode
        menus=
        {
{ menu = "Shoot", item = "Advanced Bracket", value = 0},
{ menu = "Shoot", item = "Silent Picture", value = 1},
{ menu = "Silent Picture", item = "Silent Mode", value = 5},
{ menu = "Silent Picture", item = "File Format", value = 1},
{ menu = "Expo", item = "Auto ETTR", value = 0},
{ menu = "Expo", item = "Dual ISO", value = 0},
{ menu = "Shoot", item = "Intervalometer", value = 1},
        }
    },
    {
        name = "ML Auto Bracketing", -- Auto Bracketing
        menus=
        {
{ menu = "Shoot", item = "Advanced Bracket", value = 1},
{ menu = "Shoot", item = "Silent Picture", value = 0},
{ menu = "Expo", item = "Auto ETTR", value = 0},
{ menu = "Expo", item = "Dual ISO", value = 0},
{ menu = "Shoot", item = "Intervalometer", value = 0},
        }
    },
    {
        name = "FRSP", -- Full Res Silent Picture
        menus=
        {
{ menu = "Shoot", item = "Advanced Bracket", value = 0},
{ menu = "Shoot", item = "Silent Picture", value = 1},
{ menu = "Expo", item = "Auto ETTR", value = 0},
{ menu = "Expo", item = "Dual ISO", value = 0},
{ menu = "Shoot", item = "Intervalometer", value = 0},
        }
    }
}

reset = function(key)
for i,v in ipairs(presets[key].menus) do
menu.set(v.menu,v.item,v.value)
end
end

function test4reset(key)
-- check for imode frst
if imode then
if key == button_2 then -- move through presets
config = config + 1
if config > #presets then config = 1 end
display.notify_box(presets[config].name, message_time)
return false
end
if key == button_1 then -- leave imode and reset ML menus as requested
imode = false
if config == 0 then config = 1 end
reset(config)
local text = "Set to: "..presets[config].name
display.notify_box(text, message_time)
return false
end
end
imode = false
if key == button_2 and last_key_pressed == button_2 then -- use play key as normal
last_key_pressed = 999 -- reset
return true
elseif (key == button_1 and last_key_pressed == button_2) and imode == false then -- go into imode
imode = true
            last_key_pressed = 999
if config == 0 then config = 1 end
display.notify_box(presets[config].name, message_time)
return false -- steal key press
elseif key == button_2 then -- first press of PLAY key in new sequence
last_key_pressed = button_2
imode = false
return false -- steal key press
else
imode = false
last_key_pressed = 999 -- reset
return true -- use all other keys in an unmodified way
end
end

event.keypress = test4reset
#215
General Help Q&A / MLV advice
January 03, 2017, 12:17:03 PM
I'm in the process of ttrying out timelapse, using FRSP on the EOSM, and want to explore the MLV approach.

I would welcome any advice as to how to process the single MLV folder into the required dng files.

I will be post processing in LRTimelapse.

Thanks in anticipation.

#216
General Help Q&A / Toggle focus box strangeness
January 02, 2017, 10:30:32 PM
All of a sudden, out of nowhere, my 5D3 (latest nightly) started acting strangely.

If I toggle left, right, up, down the focus box shoots the edge.

If I switch to ML menu, the menus keeping cycling.

I haven't changed any setting since the last time I used the camera: and it's not April 1st :)

I even removed all my Lua scripts, but still the same behavior.

Has anyone else experienced this?
#217
General Help Q&A / 5D3: 123 vs 113
December 27, 2016, 07:25:45 PM
DELETED!
#218
As many will know, although I'm not a C coder, I do like playing around with Lua scripting, and as a stills photographer I'm always looking for ways to exploit Lua. So far I've got auto bracketing working for exposure, focus, exposure & focus together, and LE simulation.

I'm pleased to say I think I've found another use for ML-Lua, ie auto bracketing for super resolution photography.

Rather that drone on here please read my latest post: http://photography.grayheron.net/2016/12/a-new-technique-for-super-resolution.html

Simply put, I'm exploiting a 'weakness' in all non-cine lenses, ie focus breathing or focal length shortening, to allow me to simulate sensor shifting (used in multi-image super resolution photography).

Once I have automatically collected the SR bracket set, I simply post process in Photoshop (warning: takes a long time).

As usual, I welcome any feedback from the ML community.
#219
Scripting Q&A / Lua strangeness
December 18, 2016, 09:21:04 AM
@A1ex

I thought your half shutter trick was working, but after testing I'm getting strange behaviours in my script.

I put the half shutter 'tweak' here:

function my_shoot() -- to grab an image
camera.shoot(false)
key.press(KEY.HALFSHUTTER)
    msleep(100)
key.press(KEY.UNPRESS_HALFSHUTTER)
end


If I don't have the tweak in my script AND I have Canon review off, all seems to be OK.

If I add the above half shutter trick, as above, the image flashes on and off and, more importantly seems to terminate the script prematurely, but with no error messages.

For now, I will therefore use the script with the Canon review off and not use the trick :-)
#220
Scripting Q&A / FRSP access from Lua
December 16, 2016, 06:44:25 PM
I hope some other 'scripter' has an answer for this question: how do I trigger FRSP within a Lua script?

I did succeed in doing this via the intervalometer, but bluntly it is very flaky.

'All' I wish to do is trigger a FRSP, repeatedly, from with Lua.

Cheers

Garry
#221
Help!

David, if you are watching, I'm stumped (again) on a simple syntax problem.

All I need to do is open a sub menu.

I can use this OK to open the ML Shoot menu

menu.open("Shoot")

But how do I a sub menu under Shoot, ie my script called "Auto Bracketing", that I have placed under the Shoot ML menu.

I can't work it out :-(

Cheers

Garry
#222
Scripting Corner / Auto HFD Script: UPDATED
December 05, 2016, 11:27:28 PM
The latest version of my Auto HFD lens positioning script may be found here: https://gist.github.com/pigeonhill/92df2d0ae7b69b4223cd802eedee3db1

This version is interactive and allows the user to select three aperture options: optimised for max DoF, widest the lens will go or the currently set value (which the user can change at any time). Select exit does nothing, ie doesn't move the lens.

Feedback, whilst in interactive mode, is provided in the upper right of the ML menu bar.

In interactive mode all keys, other than the two controlling the script are inoperable.

For those that don't wish to look further, here is the script:

--[[
Script moves lens to HFD giving user various aperture options
Version 0.8 (should work on all ML enabled cameras with the Lua module)
Allows user to select aperture options to auto position the lens to the HFD
Garry George Dec 2016
http://photography.grayheron.net/
For the HFD functionality must be in AF mode and lens must report distance
LV needs to be on
Also make sure ML DoF set up as you require it, eg diffraction on
As script may change aperture, you still need to finalise shutter for exposure
To use, simply go into LV and press the mod_button_1 followed by the mod_button_2 buttons...
then keep pressing the mod_button_2 button until the required aperture option is reached...
then press mod_button_1 to either exit script or move the lens with the selected aperture option
Pressing mod_button_1 twice simply functions the mod_button_1 in normal mode
Script has 'only' been tested on a 5D3
This version of the script does some (sic) error checking ;-)
--]]

-- Declare some globals
mod_button_1 = KEY.MENU -- key to modify
mod_button_2 = KEY.INFO -- interactive key
last_key_pressed = 999 -- used to reset mod_button pairing
hfd_move_requested = false
imode = false
imode_condition = 0
options = {"Exit"," Set"," Opt","Wide"} -- for aperture

-- Choose buttons of your choice for mod_button_1 or _2, eg KEY.RATE, KEY.UP, KEY.INFO or KEY.PLAY.
-- See http://davidmilligan.github.io/ml-lua/modules/constants.html for key constants

function check_lens_ready() -- just in case
if hfd_move_menu.submenu["Turn On/Off"].value == "On" then-- check lens is ready to be moved
if lens.focus_distance ~= 0 and lens.af then -- lens is OK
repeat
msleep(100)
until lens.focus(0,1,false)
end
end
end

function optimise() -- change aperture if needed
if imode_condition == 3 then
local current_aperture = camera.aperture.min.apex
local current_dof_near = lens.dof_near
local delta_aperatue = 0.5 -- change aperture in half stops
repeat
current_dof_near = lens.dof_near -- current dof_near
current_aperture = camera.aperture.apex -- store current aperture
camera.aperture.apex = camera.aperture.apex + delta_aperatue -- close down the aperture by a 1/2 stop
msleep(100) -- give the system a chance to do some stuff, just in case
until lens.dof_near >= current_dof_near -- that is until diffraction starts getting the better of you
camera.aperture.apex = current_aperture -- set aperture to DoF optimised value
elseif imode_condition == 2 then
-- use current set value
elseif imode_condition == 4 then
camera.aperture.apex = camera.aperture.min.apex -- set aperture to widest
end
end

function move()
if lens.focus_distance ~= 0 and lens.af then -- lens is OK
if lens.dof_far ~= lens.dof_near then -- ok to move
if lens.focus_distance < lens.hyperfocal then
repeat
lens.focus(-1,2,false)
until lens.focus_distance >= lens.hyperfocal
repeat
lens.focus(1,1,false)
until lens.focus_distance <= lens.hyperfocal
repeat
lens.focus(-1,1,false)
until lens.focus_distance >= lens.hyperfocal
else
repeat
lens.focus(1,2,false)
until lens.focus_distance <= lens.hyperfocal
repeat
lens.focus(-1,1,false)
until lens.focus_distance >= lens.hyperfocal
end
else
beep (3, 200 , 500)  -- warning message
display.notify_box("Check aperture", 3000)
end
else
beep (3, 200 , 500)  -- warning message
display.notify_box("Check lens settings", 3000)
end
end

function test4mod(key)
--[[
Interactive mode states:
1. Exit and do nothing
2. Move to HFD with currently set aperture
3. Move to HFD and optimised aperture for max DoF
4. Move to HFD and aperture open as wide as possible
--]]
if lv.running then
if hfd_move_menu.submenu["Turn On/Off"].value == "On" and imode then -- stay in interactive mode
if key == mod_button_2 then
imode_condition = imode_condition + 1
if imode_condition > 4 then imode_condition = 1 end
return false -- steal key press
elseif key == mod_button_1 then -- flag HFD move or exit requested
hfd_move_requested = true
imode = false
last_key_pressed = 999 -- reset
return false
else
return false -- steal all other key presses
end
end
-- if not going into interactive mode then check other key sequences
if hfd_move_menu.submenu["Turn On/Off"].value == "Off" then
return true -- all keys work as normal
elseif key == mod_button_1 and last_key_pressed == mod_button_1 then -- use moded key as normal
last_key_pressed = 999 -- reset
return true
elseif key == mod_button_2 and last_key_pressed == mod_button_1 then -- go into interactive mode
imode = true -- go into interactive mode
imode_condition = 1
return false -- steal key press
elseif key == mod_button_1 then -- first press of modified key in new sequence
last_key_pressed = mod_button_1
return false -- steal key press
else
return true -- use all non-moded buttons in an unmodified way
end
else -- don't use script
return true
end
end

lv.info -- provide user feedback in interactive mode in the ML top menu bar
{
name = "HFD",
priority = 100,
value = "",
update = function(this)
this.background = COLOR.BLUE
this.foreground = COLOR.YELLOW
if hfd_move_menu.submenu["Turn On/Off"].value == "On" and imode then
this.value = options[imode_condition]
else
this.value = ""
end
end
}

function check_requests(arg)
if hfd_move_requested == true and not imode then -- move lens if requested
hfd_move_requested = false -- reset flag
if imode_condition == 1 then -- do nothing
return false
end
check_lens_ready() -- just in case it isn't
if imode_condition ~= 1 then -- check aperture and change if needed
optimise()
end
move() -- lens to maximised HFD position, but note shutter will need checking for optimised exposure
return false
end
end

event.keypress = test4mod
event.shoot_task = check_requests

hfd_move_menu = menu.new
{
parent = "Shoot",
name = "HFD",
help = "Moves lens to HFD focus distance",
depends_on = DEPENDS_ON.LIVEVIEW,
submenu =
{
{
name = "Turn On/Off",
help = "Switches the script on/off",
choices = {"On","Off"},
}
}
}


The script has been tested 'only' on my 5D3.

As usual I welcome feedback of any kind  :)
#223
Scripting Q&A / Struggling with Lua Print
December 03, 2016, 06:25:59 PM
David (anyone ;-))

I hope you can put me out of my misery.

I've spent hours trying to work out how to update/change a message using the display.print call.

For example:

display.print(previous_message, 100,100,FONT.LARGE,COLOR.TRANSPARENT, COLOR.TRANSPARENT)
display.print(current_message, 100,100,FONT.LARGE,COLOR.WHITE, COLOR.BLACK)


But I can't get it to 'erase' the old message.

The current message writes over the top of the previous one, ie the transparent erase doesn't work.

Where am I going wrong :-(

Cheers

Garry
#224
Share Your Photos / Autolandscape Bracketing Image
November 20, 2016, 07:04:18 PM
Some may be interested in the latest image I captured with my Lua Auto Landscape bracketing script:http://photography.grayheron.net/2016/11/one-of-uks-jewels.html

#225
Scripting Corner / Optomised HFD Script
November 15, 2016, 11:34:27 PM
For those that do landscape stills photography, the hyperfocal distance is always useful.

There are tables and apps, but of course ML provides HFD info: but the challenge is setting the lens to the HFD.

The following script does this automatically: https://gist.github.com/pigeonhill/92df2d0ae7b69b4223cd802eedee3db1

You don't need to be in LV, but the lens must report focus distance and be in AF mode.

This version also sets the optimized aperture for maximum HFD depth of field, irrespective of the current aperture.

The camera should be in manual and once the script has run, you will need to tweak the shutter for final exposure. I simply ETTR after the script has run or use auto (ML) bracketing.

The script runs from modified keys. The base script uses MENU and INFO. Change these keys to your liking.

Press MENU twice to use MENU as normal. Press MENU followed by INFO to set the optimised HFD.

For those that wish to scan scripts, here is the code:

--[[
Script uses modified keys
Version 0.7 (should work on all ML enabled cameras with the Lua module)
Shows the use of a modified key approach using an AF lens auto positioned to the HFD
Garry George Nov 2016
http://photography.grayheron.net/
For the HFD functionality must be in AF mode and lens must report distance
Script handles LV, ie LV doesn't need to be on
Also make sure ML DoF set up as you require it, eg diffraction on
Also for the fastest move position lens at infinity end, ie macro end moves are slower
Script optimises aperture: but you still need to finalise shutter for exposure
This version of the script does some (sic) error checking ;-)
--]]

-- Declare some globals

mod_button_1 = KEY.MENU -- key to modify
mod_button_2 = KEY.INFO -- key to indicate mod mode requested, ie move to the optimised HFD position
last_key_pressed = 999 -- used to reset mod_button pairing
hfd_move_requested = false
lv_already_on = false

-- Choose buttons of your choice, eg KEY.RATE, KEY.UP, KEY.INFO or KEY.PLAY.
-- See http://davidmilligan.github.io/ml-lua/modules/constants.html for key constants

function check_lens_ready() -- just in case
if hfd_move_menu.submenu["Turn On/Off"].value == "On" then-- check lens is ready to be moved
if lens.focus_distance ~= 0 and lens.af then -- lens is OK
repeat
msleep(100)
until lens.focus(0,1,false)
end
end
end

function optimise() -- aperture for max hyperfocal depth of field
local current_aperture = camera.aperture.apex
local current_dof_near = lens.dof_near
local delta_aperatue = 0.5
camera.aperture.apex = camera.aperture.min.apex -- set aperture to widest
repeat
current_dof_near = lens.dof_near -- current dof_near
current_aperture = camera.aperture.apex -- store current aperture
camera.aperture.apex = camera.aperture.apex + delta_aperatue -- close down the aperture by a 1/2 stop
msleep(100) -- give the system a chance to do some stuff, just in case
until lens.dof_near >= current_dof_near -- that is until diffraction starts getting the better of you
camera.aperture.apex = current_aperture
end

function move()
if lens.focus_distance ~= 0 and lens.af then -- lens is OK
if lens.dof_far ~= lens.dof_near then -- ok to move
if lens.focus_distance < lens.hyperfocal then
repeat
lens.focus(-1,2,false)
until lens.focus_distance >= lens.hyperfocal
repeat
lens.focus(1,1,false)
until lens.focus_distance <= lens.hyperfocal
repeat
lens.focus(-1,1,false)
until lens.focus_distance >= lens.hyperfocal
else
repeat
lens.focus(1,2,false)
until lens.focus_distance <= lens.hyperfocal
repeat
lens.focus(-1,1,false)
until lens.focus_distance >= lens.hyperfocal
end
else
beep (3, 200 , 500)  -- warning message
display.notify_box("Check aperture", 3000)
end
else
beep (3, 200 , 500)  -- warning message
display.notify_box("Check lens settings", 3000)
end
end

function test4mod(key)
if hfd_move_menu.submenu["Turn On/Off"].value == "Off" then
return true -- all keys work as normal
elseif key == mod_button_1 and last_key_pressed == mod_button_1 then -- use moded key as normal
last_key_pressed = 999 -- reset
return true
    elseif key == mod_button_2 and last_key_pressed == mod_button_1 then -- use moded key in modified way
-- ****************** Place modified flag requests here ************
last_key_pressed = 999 -- reset
hfd_move_requested = true -- flag HFD move requested
if lv.enabled then lv_already_on = true else lv_already_on = false end
-- ****************** Place modified flag requests here ************
return false -- steal key press
elseif key == mod_button_1 then -- first press of modified key in new sequence
last_key_pressed = mod_button_1
return false -- steal key press
else
return true -- use all non-moded buttons in an unmodified way
end
end

function check_requests(arg)
if hfd_move_requested == true then -- handle lv and lens move
hfd_move_requested = false -- reset flag
if not lv_already_on then lv.start() end
check_lens_ready() -- just in case it isn't
optimise() -- aperture
move() -- lens to maximised HFD position, but note shutter will need checking for optimised exposure
if not lv_already_on then lv.stop() end
return false
end
end

event.keypress = test4mod
event.shoot_task = check_requests

hfd_move_menu = menu.new
{
parent = "Shoot",
name = "HFD",
help = "Moves lens to HFD focus distance",
submenu =
{
{
name = "Turn On/Off",
help = "Switches the script on/off",
choices = {"On","Off"},
}
}
}


As usual, I welcome feedback  ;)
#226
David

If you are able to give me a pointer regarding this question that would be great.

Say I have two scripts, A and B.

Can I call a function in A from within B?

If so, how  ;)

Cheers

Garry
#227
Scripting Corner / Modifying Keys/Buttons
November 01, 2016, 11:39:19 PM
For some time I have been trying to extend the functionality of the Canon keys in Lua scripting. In other words trying to get more out of a key, which could be useful to those with cameras with limited key access.

The idea I am sharing is as follows:
- Select a key to have a modified role, ie KEY.RATE in the demo script below
- Choose a second key to act as a modifier, ie KEY.PLAY in the demo below
- Insert the Lua modified code, ie move the lens to the HFD point in the demo below
- To use simply press any key as normal
- Press KEY.RATE twice to use KEY.RATE in normal mode
- Press KEY.RATE followed by KEY.PLAY to use the KEY.RATE button in modified mode

The script could be refined further, and I may well do that ;-)

Also the script is easy to extend, eg add other modified buttons.

As usual I welcome feedback of any kind.

--[[
Script to illustrate the use of key modification
Version 0.3 (should work on all ML enabled cameras with the Lua module)
Shows the use of a modified key approach using an AF lens auto positioned to the HFD
Garry George Oct 2016
http://photography.grayheron.net/
For rhe HFD functionality must be in LV and in AF mode, and lens must report distance
Also make sure ML DoF set up as you require it, eg diffraction on
Also for the fastest move position lens at infinity end, ie macro end moves are slower
This version of the script does no error checking ;-)
--]]

-- Declare globals

mod_button_1 = KEY.RATE -- key to modify
mod_button_2 = KEY.PLAY -- key to indicate mod mode requested
last_key_pressed = 999 -- used to reset mod_button pairing

-- Choose buttons of your choice, eg KEY.RATE, KEY.UP, KEY.INFO or KEY.PLAY.
-- See http://davidmilligan.github.io/ml-lua/modules/constants.html for key constants

function move()
if lens.focus_distance < lens.hyperfocal then
repeat
lens.focus(-1,1,false)
until lens.focus_distance >= lens.hyperfocal
else
repeat
lens.focus(1,1,false)
until lens.focus_distance <= lens.hyperfocal
repeat -- ensures lens is positioned with a bias towards INF
lens.focus(-1,1,false)
until lens.focus_distance >= lens.hyperfocal
end
end

function test4mod(key)
if keymenu.submenu["Turn On/Off"].value == "Off" then
return true -- all keys work as normal
elseif key == mod_button_1 and last_key_pressed == mod_button_1 then -- use moded key as normal
last_key_pressed = 999 -- reset
return true
    elseif key == mod_button_2 and last_key_pressed == mod_button_1 then -- use moded key in modified way
-- ****************** Place modified code here ************
last_key_pressed = 999 -- reset
move() -- to HFD position
-- ****************** Place modified code here ************
return false -- steal key press
elseif key == mod_button_1 then -- first press of modified key in new sequence
last_key_pressed = mod_button_1
return false -- steal key press
else
return true -- use all non-moded buttons in an unmodified way
end
end

event.keypress = test4mod

keymenu = menu.new
{
parent = "Shoot",
name = "HFD",
help = "Moves lens to HFD focus distance",
depends_on = DEPENDS_ON.LIVEVIEW,
submenu =
{
{
name = "Turn On/Off",
help = "Switches the script on/off",
choices = {"On","Off"},
}
}
}
#228
Scripting Q&A / Long key press emulation problems
October 31, 2016, 12:19:45 PM
I hope one of the Lua experts can help me out as I struggle to get a long key press working with the SET button.

Here is the test code:

function hfd_test(key)
if keymenu.submenu["Turn On/Off"].value == "Off" then
return true -- key works as normal
elseif key == KEY.SET and lv.enabled then -- user may be asking for an HFD move, so register dryos time
timer = dryos.ms_clock
return true
    elseif key == KEY.UNPRESS_SET and lv.enabled then -- test is HFD move requested
if dryos.ms_clock - timer > 3000 then
move()
return true
else
return true
end
end
end

event.keypress = hfd_test


If I'm in the ML menu and press SET, then SET seems to work as expected, ie if I hold SET for longer than 3000 ms, them my move function works, ie moving the lens. Also less than 3000ms SET works as normal, ie changing ML menu items.

If I leave the ML menu and go to LV, I seem to lose the 3000ms functionality, ie the long key press emulation.

Can some kind soul point out what I'm doing wrong?

Cheers

Garry
#229
General Help Q&A / ND Module: Help
October 01, 2016, 08:43:42 AM
First, I apprentice this is a dup question: but I need help for a shoot this weekend.

I'm using David M's Bulb ND Filter Module, but I can't work out the action/workflow to get the module to estimate the filter value.

I'm in LV, have entered a guess Ev, eg 3Ev for an ND8, moved the module menu to measure and tried following instructions, ie take a (correctly exposed) picture first without the filter. Then put the filter on and (I assume) take another, but I get no measurement change, ie I tried different guess values and they don't change.

Can some kind person give me a hint ;-)

Cheers

Garry
#230
Feature Requests / Full LCD mirror transformation
August 10, 2016, 12:57:16 AM
At the risk of upsetting the moderators, I'm requesting this feature here, as I realize I posted the other day on an old post.

The use case is is when you are using a fipbac mirror on a fixed LCD.

In this situation, the flipbac allows you to see the LCD screen, eg from above the camera, but, of course the mirror image is just that, mirrored.

The request is to extend the existing ML feature, that flips the ML menu bars, so that the ML menu bars and the LCD image are fully mirrored, so that the reflected flipbac image looks normal.
#231
General Help Q&A / EOSM ML Spotmeter
August 07, 2016, 09:26:54 PM
Could someone help me as I can't work out how to move the ML spotmeter, when using a manual lens. Or can't I?
#232
Scripting Corner / EOSM Helper Script
July 28, 2016, 07:47:20 AM
Because the EOSM has limited buttons, I decided to create a version of my Toggler script specifically for the EOSM. But the script will run on other Lua enabled cameras.

Like the full Toggler, this version simply allows you to toggle through your favorite (preset) ML states. In my script (you can change this to your needs) the states are: ETTR, Dual-ISO, ETTR+Dual-ISO, Auto Bracketing, FRSP.

By default the Toggler is in the disabled (Off) condition at camera start up. Go to the ML Shoot menu to switch the Toggler on.

When toggling, Off simply means all ML toggle states are Off. But Toggler is still active.

Make sure each toggled state's ML menu is set to your configuration, ie Toggler 'only' switches the ML state on or off.

As usual I welcome any feedback on the script.

Cheers

Garry

https://gist.github.com/pigeonhill/156ea0e55cd0a029bc447f8bf5593224
#233
Scripting Q&A / KEY.PRESS & EOSM
July 27, 2016, 07:45:28 AM
@David (if you are watching)

Forgive me if you answered this before, however, it appears that the KEY.RIGHT etc doesn't get picked up by the EOSM Lua.

I used this simple script to confirm the codes:

event.keypress = function(key)

--   print("You pressed a key: "..key)
if key ~= 0 then display.notify_box (key,3000) end
    return true
end


Keys such as PLAY and INFO return the key press constants as expected.

KEY.LEFT returns 1 and 2 when pressed on and off.

The other KEY directions, eg KEY.RIGHT etc, return nothing.

Is it that the direction KEYS simply don't work on the EOSM?

Cheers

Garry
#234
Scripting Q&A / EOSM Touch Events
July 25, 2016, 02:19:45 PM
Has anyone played around with Lua on an EOSM?

Specifically detecting touch events, ie in different areas of the screen and double tap etc, and if they have, could they share their scripting with me, ie to help me kick-start my EOSM touch scripting  ;)

Cheers

Garry
#235
General Help Q&A / EOSM: is there hope?
July 17, 2016, 07:21:16 PM
I have a 5D3, an IR-converted 50D and an EOSM  :)

The one thing that I'm lacking is focus/lens control via Lua on the EOSM.

I'm asking this question out of pure ignorance and a desire to better understand the inner workings of the ML-enabled cameras.

The question: is there any hope that the EOSM Lua will be able to drive a lens? For example, the native lenses and EOS lenses via an adapter?

As I say, I ask in ignorance.
#236
@David (if you pick this up)

I'm trying to manage semaphore 'errors' and wonder if it's possible to 'switch off' the event.keypress completely within a script, at specific times.

In other words, if block A of my script is running then event.keypress is working, but for block B of my script it is not, ie it is as if it wasn't there.

And, in the script, switch event.keypress back on as well  ;)

UPDATE

Ok I can switch it off with

event.keypress = nil

But how do I switch it back on again?

UPDATE

OK I worked it out. As above to switch it off, simple redefine it to switch it back on. At the moment I redefine it by restating the entire function. Is there a way to get event.keypress to call one of my functions?

UPDATE:2

OK, I know I'm dumb  >:(

It's as simple as this:

event.keypress = function(key)
return mykey_test(key)
end


BTW

If others are interested in why I was pursuing this line, around event.keypress, it was because I wanted to change the functionality of buttons according to the state of the script.

Using the above approach, it looks very simple (and safe?) to switch the event.keypress on and off, and change what it does according to where one is in a script.

Unless I've got it wrong that is  ;D

Cheers

Garry
#237
Scripting Corner / Point to Point focus stacking
July 15, 2016, 07:29:17 PM
If anyone is interested here is an experimental add on to my auto focus and exposure script.

This version (V4) adds in a FP to FP focus bracketing.

All you need to do is select FP2FP in the script's menu, then go to LV (without running the script), focus on the nearest or furthest point and (on a 5D3) press RATE (change this in the code for any key you wish), then go to the other focus extreme and press RATE again. Return to the script and run it.

The script handles all the focus logic, ie if one image is enough, the FP will be positioned accordingly, so the near and far DoFs are 'symmetric' either side of the FPs you selected. If more than one focus bracket is required the script will take these.

Try playing around with the ML CoC values, ie the defaults are the bare minimum, eg 29 micron on a FF. For more exacting standards try, say, 18. Also play around with the aperture. As the script allows you to ensure your subject is tack sharp and your backgrounds 'blurred', no matter what the subject size is: as you are focus stacking.

As I say, it's experimental but I would value feedback in helping me develop it further.

Cheers

Garry

Script is here https://gist.github.com/pigeonhill/e008f051681885bc6ff84de637cb1d8e
#238
Scripting Q&A / Lua Menu Question
July 11, 2016, 06:43:23 PM
@David

I've convinced myself that the Lua set.menu only works with numbers. Thus this is OK:

menu.set("Auto Bracketing","Focus bracketing?",0)

But this is not:

menu.set("Auto Bracketing","Focus bracketing?","No")

Because when I use the second format, the script freezes.

Am I correct?

BTW that menu is set up with a choices call and if I use 0 or, say, 2, it works but always goes to the first entry in choices.

Cheers

Garry
#239
I hope my latest post http://photography.grayheron.net/2016/07/bringing-it-all-together.html helps those that are experimenting with focus and exposure bracketing using Magic Lantern.

As usual I welcome any feedback or questions on my approach, which is targeted at the landscape photography use case.

Cheers

Garry
#240
Scripting Q&A / Lua Menu Problem
July 09, 2016, 09:03:02 AM
I hope someone can help with this Lua menu problem I'm having.

Until now I have only used the select with numbers. I'm now trying it with choices.

What I get with the attached code is the choices toggles between Off and 1Ev, ie it does not move through the choices.

Does anyone see what stupid thing I'm doing?  ;)

name = "Ev bracket delta per image",
help = "Auto exposure bracketing",
choices = {"Off","1Ev","2EV","Auto 1Ev","Auto 2Ev"},
icon_type = ICON_TYPE.BOOL,
select = function(this,delta)
if this.value == "Off" then
factor = 1
this.value = "1Ev"
elseif this.value == "1Ev" then
factor = 2
this.value = "2Ev"
elseif this.value == "2Ev" then
factor = 3
this.value = "Auto 1Ev"
elseif this.value == "1Ev" then
factor = 4
this.value = "Auto 2Ev"
elseif this.value == "2Ev" then
factor = 0
this.value = "Off"
end
end,
#241
General Help Q&A / Auto bracketing question
July 08, 2016, 07:38:14 PM
@A1ex

I'm playing around with a few ideas and trying to understanding the 'limits' of the ML auto bracketing.

From my experiments it seems that the shadow end gets evaluated at an equivalent of setting the ETTR shadow SNR to 4Ev.

Is this a reasonable assumption?

In other words, using ETTR to do my bracketing in a script I could get an extra 2Ev movement, i.e. By using 6Ev in the shadow SNR.

Cheers

Garry
#242
For ML colleagues who wish to explore landscape focus bracketing here is my latest Lua script: https://gist.github.com/pigeonhill/6620121ebe1548eb1bdaa6bea8598fac

This script is now pretty robust (I think  ;)) but has only been tried out on my 5D3.

This version allows you to auto bracket in the following ways:
1. Focus bracket from FP to Inf stop
2. Focus bracket from FP to macro stop
3. Focus bracket from FP to HFD
4. Exposure bracket - you set the shadow exposure, the script sets the ETTR value from which the number of brackets is calculated
5. 4 above with 1, 2 or 3
6. LE simulation
7. Number of frames

In addition I have added in some feedback to help you get the optimum focus bracket set. If you are in FP2HFD mode you will get feedback in the menu as to the estimated number of brackets the script will take - add 1 extra bracket for the other modes. This is a good sanity check to do if you are NOT using a WA lens, as 'long' lenses (24mm and up) can generate lots of focus brackets. I stay below 10 brackets for sensible post processing, especially if I convolve focus bracketing with exposure bracketing!

You can see the impact on changing aperture by selecting that feature in the script's menu (with FP2HFD selected) and in real time see the number of brackets you will create. At the moment this moves the aperture in 1/3 stop increments (you can change to other increments by changing the value in the script, eg 1/2 stops). For optimum script performance, ensure diffraction aware is on in the ML menu.

In addition, the number of brackets will change dramatically by moving the starting FP away from the macro end.

As I say, with the script's menu on FP2HFD,  play around with the FL, FP and aperture to see the impact these have on the number of focus brackets that will be taken.

As usual, I welcome feedback of any kind, and, as I always say: I wrote the script for my 5D3 and my work flow  :)

Cheers

Garry
#243
Scripting Q&A / Lua and the use of xpcall
June 26, 2016, 12:44:07 PM
I hope some kind expert will be able to point me in the right direction.

I'm still trying to detect the 'soft limit reached' in a Lua script and thought I would try pcall and xpcall.

I'm using this test script:

err_state = true

function move()
lens.focus(1,1,true)
end

function erf()
err_state = false
end

function focus()
err_state = true
repeat
xpcall(move,erf)
until err_state == false
-- now move the other way having detected an error
lens.focus(-10,1,true)
end

scrnshot_menu = menu.new
{
    name = "Test",
select = function(this)
task.create(focus)
end
}


The lens moves as instructed and a 0 gets displayed but the (soft limit) error doesn't get intercepted and I get the ML error message and the script stops.

Anyone got any ideas?
#244
David/Alex

As you prepare for the next Lua uplift in the nightlies, I was wondering if you could consider adding in an error check in lens.focus.

The error check would look for soft limit reached (macro or inf end), such that the user can take script action.

At the moment if that error is generated, the script stops as there is no way in Lua (as far as I know) to detect that error and act on it.

Cheers

Garry
#245
Scripting Corner / Long Exposure Simulation Script
June 18, 2016, 08:53:53 AM
This thread is superseded by https://www.magiclantern.fm/forum/index.php?topic=25731.0

In the spirit of learning & sharing, I offer the latest version of my LE Script: https://gist.github.com/pigeonhill/c16b49d1f5da899b1d03a98c737e371f

All this script does is exploit ML FRSP and Timelapse to allow the user to simulate a longer exposure than is possible in a single image capture.

To create the LE effect all one needs to do is post process the captured 'bracket' set. I personally do this in LR using LR/Enfuse - adjust the Enfuse sliders to your taste. I also sometimes use Photoshop.

The script provides feedback on the number of images that will be taken, so you can use this feedback to set the script to a specific number of captures, eg using FRSP in super resolution capture, or to eliminate people from a scene.

As to why the script was written this way, ie using timelapse and triggering FRSP this way: it was the only way I could use FRSP in Lua.

As usual I welcome feedback on the script: especially any tips to improve my scripting  ;)

Finally the usual caveat: I wrote the script for my workflow and for my 5D3.

Cheers

Garry
#246
Scripting Q&A / Running Multiple Lua Scripts
June 13, 2016, 01:09:55 PM
David (assuming you have the time)

Hopefully you can clarify a few questions in my mind.

If you have more than one script that is loaded at start up, how do they interact with each other?

Specifically, if both are, say, making use of, say, a keypress event handler, how do they decide who wins the event handling fight?

Also, if one script declares a global (sic) variable, is it global across all scripts or 'just' within the script that declares it.

Cheers

Garry
#247
Scripting Corner / Toggler Version 2
June 12, 2016, 09:29:19 AM
First of all an apology for posting another Lua script, however, I do this so that others may benefit from my humble efforts. Either making use of my scripts or using my scripts to help them develop their own scripts.

This particular script is Version 2 of my Toggler script and you can find it here: https://gist.github.com/pigeonhill/6fd92bf47f18c77d4892db74c745a477

'All' the Toggler does is allow you to quickly switch between different ML menu states. In this version I simply switch between the following:

  • Off = The Toggler is active but all the Menu state are set off
  • ETTR
  • Dual-ISO
  • Auto Bracketing
  • FRSP
  • ISO

In this version I decided to increase the toggling functionality; thus this version of the Toggler works in the following way:

You can switch the Toggler totally off in the ML Menu (by default Toggler will be on, but you can change that behavior in the script, ie to always be off).

You can switch the Toggler's state, enabled or not, by using any button of your choice, eg RATE or PLAY. Note, once you decide on that button choice, then that button ceases to be accessible in its normal Canon mode. Thus I chose RATE on my 5D3 and PLAY on my 50D, as I don't use these buttons when taking images. Pushing this button will flip-flop the enabled state of Toggler, which allows you to use the multi function switch normally.

If you have enabled Toggler the multi function switch can now be controlled by the Toggler. Toggle left of right to move to the Menu state you wish and in some menu states, eg ISO, you can toggle up and down to increase or decrease ISO.

One thing to note is that there appears to be a ML backend 'thing going on', that I can't work out, but have reported. That is my 5D3 returns a different key press code to my 50D. I have accounted for that in the code.

As for workflow, that is up to you. I personally ETTR most of the time and adjust exposure from there.

If I'm bracketing I will meter for the shadows (using the ML Raw Ev meter) and then toggle to the Bracketing state, letting ML handle the highlight bracketing needs. Note that this is where you can use the enable button (RATE or PLAY for me). Thus I would toggle to auto bracketing, press the RATE button to disable Toggler so I can use the multi function controller to move the the metering position I wish to check.

If I want to capture a FRSP, I go to that menu state and the Toggler will tell me if I'm 'compliant' regarding shutter speed, ie Toggler will not let me take a FRSP outside the recognized range.

As for ISO, I simply toggle to that state and change the ISO with the multi functional controller (noting I can return to the Canon multi functional controller state by pressing RATE, say).

Bottom line: as usual I offer this post to help others as they learn about the power of ML Lua scripting; and, of course, I welcome feedback of any kind  :)

Final caveat: I am not a Lua power user, I'm still learning to program in Lua. Thus you use my scripts at your own risk and I've only been able to test the script on a 5D3 and 50D.

#248
Scripting Q&A / More Lua 'strangeness'
June 07, 2016, 10:40:08 PM
David (assuming you pick up on this)\

I trying to intercept the wheel (that changes the aperture on my 5D3), but can't seem to get it going.

I've been using this test script to explore the problem:

test_menu = menu.new
{
    name = "Test",
    choices = { "Off", "On" },
    value = "On",
}

function event.keypress(key)
    if key == KEY.WHEEL_RIGHT and test_menu.value == "On" then
menu.set("Expo","ISO",400)
return false
elseif key == KEY.WHEEL_LEFT and test_menu.value == "On" then
menu.set("Expo","ISO",100)
return false
else
return true
end
end


If I replace the two WHEEL constants with, say, INFO and RATE, then the ISO changes OK as expected.

If I use the above code, then all I get is the aperture changes, ie keypress is ignoring the wheel key returns.

Any ideas as to what is happening?

Cheers

Garry
#249
Scripting Q&A / Auto Bracketing within Lua
June 05, 2016, 05:07:03 PM
David (if you looking)

Is there a way to 'pause' a script to wait for a Lua triggered Auto Bracketing to complete.

That is I call this

menu.set("Shoot","Advanced Bracket",1)

But my script doesn't wait for the Advanced Bracket to complete.

Any thoughts welcome, as usual :-)

Cheers

Garry
#250
Scripting Q&A / Lua: Select vs Update
June 02, 2016, 08:49:56 AM
David

You said something yesterday that I understood, but I can't work out. That is the use of the update triggered function call in a menu vs select triggered.

Here is the menu that's confusing me:

{
name = "Enabled?",
help = "Switches the script on/off",
choices = {"Yes","No"},
select = function(this) -- set all Toggler menus to their off state
if this.value == "Yes" then
menu.set("Shoot","Silent Picture",0)
menu.set("Shoot","Advanced Bracket",0)
menu.set("Expo","Auto ETTR",0)
menu.set("Expo","Dual ISO",0)
toggler_play = 1
frsp = false
end
end
}


In the above I used select, and I can not cycle through choices and the menu doesn't change.

If I replace select with update, choices toggles and all looks good.

Can you throw some light on the above?

Cheers

Garry