Author Topic: [DONE - camera.shoot updated] FRSP from with Lua  (Read 2299 times)

garry23

  • Hero Member
  • *****
  • Posts: 1310
[DONE - camera.shoot updated] FRSP from with Lua
« 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

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3204
  • 60Da / 1100D / EOSM
Re: FRSP from with Lua
« Reply #1 on: May 03, 2016, 01:06:55 PM »
If you call shoot() with FRSP enabled and in LV, does it work?

garry23

  • Hero Member
  • *****
  • Posts: 1310
Re: FRSP from with Lua
« Reply #2 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

garry23

  • Hero Member
  • *****
  • Posts: 1310
Re: FRSP from with Lua
« Reply #3 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.

Code: [Select]
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

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3204
  • 60Da / 1100D / EOSM
Re: FRSP from with Lua
« Reply #4 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().

garry23

  • Hero Member
  • *****
  • Posts: 1310
Re: FRSP from with Lua
« Reply #5 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

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 10435
  • 5D Mark Free
Re: FRSP from with Lua
« Reply #6 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).

garry23

  • Hero Member
  • *****
  • Posts: 1310
Re: FRSP from with Lua
« Reply #7 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  :)

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 10435
  • 5D Mark Free
Re: FRSP from with Lua
« Reply #8 on: May 04, 2016, 10:24:57 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.

Quote
It would probably also be good to expose bulb_take_pic().

This one appears to be already exposed - camera.bulb(duration_seconds).

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3204
  • 60Da / 1100D / EOSM
Re: FRSP from with Lua
« Reply #9 on: May 04, 2016, 12:07:56 PM »
Sounds good to me

garry23

  • Hero Member
  • *****
  • Posts: 1310
Re: FRSP from with Lua
« Reply #10 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

Code: [Select]
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

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 10435
  • 5D Mark Free
Re: FRSP from with Lua
« Reply #11 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

garry23

  • Hero Member
  • *****
  • Posts: 1310
Re: FRSP from with Lua
« Reply #12 on: May 04, 2016, 11:12:43 PM »
 :) :) :) :)