Canon Camera Hackers Manual page 153

Camera hackers manual berthold daum
Table of Contents

Advertisement

144
C H A P T E R 5
Scripting
print "Press SET to exit"
-- Check parameters
if n <= 0 then n = 10 end
if m < 0 then m = 5 end
if s < 0 then s = 0 end
if t < 0 then t = 0 end
-- Compute delay value
delay = (((m*60)+s)*10+t)*100
If focusing is only desired at the beginning of the series, we invoke function
focus() now. It performs the focusing and then locks the focusing system.
Then we save the current display mode in order to restore it at the end
of the script. If a dark display is desired, we use function set_display_
mode(2) to switch the display off.
if f > 0 then focus() end
old_display_mode =
get_prop(props.DISPLAY_MODE)
if d <= 0 then
set_display_mode(2)
end
Now we can initialize the main loop. We get the start time in milliseconds
(since camera start) and initialize the variable next_event with that value.
Within the loop we shoot an image, then increment the variable next_
event with the computed delay. If the display is active, we print a log entry
to inform the user about the progress. To do so, we use the function
format() from the Lua string library (section 5.4.13). Then we sleep until
the time computed in next_event. If the user has clicked FUNC/SET, we
break the loop and finish the script. This, of course, also happens when the
frame counter has reached the predefined number of shots.
Finally, the display mode is reset to its original state and the AF lock is
released, just in case it was locked by the focus() function.
start_ticks = get_tick_count()
next_event = start_ticks
for frame = 1, n, 1 do
shoot()
next_event = next_event + delay
if d>0 then
h, m, s, t =
tohms(next_event-start_ticks)
print(string.format(

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Powershot sx10 is

Table of Contents