Canon Camera Hackers Manual page 152

Camera hackers manual berthold daum
Table of Contents

Advertisement

The function focus() is called if the user wants to focus just once at the
beginning of the series. In this case, the focusing is performed by half-
pressing the shutter button. In the following repeat- loop we wait until the
camera becomes ready to shoot. The sleep(1) command in that loop is
recommended to give the camera processor some time to breathe. In uBasic
that would not be necessary because the uBasic interpreter automatically
waits 10 msec after each line of code. This is not the case for Lua—probably
the main reason why Lua scripts are so much faster.
After focusing has finished, we lock the autofocus system and release
the shutter button. The camera will not try to refocus until the lock is re-
leased.
function focus()
press("shoot_half")
repeat
sleep(1)
until get_shooting()
set_aflock(1)
release("shoot_half")
end
Function tohms() converts milliseconds into the more readable format
h:m:s. It does so by dividing the seconds subsequently by 60 and keeping
the remainders. Instead of using the operator / for division, we use the
function idiv() defined above:
function tohms(ticks)
local ts =
idiv((ticks + 50), 100)
local t = ts % 10
ts = idiv(ts, 10)
local s = ts % 60
ts = idiv(ts, 60)
local m = ts % 60
local h = idiv(ts, 60)
return h, m, s, t
end
All necessary functions are now implemented, and we can begin with the
main program. First, we print a short note to the user describing how to
abort the script. We then begin checking the parameters for valid values. If
a value is invalid, the parameter is reset to its default value.
We can compute the interval between two shots (delay) as discussed
above:
5.7 Example scripts
143

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Powershot sx10 is

Table of Contents