172
C H A P T E R 5
Scripting
is printed onto the display. The script then waits for a key press with
wait_
click()
. Depending on the key clicked (
RIGHT
or
LEFT
), the value of
program
is decremented or incremented. When
program
becomes too small, it re-
starts at the largest program number (wraparound), and similarly, when it
becomes too large, it restarts at 1. This whole section is executed in a loop
that is only left when
FUNC/SET
is pressed. Even when
wait_click()
times
out after 10 seconds, the script will loop around and wait for more key
presses.
Finally, we invoke the function corresponding to the selected program.
This function will assign new values to the script parameters and will thus
configure the script for the selected scene program:
-- Program selection
program = 1
repeat
cls()
print("Program:LEFT/RIGHT/SET")
print(">"..labels[program].."<")
wait_click(10000)
if is_pressed("left") then
program = program-1
if program < 1 then
program =# programs
end
elseif is_pressed("right") then
program = p 1
if program ># programs then
program = 1
end
end
until is_pressed("set")
-- Assign parms for selected program
programs[program]()
In the following section, we perform a sanity check for the parameters
controlling the mask borders and the threshold. We simply check to see if
the values are out of bounds and make sure that the low boundary is not
higher than the high boundary. A threshold of 0 would be nonsense; the
camera would fire without any motion:
-- Inhibit bad mask bounds
if m > b then m = b end
if m < 1 then m = 1 end
if k > m then k = m end
if k < 1 then k = 1 end
Summary of Contents for Camera
Page 1: ......
Page 2: ...The Canon Camera Hackers Manual ...
Page 3: ......
Page 4: ...Berthold Daum The Canon Camera Hackers Manual Teach Your Camera New Tricks ...
Page 19: ...10 CH APTER 2 Cameras and Operating Systems ...
Page 25: ...16 CH APTER 3 ...
Page 85: ...76 CH APTER 4 Teach Your Camera New Tricks ...
Page 213: ...204 CH APTER 6 ...
Page 253: ...244 AP PENDIX ...