![background image](http://html.mh-extra.com/html/canon/camera/camera_hackers-manual_59969193.webp)
184
C H A P T E R 5
Scripting
if b > 0 then b = 1 else b = 0
z = get_zoom_steps
if m = 0 then
s = s - 1 rem 0..s-1
if z < s then
s = z
endif
c = get_zoom
n = (c * s + z/2) / z
d = 1 rem zoom in
if n >= s then
d = -1 rem
zoom out
endif
endif
set_zoom_speed 100
e = get_day_s 50
The main
while
loop contains an inner
do
loop that waits on a signal from
the USB port. Within this loop, the display backlight is set to the desired
state. If power-down is to be inhibited, the subroutine
wakeup
is called.
When a USB signal arrives (indicated by
p>0
), the duration of the pulse
is analyzed. If the duration is shorter than 500 msec or if zooming had been
disabled by setting parameter
s
to a value <= 1, the camera is fired. Other-
wise, the subroutine
zoom
is executed. Afterwards, the script loops and
waits for the next signal:
while 1
do
set_backlight b
if t <= 0 then gosub "wakeup"
p = get_usb_power
until p > 0
print "USB Pulse",p * 10;"msec"
if p > 50 and s > 0 then
gosub "zoom"
else
shoot
endif
wend
end
The subroutine
wakeup
“tickles” the camera every 50 sec by pressing the
FUNC/SET
button twice. This will keep the camera from powering down. As
Содержание Camera
Страница 1: ......
Страница 2: ...The Canon Camera Hackers Manual ...
Страница 3: ......
Страница 4: ...Berthold Daum The Canon Camera Hackers Manual Teach Your Camera New Tricks ...
Страница 19: ...10 CH APTER 2 Cameras and Operating Systems ...
Страница 25: ...16 CH APTER 3 ...
Страница 85: ...76 CH APTER 4 Teach Your Camera New Tricks ...
Страница 213: ...204 CH APTER 6 ...
Страница 253: ...244 AP PENDIX ...