I have also been working on an intervalometer with the focus set at infinity. It is designed to record road trips.
I used Fraser McCrossan's 'Accurate Intervalometer with power-saving and pre-focus' as a starting point and have stripped his code down to reduce power consumption.
I also added an occasional light reading, by default every 10 mins. It shoots until either the battery or SD card fail but it does give a warning message saying what's wrong.
However, this is my first attempt at a uBASIC or LUA script and my A460 objects to something. It doesn't have a problem with the original LUA script so it's my fault.
The message is 'uBASIC:1 Unk stmt'.
I would greatly appreciate help debugging it.
Many thanks
--[[
Author: Andrew baisley
Heavily based on Fraser McCrossan's 'Accurate Intervalometer with power-saving and pre-focus'
Many, many thanks
Tested on A460, should work on most cameras.
An accurate intervalometer script designed for shooting road trips.
Features:
* focus fixed at infinity
* power saving
* endless loop until power or memory fail
* occasional light reading.
--]]
--[[
@title Cycle Lapse
@param s Secs per frame
@default s 10
@param m Mins per light reading
@default m 10
--]]
-- convert parameters into readable variable names
secs_frame, mins_per_reading = s, m
props = require "propcase"
-- if the display mode is not the passed mode, click display and return true
-- otherwise return false
function seek_display_mode(mode)
if get_prop(props.DISPLAY_MODE) == mode then
return false
else
click "display"
return true
end
end
-- switch to autofocus mode, focus on infinity, then go to manual focus mode
function light_reading()
set_aflock(0)
press("shoot_half")
sleep(2000)
set_focus(65535)
set_aflock(1)
release("shoot_half")
sleep(500)
end
-- switch off display, setting 2
while seek_display_mode(2) do
sleep(1000)
end
set_aflock(1)
light_reading()
start_ticks = get_tick_count()
ticks_per_frame = 1000 * secs_frame
frames_per_meter = mins_per_reading * 60 / secs_frame
frame = 1
-- shoot until battery or card fails
while get_vbatt >= 2150 and get_free_disk_space >= 200000 do
set_backlight(0)
shoot()
if frame % frames_per_meter == 0 then light_reading() end
wait( (start_ticks + frame * ticks_per_frame) - get_tick_count() )
frame = frame + 1
end
-- backlight on
set_backlight(1)
-- display on, setting = 0
while seek_display_mode(0) do
sleep(1000)
end
-- restore focus mode
set_aflock(0)
-- print warning messages and sound alarm
if get_vbatt < 2200 then print("** CHANGE BATTERY **") end
if get_free_disk_space < 100000 then print("++ CHANGE MEMORY CARD ++") end
play_sound(7)