Canon Camera Hackers Manual page 181

Camera hackers manual berthold daum
Table of Contents

Advertisement

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
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
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 = program + 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
(RIGHT
FUNC/SET
is pressed. Even when wait_click() times
or LEFT), the value of program

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Powershot sx10 is

Table of Contents