Magic Lantern Forum

Developing Magic Lantern => Scripting Corner => Scripting API suggestions => Topic started by: garry23 on May 03, 2016, 08:20:20 AM

Title: [DONE - camera.shoot updated] FRSP from with Lua
Post by: garry23 on May 03, 2016, 08:20:20 AM
Has anyone worked out how to take a full res silent picture from within a Lua script?

I've looked at David's Lua documentation and at various posts, and I've tried various ways myself...but no luck.

Cheers

Garry
Title: Re: FRSP from with Lua
Post by: dmilligan on May 03, 2016, 01:06:55 PM
If you call shoot() with FRSP enabled and in LV, does it work?
Title: Re: FRSP from with Lua
Post by: garry23 on May 03, 2016, 06:56:58 PM
David

No. If I enable FRSP and call Shoot(), it simply takes a normal .CR2 image with shutter action. Not even a duplicate DNG.

Cheers

Garry
Title: Re: FRSP from with Lua
Post by: garry23 on May 03, 2016, 07:24:49 PM
David

I thought I was being 'clever' here: but this test script doesn't appear to work, ie FRSP not trigger  :'(

I have tried various times between the press() calls.

menu.new
{
  name = "Run",
  select = function() task.create(run_test) end,
  depends_on = DEPENDS_ON.M_MODE,
}

run_test = function()
lv.start()
msleep(2000)
key.press(KEY.HALFSHUTTER)
msleep(1000)
key.press(KEY.UNPRESS_HALFSHUTTER)
end
Title: Re: FRSP from with Lua
Post by: dmilligan on May 04, 2016, 04:17:01 AM
We need to expose take_a_pic() in shoot.c in the Lua API (not sure what to call it). I was thinking that's what Lua's shoot() called, but it actually calls lens_take_picture(). It would probably also be good to expose bulb_take_pic().
Title: Re: FRSP from with Lua
Post by: garry23 on May 04, 2016, 07:47:41 AM
David

Based on what you say, may I assume that either you or A1ex will look into this the next time you do an update in the nightlies.

BTW why doesn't my key.press experiment work, as, to me, all I'm doing is sending the key presses I would do if I was manually trig going FRSP.

Cheers

Garry
Title: Re: FRSP from with Lua
Post by: a1ex on May 04, 2016, 09:07:16 AM
The keypress not working is also a a bug, because half-shutter events have to be sent with a different method: SW1 (unlike most other button codes).
Title: Re: FRSP from with Lua
Post by: garry23 on May 04, 2016, 10:03:38 AM
A1ex

Thanks for the insight: I always worry about my incompetence  :-[

BTW once again thanks for getting the Lua scripting environment working.

I'm really happy with my focus+exposure bracketing script: although I know I could code it better if I looked at it more closely.

Last night I tested it in our local church and it worked faultlessly every time. I was using a 12-24mm Sigma, at 12mm, on my 5D3. I simply compose, moved the focus ring all the way to the macro end, set the exposure for the shadows and ran the script.

I'm a happy man  :)
Title: Re: FRSP from with Lua
Post by: a1ex on May 04, 2016, 10:24:57 AM
Quote from: dmilligan on May 04, 2016, 04:17:01 AM
We need to expose take_a_pic() in shoot.c in the Lua API (not sure what to call it). I was thinking that's what Lua's shoot() called, but it actually calls lens_take_picture().

I think it's best to have shoot() call take_a_pic() - even if the syntax changes slightly, it's easy to adjust the scripts. The first parameter (a timeout) doesn't make much sense to be exposed to scripts anyway, and the second one (should_af) is quite useful.

QuoteIt would probably also be good to expose bulb_take_pic().

This one appears to be already exposed - camera.bulb(duration_seconds).
Title: Re: FRSP from with Lua
Post by: dmilligan on May 04, 2016, 12:07:56 PM
Sounds good to me
Title: Re: FRSP from with Lua
Post by: garry23 on May 04, 2016, 01:04:32 PM
@A1ex

I just tried camera.bulb (test script below) and no matter what, it only takes an image at 0.4s, ie instead of 50s.

Is it my scripting or a bug?

Cheers

Garry


menu.new
{
  name = "Run",
  select = function() task.create(run_test) end,
  depends_on = DEPENDS_ON.M_MODE,
}

run_test = function()
menu.close()
lv.start()
msleep(1000)
camera.bulb(50)
end
Title: Re: FRSP from with Lua
Post by: a1ex on May 04, 2016, 08:11:31 PM
Hopefully all of these are working fine in the lua_fix branch.

https://bitbucket.org/hudson/magic-lantern/pull-requests/720/lua-fixes-part-2-wip/diff
Title: Re: FRSP from with Lua
Post by: garry23 on May 04, 2016, 11:12:43 PM
 :) :) :) :)