5.7 Example scripts
153
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
Содержание 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 ...