Zoom stepping - My first script - Completed and Working Scripts - CHDK Forum supplierdeeply

Zoom stepping - My first script

  • 0 Replies
  • 4007 Views
Zoom stepping - My first script
« on: 05 / June / 2008, 19:29:14 »
Advertisements
Well, I decided that one of the features I wanted on my camera was the ability to step the zoom in and out instead of hitting the rocker as quick as possible and hoping for the best. This script will let you use the up/down keys to zoom in and out one step at a time, for finding a precise focal length.

I tested it on the S5, so it should work fine on any S-series. I haven't tested it on anything else, but you should be able to do minor modifications to get it working on any other CHDK-supported camera.

I added some sleeps to the script because I was finding it locking up if I hit up or down too fast. It would completely freeze the UI, with the live view still updating, and eventually turn off with the lens still extended.

Code: [Select]
@title Zoom Stepping
@param a Zoom step
@default a 3
@param b Max zoom (A: 8/14) (S: 128)
@default b 128
@param c Zoom speed: 1-10 (S-only)
@default c 10

if a<1 then a=1
if a>b then a=1
if b<8 then b=8
if c<1 then c=5
if b>128 then b=128
if c>10 then c=10
c=c*10
get_zoom z
set_zoom_speed c

print "Up = Zoom In"
print "Down = Zoom Out"
print "L/R = Change Step"
print "Step = ", a

:loop
wait_click
is_key k "up"
if k=1 then goto "raise"
is_key l "down"
if l=1 then goto "lower"
is_key m "right"
if m=1 then goto "stepu"
is_key n "left"
if n=1 then goto "stepd"
goto "loop"
end

:raise
set_zoom_speed c
sleep 20
get_zoom z
z=z+a
set_zoom z
sleep 100
goto "loop"
return

:lower
set_zoom_speed c
sleep 20
get_zoom z
z=z-a
set_zoom z
sleep 100
goto "loop"
return

:stepd
a=a-1
if a<1 then a=1
if a>b then a=1
cls
print "Up = Zoom In"
print "Down = Zoom Out"
print "L/R = Change Step"
print "Step = ", a
goto "loop"
return

:stepu
a=a+1
if a<1 then a=1
if a>b then a=1
cls
print "Up = Zoom In"
print "Down = Zoom Out"
print "L/R = Change Step"
print "Step = ", a
goto "loop"
return

 

Related Topics