*edit* oops, slight error, should be fixed now
Hello all!
I have attempted to learn LUA and try rewriting my Shutter Speed scripts. Here is my attempt at the standard, pre-set version. I will be trying to rewrite the adjustable one as well in the near future as LUA scripts seem to run much quicker and will make it much more usable.
I have also added a pre-focus option. Setting this to ON makes the camera prefocus before the first shot and then lock the focus for the remaining.
Please give the script a try if you're interested and let me know of any bugs or problems encountered.
It is a LUA script, so give it a .lua extension.
PS: Thanks for those who ported the SX10! I recently acquired one of these to replace my older S2.
There are 8 parameters that can be set:
a - EV fraction (1/x EV) - specify the EV fraction, used for both Start/End and stepping (e.g. 3 = 1/3EV, 6 = 1/6EV, etc.)
b - Start Tv (1EV) - specify the starting EV in whole EVs (relates directly to shutter speed), 0=1sec, +slower speeds, higher exposure, -higher shutter speeds
c - Start Tv (1/xEV) - specify starting EV fraction (is appended to b to allow partial EV, must be from 0 to a)
d - No.Shots - Number of shots to be taken (>0, can be set to take one shot only)
e - Step Size (y/x EV) - how much to step up/down each exposure for each shot (can be 0 to lock shutter speed)
f - Start Delay (s) - delay to start shooting
g - Delay between shots (s) - delay between consecutive shots
h - Pre-Focus - set pre-focus and focus lock (0=OFF, 1=ON)
When starting the script, the start and end shutter speeds will be calculated and presented on-screen (only start if 1 shot), the user then hits <set> to accept or any other key to cancel.
The script will then take the shots required. For each shot, the shutter speed will be displayed, as well as the shutter value.
EG:
a = 3
b = -11
c = 2
d = 2
e = -1
2 shots to be taken, step size = -1/3EV (e/a)
start EV = -11 2/3
end EV = -12
Tv Start ~1/3243 s
Tv End ~1/4096 s
The shutter speeds should be fairly accurate
compare:
-11 2/3 (Tv = 1120) 1/3243 vs 1/3251 (+0.25%)
-12 (Tv = 1152) 1/4096 vs 1/4096 (+0.00%)
It hasn't been fully tested under all possible conditions, but should work fairly well from between +6 (64.00s) to -20 (1/1,048,576s) with an EV resolution of up to 1/96.
--[[
rem Author: barberofcivil
rem Tested on A570
@title Shutter Speed
@param a EV fraction (1/x EV)
@default a 3
@param b Start Tv (1EV)
@default b -11
@param c Start Tv (1/xEV)
@default c 0
@param d No.Shots
@default d 1
@param e Step Size (y/x EV)
@default e 1
@param f Start Delay (s)
@default f 0
@param g Delay between shots (s)
@default g 0
@param h Pre-focus: 0=OFF, 1=ON
@default h 1
--]]
if f<0 then f=0 end
if g<0 then g=0 end
if d<1 then d=1 end
if a<1 then a=1 end
if c>=a then c=a-1 end
if c<0 then c=0 end
if b<0 then c=-c end
if h<0 then h=0 end
if h>1 then h=1 end
function ShutterCalc (i)
k=(1-i)*e-b*a-c
l=(k/a/4)*4*a
if k<0 then l=l-4*a end
m=16^(l/a/4+2)
n=(k-l)
j=(((((((((30*n*n*n)/(4*a))*n)/(4*a))*n)/(4*a))*243)/(4*a))*7)
j=j-(((((((30*n*n*n)/(4*a))*n)/(4*a))*254)/(4*a))*4)
j=j+(((((30*n*n*n)/(4*a))*227)/(4*a))*9)
j=j+(((30*n*n*307)/(4*a))*3)
j=j+(30*n*850)
o=(((((((j/(18000)+1)/2)+a)*m)/(128*a)+1))/2)
p=(k*96)/a
q=(((51200*a)/(((((j/18000)+1)/2)+a)*m)+1)/2)
r=q/100
s=(q-r*100)/10
t=q-r*100-s*10
end
cls()
if d==1 then print ("One shot to be taken") else print (d.." shots to be taken") end
if d==1 or e==0 then
if e==0 and d>1 then print ("Tv locked (step=0)") end
ShutterCalc(1)
if o>=4 then print ("Tv: ~1/"..o.." s") else print ("Tv: ~"..r.."."..s..t.." s") end
else
ShutterCalc(1)
if o>=4 then print ("Tv Start: ~1/"..o.." s") else print ("Tv Start: ~"..r.."."..s..t.." s") end
ShutterCalc(d)
if o>=4 then print ("Tv End: ~1/"..o.." s") else print ("Tv End: ~"..r.."."..s..t.." s") end
end
print ("Click <set> to proceed")
print ("Any button to cancel")
wait_click()
if is_key("set") then
print ("Proceeding...")
while f>0 do
print ("Starting in "..f.." s...")
sleep (1000)
f=f-1
end
cls()
if h==0 then
print("Prefocus OFF")
elseif h==1 then
print("Prefocus ON")
local focused = false
local try = 1
while not focused and try <= 5 do
print("Pre-focus attempt " .. try)
press("shoot_half")
sleep(2000)
if get_prop(18) > 0 then
focused = true
set_aflock(1)
end
release("shoot_half")
sleep(500)
try = try + 1
end
if not focused then print "Unable to pre-focus" else print "Pre-focus complete" end
end
print ("Starting shots now...")
for i=1,d,1 do
cls()
print ("Shot "..i.." of "..d)
ShutterCalc(i)
if o>=4 then print ("Shutter ~1/"..o.." s") else print ("Shutter ~"..r.."."..s..t.." s") end
print ("Shutter value: "..p)
if p==0 then p=1 end
set_tv96_direct(p)
shoot()
sleep (1000*g)
end
else
print ("Shots cancelled")
end
set_aflock(0)