--[[
@title dark by temp
]]
--log dark frames
--by jmac698
--all initialization and error checking is in this part--
RAW_NR_AUTO=0
RAW_NR_OFF=1
RAW_NR_ON=2
RAW_OFF=0
RAW_ON=1
propcase=require("propcase")
-- check for native call interface:
if (type(call_event_proc) ~= "function" ) then
error("your CHDK does not support native calls")
end
local bi=get_buildinfo()
if bi.os=="vxworks" then
closeproc="CloseMShutter"
openproc="OpenMShutter"
if (call_event_proc("InitializeAdjustmentFunction") == -1) then
error("InitAdjFunc failed")
end
elseif bi.os=="dryos" then
closeproc="CloseMechaShutter"
openproc="OpenMechaShutter"
if (call_event_proc("Mecha.Create") == -1) then
if (call_event_proc("MechaRegisterEventProcedure") == -1) then
error("Mecha.Create failed")
end
end
else
error("Unknown OS:" .. bi.os)
end
-- close mechanical shutter
function closeshutter()
if (call_event_proc(closeproc) == -1) then
print("closeshutter failed")
end
end
-- open mechanical shutter
function openshutter()
if (call_event_proc(openproc) == -1) then
print("openshutter failed")
end
end
-- switch to record mode if necessary
if ( get_mode() == false ) then
print("switching to record mode")
sleep(1000)
set_record(1)
while ( get_mode() == false) do
sleep(100)
end
end
-- make sure we are in P mode
capmode=require("capmode")
if ( capmode.get_name() ~= "P") then
print("Not in Program mode!")
end
-- check that flash is disabled
if ( get_flash_mode() ~= 2) then
error("Flash not disabled!")
end
function logline()
local fname='A/log.csv'
local st=os.stat(fname)
local f=io.open(fname,'ab')
local CCD=1
local OPTICAL=0
if not st then
f:write('date,exp,ccd temp,opt temp,vbatt\n')
end
f:write(string.format('%s,%d,%d,%d,%d\n',os.date('%m/%d/%Y %H:%M:%S'),get_exp_count(),get_temperature(CCD),get_temperature(OPTICAL),get_vbatt()))
f:close()
end
function init()
require("hookutil")--import hook utils
hook_shoot.set(10000)--enable hook
end
--main loop in this function
function dark_shot(tv_direct)
--enable or disable dark frame subtraction, which doubles time over 2/3sec
set_raw_nr(RAW_NR_OFF)
--set the time as a tv direct value, where 0=1sec, for the first shot
--must be in 'P' mode
set_tv96_direct(tv_direct)
--do preshot
press('shoot_half')
--and wait until shooting settings are ready
repeat sleep(10) until get_shooting() == true
press('shoot_full_only')
for n=1,4 do
hook_shoot.wait_ready()
--close mecha shutter for dark frame
closeshutter()
logline()
print(n,'starting')
--exposure starts here
hook_shoot.continue()
end
release('shoot_full')
-- allow final shot to end before restore + possible shutdown
repeat sleep(10) until not get_shooting()
sleep(1000)
end
--main control
init()
--delay
sleep(2000)
tv_sec_tot=1--total time in seconds
tv96_tot=usec_to_tv96(tv_sec_tot*1000000)
dark_shot(tv96_tot)
--record last temp
logline()
--cleanup
hook_shoot.set(0)
It's loosely based on your fixedint script, which btw crashed on my SX50 when using long intervals.
Anyhow, this one is running on SD1200.