command to set MF distance to hyperfocal distance - Script Writing - CHDK Forum

command to set MF distance to hyperfocal distance

  • 5 Replies
  • 5994 Views
command to set MF distance to hyperfocal distance
« on: 27 / March / 2012, 01:55:19 »
Advertisements
Is there a command to set the MF  focus distance to the hyperfocal distance?

*

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Re: command to set MF distance to hyperfocal distance
« Reply #1 on: 27 / March / 2012, 12:42:07 »
Is there a command to set the MF  focus distance to the hyperfocal distance?
Not directly, however you can do the same thing using two statements. For uBasic you can use the following two commands. The first retrieves the hyperfocal distance and the second sets the focus to the value retrieved:

Code: [Select]
x=get_hyp_dist
set_focus x

The uBasic User's Guide and can be downloaded from here: http://images2.wikia.nocookie.net/__cb20100806022158/chdk/images/e/e5/UBASIC_User_Guide_D0_5.pdf
The uBasic & LUA commands can be found online on the CHDK web pages such as http://chdk.wikia.com/wiki/Script_commands & http://chdk.wikia.com/wiki/UBASIC/TutorialScratchpad
The already completed and working uBasic & LUA scripts are a good source of how to use many of the statements: http://chdk.setepontos.com/index.php?board=7.0

Re: command to set MF distance to hyperfocal distance
« Reply #2 on: 27 / March / 2012, 13:37:48 »
Thanks SkyWalker9,
Very useful information and links.

Would the following work to set the focus distance to the hyperfocal distance and lock that focus to the hyperfocal distance for interval shooting?

Modified interval.bas included with latest CHDK.
Code: [Select]
@title Intervalometer
@title Intervalometer
@param a = interval (sec)
@default a 15
x=get_hyp_dist
set_focus x
set_aflock 1
do
    s = get_tick_count
click "shoot_full"
    sleep a*1000 - (get_tick_count - s)
until ( 0 )


It doesn't appear to work. Will play with it some more tomorrow.
« Last Edit: 27 / March / 2012, 14:53:37 by bisenberger »

*

Offline funnel

  • ****
  • 349
Re: command to set MF distance to hyperfocal distance
« Reply #3 on: 27 / March / 2012, 16:01:25 »
Or you can just set the camera to manual focus mode, go into alt mode and press down key.


*

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Re: command to set MF distance to hyperfocal distance
« Reply #4 on: 27 / March / 2012, 20:34:04 »
...Would the following work to set the focus distance to the hyperfocal distance and lock that focus to the hyperfocal distance for interval shooting?...It doesn't appear to work...
Code: [Select]
@title Intervalometer
@title Intervalometer
@param a = interval (sec)
@default a 15
x=get_hyp_dist
set_focus x
set_aflock 1
do
    s = get_tick_count
click "shoot_full"
    sleep a*1000 - (get_tick_count - s)
until ( 0 )
You might try the following revised version. I'm not able to test right now due to family commitments, but this should get you farther along.

Code: [Select]
@title Intervalometer
@param a interval (sec)
@default a 15
x=get_hyp_dist
set_focus x
set_aflock 1
do
    s = get_tick_count
        click "shoot_full"
    sleep a*1000 - (get_tick_count - s)
until ( 0 )

UBDebug (An Interactive Development Environment for CHDK uBasic Scripts) is a uBasic debugger that allows you to test scripts on your PC before trying on your camera. It's great if you want to test out changes to code. I've found it can save a lot of time on complex scripts by checking for various types of coding errors; it definitely reduces test time & wear-and-tear on you camera. While the "Start" button will actually run the script, the "Step" button allows you to step through each statement and see how a variable changes - this can save a lot of troubleshooting time. Here's the link: http://www.zenoshrdlu.com/kapstuff/zubdb.html

Re: command to set MF distance to hyperfocal distance
« Reply #5 on: 27 / March / 2012, 22:46:05 »
Or you can just set the camera to manual focus mode, go into alt mode and press down key.

Tried this method, but the focus changes when using the intervalometer scripts.

I'm trying to come up with a way to use the hyperfocal distance focus with an intervalometer.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal