I am using a script on the Canon G9 to capture weather data every minute.
But at night it flashes every minute - even though I thought I have disabled it.
My Script it here
--[[
@title Timelapse for Chris
@param s Sleep Duration
@default s 60000
@param b Zoom Step (0=none)
@default b 0
@range b 0 500
@param w Focus @ Infinity?
@default w 1
@range w 0 1
@param m Status LED
@default m 0
@values m Off 0 1 2 3 4 5 6 7 8
]]
counter = 0
zoom_setpoint = b
status_led = m-1
log_mode = t
focus_at_infinity = w
led_state = 0
led_timer = 0
now = get_day_seconds()
timestamp = 86401
require("drawings")
props=require("propcase")
function update_zoom()
if ( zoom_setpoint > 0 ) then
zsteps=get_zoom_steps()
if(zoom_setpoint>zsteps) then zoom_setpoint=zsteps end
-- printf("set zoom to step %d of %d",zoom_setpoint,zsteps)
sleep(2000)
set_zoom(zoom_setpoint)
sleep(2000)
end
end
function led_blinker()
if ( status_led > -1 ) then
local tk = get_tick_count()
if ( tk > led_timer ) then
if ( led_state == 0 ) then
led_state = 1
led_timer= tk + 200
else
led_state = 0
if (error_mode == 0) then
led_timer= tk + 2000
else
led_timer= tk + 500
end
end
set_led(status_led,led_state)
end
end
end
function camera_reboot()
print("Reboot countdown")
local ts=70
repeat
ts=ts-1
sleep(1000)
until ( ts == 0)
set_autostart(2) -- autostart once
sleep(2000)
reboot()
end
function check_SD_card_space()
local z=(get_free_disk_space()*100)/get_disk_size()
if (z<5) then error_mode=1 end
return( z )
end
function TakePicture()
print ("Capture #",counter)
StartTick = get_tick_count()
press("shoot_half")
repeat sleep(50) until get_shooting() == true
press("shoot_full")
release("shoot_full")
repeat sleep(50) until get_shooting() == false
release "shoot_half"
EndTick = get_tick_count()
-- sleep for 60 seconds - the amount of time waiting + camera time
delay = s - (EndTick - StartTick)
-- Minimum sleep of 1 second
if (delay < 1000) then
delay = 1000
end
sleep(delay)
end
function DeleteFiles(Path)
for fname in os.idir(Path, false) do
t =os.stat(Path .."/"..fname)
if (os.difftime(os.time(),t.mtime) > 120) then
os.remove(Path .."/"..fname)
print ("Delete "..fname)
end
end
end
function UpdateCounter()
if (counter > 3) then
set_lcd_display(0)
end
counter = counter + 1
end
function CheckForRebootConditons()
now = get_day_seconds()
print(now .." seconds")
if ( now < timestamp ) then
camera_reboot()
end
timestamp=now
end
function SetupCamera()
-- disable flash, image stabilization and AF assist lamp
set_prop(props.FLASH_MODE, 2) -- flash off
set_prop(props.IS_MODE, 3) -- IS_MODE off
set_prop(props.AF_ASSIST_BEAM,0) -- AF assist off if supported for this camera
set_prop(props.QUALITY,0) -- Set JPG Quality
update_zoom()
timestamp=now
end
function DeleteOldPhotos()
DeleteFiles("A/DCIM/100CANON")
DeleteFiles("A/DCIM/101CANON")
end
sleep(1000)
SetupCamera()
print ("Camera Setup")
repeat
UpdateCounter()
CheckForRebootConditons()
TakePicture()
DeleteOldPhotos()
-- blink status LED - slow (normal) or fast(error or SD card full)
led_blinker()
collectgarbage()
until false
The script seems to work fine for me, but at night the flash goes off.
Any ideas of why the flash code is not working for me?
In my setup routine I am using
set_prop(props.FLASH_MODE, 2) -- flash off
But it does not work, infact it seems to set it to on not off.
Chris