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

Messages - garry23

#1351
Scripting Q&A / Re: FRSP access from Lua
December 16, 2016, 08:31:55 PM
@a1ex

Thanks for the tip off :-)

I'm using this https://bitbucket.org/daniel_fort/magic-lantern/downloads/magiclantern-manual_lens_info.2016Dec05.5D3113.zip which I think includes the Lua fix.

Here is my test code, the relevant function is go, however things don't seem to be working as expected:

--[[
LE simulation via Bracketing, using shutterless, Full Res Silent Picture
Creates brackets for post processing a simulated LE exposure
User must set FRSP mode, ie DNG or MLV and also wheather to use Dual-ISO
Base exposure must be between 0.25-14 secs
Version 0.8
*******************************************************************************************************
*   *
* If you reference this script, please consider acknowledging me: http://photography.grayheron.net/   *
*   *
*******************************************************************************************************
--]]

LE_brackets = 0

function my_shoot()
-- Grab an image
camera.shoot(false)
end


function go() -- and run the script
    local LE_count = 0
if camera.shutter.value < 0.25 or camera.shutter.value > 14 then -- not fit for FRSP use
menu.set("Shoot","Silent Picture",0)
beep (3, 200 , 500)  -- display warning message
display.notify_box("Adjust your shutter time: 0.25-14 secs", 5000)
else -- alright to use FRSP
menu.set("Shoot","Silent Picture",1)
        msleep(tonumber(LEmenu.submenu["Delay"].value) * 1000)
    repeat
        LE_count = LE_count + 1
    my_shoot()
        until LE_count == LE_brackets
menu.set("Shoot","Silent Picture",0)
LV.resume()
end
end

LEmenu = menu.new
{
    parent = "Shoot",
    name = "LE Simulator",
    help = "Only uses FRSP",
depends_on = DEPENDS_ON.LIVEVIEW,
    submenu =
{
{
name = "Run Script",
help = "Does what it says after pressing SET",
depends_on = DEPENDS_ON.LIVEVIEW,
select = function(this) task.create(go) end,
},
{
name = "LE Time?",
help = "Simulated LE time in seconds",
min = 0,
max = 600,
icon_type = ICON_TYPE.BOOL,
select = function(this,delta)
this.value = this.value + delta
if this.value > this.max then
this.value = this.min
elseif this.value < this.min then
this.value = this.max
end
end,
warning = function(this)
if LEmenu.submenu["LE Time?"].value ~= 0 then
LE_brackets = math.ceil(LEmenu.submenu["LE Time?"].value/camera.shutter.value)
if LE_brackets == 0 then
return "LE bracket taking switched off"
else
return "Note: "..tostring(LE_brackets).." brackets will be taken"
end
end
end
               },
{
name = "Delay",
help = "Delays script start by stated number of secs",
choices = {"2","5","0"},
},{
name = "Bookends?",
help = "Places a dark frame at start and end of focus bracket set",
choices = {"no","yes"},
}
}
}


The script doesn't always run, I sometimes see strange characters in my menu and, more importantly, LV doesn't resume.

Of course it could all be down to me scripting...then again it be be a bug in the branch.

Not sure if you or David can spot anything?

Cheers

Garry
#1352
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
#1353
Scripting Q&A / Re: Struggling with Lua Print: SOLVED
December 16, 2016, 09:18:43 AM
UPDATE

OK worked it out by looking at the code, ie the delay has been removed, ie all you need now is:

camera.shoot(false)

:)


Daniel or David

In this version https://bitbucket.org/daniel_fort/magic-lantern/downloads/magiclantern-manual_lens_info.2016Dec05.5D3113.zip has the camera.shoot changed, as I've noticed strange behaviors with my scripts using:

        camera.shoot(64, false)

The lens moves!!!

Cheers

Garry
#1354
Scripting Corner / Re: Long Exposure Simulation Script
December 14, 2016, 07:09:18 AM
@bakersdozen

No, should work ok.

Let me know how it goes ;-)

BTW I was conservative with the FRSP limits and haven't revisited these to see if I can widen them. A 'job' for the Christmas break.

Cheers

Garry

Ps there is also a LE simulator in the Auto Landscape Bracketing Script, that 'just' uses the normal mechanical shutter, i.e. works with any base shutter. This script is here: https://gist.github.com/pigeonhill/e008f051681885bc6ff84de637cb1d8e
#1355
@grodriguez

I may have misinterpreted your point, but one way to get the best of both worlds is to focus and exposure stack at the same time or focus stack in dual-ISO mode.

This is why I wrote my Auto Landscape Bravketing script; http://photography.grayheron.net

Cheers

Garry

Ps of course the above is only good for your still photography, not video ;-)
#1356
Scripting Q&A / Re: Struggling with Lua Print
December 09, 2016, 08:04:19 AM
Daniel

Confirmed Dual loaded ok with that build.

As you imply, no Bulb-ND.

I hope your build, plus Bulb-ND and Lua fixes etc, turns up in the Nightlies soon  ;)

Thanks for sharing your build. My two 'go-to' scripts, Auto Landscape Bracketing and the Auto HFD, are my constant companions :-)

Cheers

Garry
#1357
Scripting Q&A / Re: Struggling with Lua Print
December 09, 2016, 12:31:54 AM
I'm getting too old  :)

I simply can't keep up with all the good stuff  ;)

Cheers

Garry
#1358
Scripting Q&A / Re: Struggling with Lua Print
December 08, 2016, 11:37:27 PM
Daniel

Just noticed your complied version here: https://bitbucket.org/daniel_fort/magic-lantern/downloads/magiclantern-lua_fix.2016Dec04.zip don't work with Dual-ISO and Bulb-ND.

:-(
#1359
Scripting API suggestions / Re: ML access via Lua
December 08, 2016, 10:33:06 PM
OK, I think I've convinced myself we can't yet open a specific ML menu, as the following doesn't open the Shoot menu:

menu.open("Shoot")

...unless someone corrects me ;-)
#1360
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
#1361
Scripting Corner / Re: Auto HFD Script: UPDATED
December 06, 2016, 07:45:30 AM
@A1ex/@David

I just noticed a strangeness with my Auto HFD script. When in the interactive mode, only two keys are allowed to work. What I have noticed on my 5D3 is that this is true, apart the Picture Style button/key, which seems to work as normal, ie not blocked in this code snippet below:

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


As I say, strange. It looks like the Picture Style button, which also on the 5D3 is a print button (I think), circumvents the ML key press handling.
#1362
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  :)
#1363
Scripting Q&A / Re: Struggling with Lua Print
December 05, 2016, 08:53:57 AM
Daniel

Just realized, that the drawing 'conflict' is with the Canon grid.

I guess there is not much we can do there, eg refresh the Canon grid, after a Lua draw update.

Cheers

Garry
#1364
Scripting Q&A / Re: Struggling with Lua Print
December 05, 2016, 07:16:53 AM
Daniel

As far as I'm concerned it's not worth it, i.e I'll live with a 'hole' in the grid.

But it is maybe something the developers wish to think about, i.e how to handle the interaction of Lua display 'layer' with other ML drawn objects that should persist after the Lua drawing is done.

Cheers

Garry
#1365
Scripting Q&A / Re: Struggling with Lua Print
December 04, 2016, 08:36:28 PM
A1ex/Daniel

One strangeness is that the display.print erases the ML background grid.

Is there a way to force ML to redraw its 'background'?

Cheers

Garry
#1366
Scripting Q&A / Re: Struggling with Lua Print
December 04, 2016, 08:31:59 PM
Daniel/A1ex

Looks good  :)

I'll continue experimenting and feedback any 'strangeness'.

Once again, thanks to both of you for providing such a quick turn around.

As usual, I'll publish my script on the ML Lua page.

Cheers

Garry
#1367
Scripting Q&A / Re: Struggling with Lua Print
December 04, 2016, 08:07:06 PM
Daniel

Thanks, I'll take look and experiment. BTW I have a 5D3  :)

Cheers

Garry
#1368
Scripting Q&A / Re: Struggling with Lua Print
December 04, 2016, 01:01:07 PM
@A1ex

Thanks. As soon as it gets accessible to me, I'll provide feedback.

Once again: thanks for the quick fix - fingers crossed  ;)

Cheers

Garry
#1369
Scripting Q&A / Re: Struggling with Lua Print
December 04, 2016, 11:37:14 AM
@A1ex

Thanks for confirming it was not my stupidity  ;)

I would be really grateful if this could be 'fixed' in the next available uplift, ie COLOR.TRANSPARENT does just that, ie make the print or drawing pixels transparent.

Cheers

Garry
#1370
Scripting Q&A / Re: Struggling with Lua Print
December 04, 2016, 10:48:14 AM
OK, I'm convinced there is something going wrong in the Lua module.

Here is my test code:

display.print("Test Text 1", 100,100,FONT.LARGE,COLOR.RED,COLOR.WHITE)
display.print("Test Text 2", 100,200,FONT.LARGE,COLOR.TRANSPERANT, COLOR.TRANSPERANT)


The first line prints as expected, ie red text on a white background.

The second test text prints white text on a black background.

I even tried this:


display.print("Test Text 2", 100,200,FONT.LARGE,0,0)


But I still get white text on a black background.

Hope one of the developers can throw some light on this, ie COLOR.TRANSPARENT not appearing to work with the display.print.

Cheers

Garry
#1371
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
#1372
Scripting Corner / Re: Lua Scripting (lua.mo)
December 03, 2016, 10:16:41 AM
@eraizgn

The ML Lua module is 'simply' a Lua interpreter that the ML environment provides. With Lua you can code Lua scripts  ;)
#1373
Scripting Corner / Re: Lua Scripting (lua.mo)
December 02, 2016, 04:29:58 PM
...and of course you need ML loaded  ;)
#1374
Scripting Corner / Re: Lua Scripting (lua.mo)
December 02, 2016, 04:01:26 PM
@warrnotte

Yes. Just code lua in a text file and ensure file extension is .lua  :)

Cheers

Garry
#1375
Camera-specific Development / Re: Canon 5D Mark IV
December 01, 2016, 07:29:46 AM
@tron

If you haven't read this, I thought you might find it of value : http://www.clarkvision.com/articles/iso/

Cheers

Garry