UBASIC/Scripts: Focus Bracketing with set focus and get focus
Talk1
539pages on
this wiki
this wiki
< UBASIC
Focus Bracketing with set_focus and get_focus
Edit
- Written for/on: Powershot A630, CHDK Build 125 or later required.
- Also works on: Powershot SX10 IS
This is a new focus bracketing script. It uses set_focus to set the focus and is faster and more reliable than other scripts.
Script Code(save as "focus2.bas" to your /SCRIPTS/ folder)
rem Author Bubendorf
@title Focus2
@param a Number of ±steps
@default a 2
@param b Step size [x6]
@default b 6
if a<1 then let a=2
if b<1 then let b=1
sleep 500
get_focus f
for s=-a to a
g=f
if s<0 then gosub "negative"
if s>0 then gosub "positive"
print "Shoot", s, "(", g, ")"
set_focus g
shoot
next s
set_focus f
end
:negative
for i=s to -1
g=6*g/(b+6)
next i
return
:positive
for i=1 to s
g=g*b/6+g
next i
return
A few more additions to the code:
Script Code(save as "focusrange.bas" to your /SCRIPTS/ folder)
rem arne182
rem G12 specific code
@title FocusRange
@param a Number of +steps
@default a 3
@param b Number of -steps
@default b 3
@param c Focus range in cm
@default c 10
@param d Infinity included, yes = 1
@default d 0
if a<0 then let a=0
if b<0 then let b=0
if c<1 then let c=1
if c>50 then let c=1
rem ------- camera specific section / omit if you are not using G12 -------
y=0
get_prop 133 x
if x=1 then y=y+1 else print "Not in MF mode"
get_prop 12 x
if x=0 then y=y+1 else print "Continuous AF is on!"
if y=2 then goto "continue"
set_focus f
end
rem ------- camera specific section / omit if you are not using G12 -------
:continue
sleep 500
cls
get_focus f
if f<0 then let f=65530
if f<69 then let b=0
if f>17590 then let a=0
p=b
if (f-(b*c*10)/(a+b))<68 then let b=(f-68)*(a+p)/(10*c) else goto "shoot"
if b<0 then let b=0
if p=b then print "" else let a= a+p-b
print "b adjusted to ", b
print "press Set to proceed"
print "press Shutter to exit"
wait_click
:shoot
x=get_near_limit
y=get_far_limit
g=f-b*c*10/(a+b)
set_focus g
sleep 100
print "Near focus check"
print "press Set to proceed"
print "press Shutter to exit"
wait_click
g=f+a*c*10/(a+b)
set_focus g
sleep 100
print "Far focus check"
print "press Set to proceed"
print "press Shutter to exit"
wait_click
print "waiting for camera"
print "vibrations to stop"
sleep 2000
for s=-b to a
g=f+s*c*10/(a+b)
set_focus g
sleep 100
get_focus g
print "Shoot", s, "(", g, ")"
shoot
next s
if d=1 then gosub "infinity"
set_focus f
end
:infinity
g = 65530
print "Shoot infinity", "(", g, ")"
set_focus g
sleep 100
shoot
return