FRSP access from Lua

Started by garry23, December 16, 2016, 06:44:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

garry23

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

a1ex

On the lua_fix branch, enabling silent picture from menu (any kind, not just full-res) and calling camera.shoot() as usual should do the trick.

Not tested though.

garry23

@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

garry23

I'm an IDIOT!!!!!!!!!!!

lv.resume() not LV.resume()

:-)

a1ex

That works, but only if image review is turned off. That's because I'm switching to QuickReview mode in order to trigger the overlays for preview (zebras, histogram and so on), so the camera is no longer in the plain LiveView paused mode. For some reason, it doesn't want to come back from this state with the usual method (even if I'd expect it to).

This appears to cover both cases:

function go() -- minimal example
    menu.close()
    my_shoot()
    key.press(KEY.HALFSHUTTER)
    msleep(100)
    key.press(KEY.UNPRESS_HALFSHUTTER)
end

garry23

@A1ex

Thanks that little trick of yours seems to have done the trick  :)

Cheers

Garry