supplierdeeply

lock AutoFocus in a script

  • 9 Replies
  • 1456 Views
lock AutoFocus in a script
« on: 01 / August / 2013, 09:47:49 »
Advertisements
Hello everybody,
I have one camera canon powershot SX230 HS, and I would like take picture rapidly and I have one computer in linux.
I create an intervalometer in a script lua and I take a picture very fast. In this script I set different params only at the beginning and I lock Auto Focus with set_aflock(1). But I don't want to do this.

- lock in the exposure and focus
press("shoot_half")
repeat
    sleep(50)
until get_shooting() == true   

-- lock autofocus
set_aflock(1)

I would like create an intervalometer with linux, with a timer linux. I create also one script fast_shoot.lua and another script name setParams.lua.  The timer send a signal and sending a command "luar loadfile('fast_shoot.lua')(...). To set a parameter before launch the timer I send a script Params, this script must lock autofocus but when I start this autofocus does not set because when I launch fast_shoot.lua the camera do a focus. Then I take just one picture every 3 seconds.

Could you help me please?

Best regards

David
French Students






Re: lock AutoFocus in a script
« Reply #1 on: 01 / August / 2013, 13:14:12 »
To set a parameter before launch the timer I send a script Params, this script must lock autofocus but when I start this autofocus does not set because when I launch fast_shoot.lua the camera do a focus.
I;m not sure,  but I think that when you use the set_aflock() command,  the lock occurs the next time you cause the camera to focus.  So try reversing the sequence in your param script ?

Code: [Select]
-- lock autofocus
set_aflock(1)

- lock in the exposure and focus
press("shoot_half")
repeat
    sleep(50)
until get_shooting() == true   
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 11084
Re: lock AutoFocus in a script
« Reply #2 on: 01 / August / 2013, 23:10:19 »
I;m not sure,  but I think that when you use the set_aflock() command,  the lock occurs the next time you cause the camera to focus.  So try reversing the sequence in your param script ?
set_aflock calls the canon function directly, it does not delay until the override callback like the exposure override functions do.

On my D10, it seems to do some kind of af scan when you call the function outside of half shoot. If you call it within halfshoot, it seems to lock at (as far as I can tell) the value that the half_shoot would have focused at.

Re our earlier discussion on IRC:
set_aflock doesn't seem to behave like using the Canon UI af lock sequence. In particular, if I put the camera in sleep mode, the AF lock is still in effect when it is woken up. Switching focus modes in the canon UI doesn't clear it (although in MF I can focus manually). Setting and then clearing AFL in the canon UI does clear it.
Don't forget what the H stands for.

Re: lock AutoFocus in a script
« Reply #3 on: 01 / August / 2013, 23:23:38 »
set_aflock calls the canon function directly, it does not delay until the override callback like the exposure override functions do.
Yes - as I continue testing I think my comment related to when the SD values update and they do not do so after a set_aflock.
Ported :   A1200    SD940   G10    Powershot N    G16


Re: lock AutoFocus in a script
« Reply #4 on: 02 / August / 2013, 06:16:26 »
Thanks for your answer.

I tried your idea but the behaviour of my camera doesn't change.
I'm really stuck with it.

The same for switch off the LCD screen.
...
set_zoom(d1[3])
set_backlight(0)

shoot()
print(get_tv96())
....

Re: lock AutoFocus in a script
« Reply #5 on: 02 / August / 2013, 06:32:16 »
I tried your idea but the behaviour of my camera doesn't change.
I'm really stuck with it.
Because you are restarting the script via your chdkptp commands,  the camera refocuses each time.  The only solution to this may be to place the camera into manual focus / focus locked mode using the Canon keys.  If your camera does not have an MF mode,  you can usually lock the focus by "half pressing" the shutter button and while holding the half-press,  push the left arrow key on the multifunction dial.

Unless set_aflock() stays active after a script terminates - I haven't tested that. If it did, you could first run a short script to lock focus prior to running your fast_shoot script.

Quote
The same for switch off the LCD screen.
...
set_zoom(d1[3])
set_backlight(0)

shoot()
print(get_tv96())
....
In a normal script, you have to issue the set_backlight(0) command after each shoot().  The Canon firmware turns the backlight on when it takes a picture.
http://chdk.wikia.com/wiki/Script_commands#set_backlight.28.29
I assume you will need to work your chdkptp command timing out to do that.
« Last Edit: 02 / August / 2013, 06:56:45 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 11084
Re: lock AutoFocus in a script
« Reply #6 on: 02 / August / 2013, 16:35:20 »
Unless set_aflock() stays active after a script terminates - I haven't tested that.
It does. set_aflock just calls the canon function immediately, so all behavior after that is completely controlled by the Canon firmware. As I mentioned in my earlier comment, it stays in effect (on my D10 at least, YMMV) until you use set_aflock(0) or enable and clear AFLock using the Canon UI.

SD overrides with set_focus are cleared after each shot, or when the script ends.

You could also set SD overrides using set_config_value, in which case they should behave exactly as if you set them in the CHDK UI. Assuming you don't apply a focus override in script, this should still be applied when running a script.
Don't forget what the H stands for.

Re: lock AutoFocus in a script
« Reply #7 on: 05 / August / 2013, 05:31:30 »
Ok thanks for your explanation.

Do you know if it's possible to set a value of shutter while the script fast shoot is running?


*

Offline reyalp

  • ******
  • 11084
Re: lock AutoFocus in a script
« Reply #8 on: 05 / August / 2013, 17:28:37 »
Ok thanks for your explanation.

Do you know if it's possible to set a value of shutter while the script fast shoot is running?
I'm not sure what you are asking. If you are talking about a specific script, give us a link to the script.

In general, it is possible to set shutter speed in a script. If the script is shooting in continuous mode, you would have to do it by setting propcase TV directly (rather than set_tv* functions) but it should still be possible. Getting the timing right might be tricky.
Don't forget what the H stands for.

Re: lock AutoFocus in a script
« Reply #9 on: 08 / August / 2013, 12:50:13 »
Thanks for your help!
During the script is running I get when the photo was taken!! That is why I need to launch the script lua with luar ! Then it's impossible to execute another script at the same time!! for exemple, shutdown the camera with "post_levent_to_ui('PressPowerButton') in a script lua" or just by ptpcam command with "lua exit()" quit a lua script are also impossible!
This is a big problem for me!

I would like start the camera with linux lua but I have "Could not find any device matching given bus/dev numbers, retrying in 1 s..." error when i launch a script. This is seems normal because the camera is off!!  Then I have no idea how shutdown the camera.
 

 

Related Topics