Canon Camera Hackers Manual page 162

Camera hackers manual berthold daum
Table of Contents

Advertisement

function focus(f)
if f == "F" then
press("shoot_half")
repeat until get_shooting()
set_aflock(1)
release("shoot_half")
elseif f == "A" then
set_aflock(0)
else
set_aflock(1)
set_focus(f)
end
end
You probably missed parameter value I, which stands for infinity. This is
taken care of in function parseFocus(), which analyzes the focus subclause
as specified in a schedule file. It converts the value I to –1, a value that
stands for infinity. Of course, it would also be possible to write –1 directly
into the schedule file, but the letter I is easier to remember and to write.
There are two more functions for parsing subclauses: parseTime() and
parseDisp(). The function parseTime() accepts [[h:]m:]s expressions
and converts them into milliseconds. To make parsing easier, it first ap-
pends a single colon to the end of the subclause. parseDisp() accepts the
valid display operators and converts them into the display states required
by function set_display_mode().
function parseFocus(token)
t = string.upper(token)
if "A" == t or "F" == t then
return t
elseif "I" == t then
return -1
end
return tonumber(t)
end
function parseTime(token)
local t, s, a = 0, token..":", 1
for j = 1, 3 do
local e = string.find(s, ":", a)
if not e then break end
t = t * 60
5.7 Example scripts
153

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Powershot sx10 is

Table of Contents