Author Topic: [WIP - lens.autofocusing, ...] Lua Property access  (Read 3142 times)

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 2228
[WIP - lens.autofocusing, ...] Lua Property access
« on: November 04, 2017, 12:10:32 PM »
@A1ex or anyone

I'm trying to make use of a long halfshutter and need to differentiate it from a LV AF action.

I thought I could use the Lua property handler, eg accessing LV_FOCUS_STATE or another LV_FOCUS property, ie to handle the AF condition.

But the LV_FOCUS property handler always seems to return 0.

Does this mean it is not yet exposed in Lua?

Cheers

Garry

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Lua Property access
« Reply #1 on: November 04, 2017, 04:12:15 PM »
It's PROP_LV_FOCUS_STATUS; value is 3 during autofocus (hopefully on all models) and 1 or 2 (depending on model) when idle.

What about adding a boolean field named lens.focusing ?

(sorry for being slow with Lua requests - it's just not something I use often, although I do see its value for the ML project)

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 2228
Re: Lua Property access
« Reply #2 on: November 04, 2017, 04:36:31 PM »
@a1ex

You never have to apologize! Not with all the work you do and with all the knowledge you have.

I tried that prop and only got 0 returned on my EOSM.

Here is the test code:

Code: [Select]
my_key = 0

function check_requests()
        display.notify_box(tostring(my_key),2000)
        return true
end

function property.LV_FOCUS_STATUS:handler(value)
     my_key = value
end
 
event.shoot_task = check_requests

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Lua Property access
« Reply #3 on: November 04, 2017, 06:46:01 PM »
The script works fine on 5D3, and likely on all other models that pass api_test.lua. EOS M is probably not one of them...

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 2228
Re: Lua Property access
« Reply #4 on: November 04, 2017, 06:49:45 PM »
@a1ex

OK, I'll test tomorrow on the 5D3.

I need a way (tonight if possible) to test if image is being taken, via Lua.

Is there another way?

Cheers

Garry

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Lua Property access
« Reply #5 on: November 04, 2017, 07:55:55 PM »
To test if an image is being taken, in order to do something during a long exposure? Or to do something after the image was taken?

The former is not exposed to Lua, but is doable. The latter is easier - see e.g. in api_test.lua: dryos.shooting_card.file_number gets incremented after a picture is taken.

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 2228
Re: Lua Property access
« Reply #6 on: November 04, 2017, 09:16:49 PM »
@a1ex

Yes it's the long exposure test.

It would be great to be able to test if image taking started and image taking finished.

Cheers

Garry