Wikia

CHDK Wiki

UBASIC/Scripts:Shutter Speed Stack

Talk0
576pages on
this wiki

< UBASIC

Shutter Speed Stack (AllBest build) Edit

Written for/on: Canon S2 IS
Required CHDK build: AllBest

This script sets and stacks shutter speeds including override shutter speeds if available. It also estimates and displays the shutter speed in seconds (eg: 2.3s) of fraction seconds (eg: 1/4000s). Can be used for single shots, multiple shots with changing shutter speed and multiple shots with static shutter speed.

Documentation/Help (save as a small "ShutterSpeedAB.txt" file to your /CHDK/SCRIPTS/ folder)


There are 7 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

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


Script Code (save as "ShutterSpeedAB.bas" to your /CHDK/SCRIPTS/ folder)

rem Author: barberofcivil
rem Tested on S2
rem Requires AllBest build

@title Shutter Speed - AllBest
@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

cls
if f<0 then f=0
if g<0 then g=0
if d<1 then d=1
if a<1 then a=1
if c>=a then c=a-1
if c<0 then c=0
if b<0 then c=-c

if d=1 then print "One shot to be taken" else print d,"shots to be taken"
if d=1 or e=0 then gosub "Single" else gosub "Multiple"

print "Click <set> to proceed"
print "Any button to cancel"

wait_click
is_key z "set"
if z=1 then print "Proceeding..." else gosub "Cancel"

while f>0
  print "Starting in",f,"s..."
  sleep 1000
  f=f-1
wend

print "Starting shots now..."

for i=1 to d
  cls
  print "Shot",i,"of",d
  gosub "ShutterCalc"
  if k>=6 then print "Shutter ~1/"o,"s" else print "Shutter ~"r"."st,"s"
  print "Shutter value:",p
  set_tv96_direct p
  shoot
  sleep 1000*g
next i

end

:ShutterCalc
  k=(1-i)*e-b*a-c
  l=(k/a/4)*4*a
  if k<0 then l=l-4*a
  m=1
  for j = 1 to (l/a/4+2)
    m=m*16
  next j
  h=(k-l)
  j=(((((((((30*h*h*h)/(4*a))*h)/(4*a))*h)/(4*a))*243)/(4*a))*7)
  j=j-(((((((30*h*h*h)/(4*a))*h)/(4*a))*254)/(4*a))*4)
  j=j+(((((30*h*h*h)/(4*a))*227)/(4*a))*9)
  j=j+(((30*h*h*307)/(4*a))*3)
  j=j+(30*h*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
return

:Cancel
  print "Shots cancelled"
  end

:Single
  if e=0 and d>1 then print "Tv locked (step=0)"
  i=1
    gosub "ShutterCalc"
    if k>=6 then print "Tv: ~1/"o,"s" else print "Tv: ~"r"."st,"s"
return

:Multiple
  i=1
    gosub "ShutterCalc"
    if k>=6 then print "Tv Start: ~1/"o,"s" else print "Tv Start: ~"r"."st,"s"
  i=d
    gosub "ShutterCalc"
    if k>=6 then print "Tv End:   ~1/"o,"s" else print "Tv End:   ~"r"."st,"s"
return

--Barberofcivil

Around Wikia's network

Random Wiki