CHDK Wiki
Line 3: Line 3:
 
==set_aflock()==
 
==set_aflock()==
 
* <span style="font-size:13px;">set_aflock(1) causes the Canon firmware to stop focussing when shooting</span>
 
* <span style="font-size:13px;">set_aflock(1) causes the Canon firmware to stop focussing when shooting</span>
 
* does an initial focus measurement and sets focus at that value when called
 
** does an initial focus measurement and sets focus at that value when called
 
 
* <span style="font-size:13px;">set_aflock(0) restores camera automatic focussing.</span>
 
* <span style="font-size:13px;">set_aflock(0) restores camera automatic focussing.</span>
 
* works on all cameras
 
* works on all cameras

Revision as of 02:39, 12 November 2013

Subtitle :  Getting the "set_focus()" command in CHDK scripts,  or the "Override Subject Distance" menu item in the Enhanced Photo Operations menu,  to work.

set_aflock()

  • set_aflock(1) causes the Canon firmware to stop focussing when shooting
  • does an initial focus measurement and sets focus at that value when called
  • set_aflock(0) restores camera automatic focussing.
  • works on all cameras
  • using this does not seem to affect whether set_focus() works on does not. If it works before calling set_aflock() it will work after (allowing you to change the focus distance). If set_focus() was not working prior to set_aflock() it still won't work afterwards.
  • if you call set_aflock() and then set_focus() (in a mode on your camera where that works) then the focus for all subsequent shots will stay at the value specified in set_focus().  If set_aflock() has not been called then set_focus() will only apply to the next shot - after that the camera will revery to auto focus.

set_focus()

  • script command that may or may not actually set the focus setting (in mm) the next time the camera shoots.
  • on some cameras, set_focus() will only work if the camera is in Canon AFL mode (ex: A1200)
  • on some cameras, set_focus() will only work if the camera is in Canon MF mode (ex: SX50HS)
  • on some cameras, set_focus() will only work when the camera is in P mode (or at least not in AUTO)
  • on some cameras, set_focus works every time regardless of mode (ex: G10, SD940)
Notes :
  1. Canon AFL mode is typically achieved via simulated button presses using click() - see your camera manual for the correct sequence. May require holding a "half press" while another key is clicked.
  2. Canon MF mode is may be achieved via simulated button presses, post_levent_for_npt call, and/or call_event_proc calls.

Forum Links

http://chdk.setepontos.com/index.php?topic=9533.0

http://chdk.setepontos.com/index.php?topic=8016.msg94251#msg94251

http://chdk.setepontos.com/index.php?topic=6672.msg75166#msg75166