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 delay
if d>0 then
h, m, s, t =
tohms(next_event-start_ticks)
print(string.format(
Содержание 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 ...