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
I just want to quickly shoot a sequence of dark frames, but it stops after two shots and exp count is wrong (known bug). What am I doing wrong here?
Edit: it might be because shooting and script run in parallel and I need to be careful of where they get in sync.
--[[@title dark by temp]] --log dark frames--by jmac698--all initialization and error checking is in this part-- RAW_NR_AUTO=0RAW_NR_OFF=1RAW_NR_ON=2RAW_OFF=0RAW_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") endelseif 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") endend else error("Unknown OS:" .. bi.os)end -- close mechanical shutterfunction closeshutter() if (call_event_proc(closeproc) == -1) then print("closeshutter failed") endend-- open mechanical shutterfunction openshutter() if (call_event_proc(openproc) == -1) then print("openshutter failed") endend -- switch to record mode if necessaryif ( get_mode() == false ) then print("switching to record mode") sleep(1000) set_record(1) while ( get_mode() == false) do sleep(100) endend-- make sure we are in P modecapmode=require("capmode")if ( capmode.get_name() ~= "P") then print("Not in Program mode!")end-- check that flash is disabledif ( 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 hookend--main loop in this functionfunction 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 controlinit()--delaysleep(2000)tv_sec_tot=1--total time in secondstv96_tot=usec_to_tv96(tv_sec_tot*1000000)dark_shot(tv96_tot)--record last templogline()--cleanuphook_shoot.set(0)
date,tick,exp,exp_start,sleep,vbatt,tsensor,topt,free_mem,lua_mem,desc09/06/2016 15:57:20,107980,1905,103260,,4037,32,32,800464,106,fixedint v:1.2 / platform:ixus95_sd1200-100c-1.4.1-4634 May 27 2016 22:28:02 / interval:0 / taking darks / cont_mode / sd:494 af_ok:true fl:6200 efl:35000 zoom_pos:0 / sv96:371 tv96:-192 av96:292
I can update the firmware and try again. All I know so far is that darks seem to work, but it doesn't take enough pictures.updated with ixus95_sd1200-100c-1.5.0-4682-full, set #shots to 4, it stopped at just one. However, I set it to unlimited, now it's working.
What would be helpful, is if I knew the code worked to begin with. Could you test it on one of your cameras?
Thanks for testing this, that code was based on theory from learning from your fixint and the answers you gave me about it, very helpful! I'm glad I now know how to do the continuous mode loop, just wish my camera was reliable with it.
Started by LjL General Chat
Started by Nocturnal Script Writing
Started by yardleydobon RAW Shooting and Processing
Started by neg273 General Help and Assistance on using CHDK stable releases
Started by axman Script Writing