112
C H A P T E R 5
Scripting
5.5
CHDK commands
In sections 5.3 and 5.4, we looked at the language features of
uBasic
and
Lua
. None of these language features are able to invoke specific camera
functions. For that purpose, the CHDK implementations of
uBasic
and
Lua
provide extra commands enriching both languages. The names of the com-
mands are the same in both languages. The main difference is that in
Lua,
parameters are enclosed in parentheses and separated by commas,
whereas the CHDK command is implemented as a function. In
uBasic,
the
parameters are simply listed behind the command name and separated by
blanks. While values can be returned through parameters in
uBasic, Lua
only allows returning values as a function result. For example:
is_key r "right"
uBasic
r = is_key("right")
Lua
Some commands return Boolean values (
true
or
false
). Unlike
Lua, uBasic
does not have a Boolean datatype. Those values are therefore returned to
uBasic
as 0 (
false
) or 1 (
true
).
5.5.1 Button-related commands:
press "button-name"
uBasic
press("button-name")
Lua
A button is pressed and held down. Normally, this command is followed later by a
release
command for the same button name.
release "button-name"
uBasic
release("button-name")
Lua
A button is released. If the button was not pressed, the command does not have any
effect.
click "button-name"
uBasic
click("button-name")
Lua
A button is pressed and immediately released.
shoot
uBasic
shoot()
Lua
Similar to
click "shoot_full"
. In contrast to the
click
command, the
shoot
com-
mand will, however, perform all the automatic actions such as focusing, exposure
control, and flash setup before releasing the shutter.
Содержание 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 ...