--[[ ****************************** Licence: GPL (c) fudgey 2011/02/12 rework msl 2012/08/24 ****************************** @title Mehrfachbelichtung Shoots a long exposure with shutter opened shortly at instants specified by USB remote presses, for time specified by the user. The default a 8 second shoot with 100 ms (1/10 s) exposures. Inputs: total Tv (s) -- total exposure time in APEX units, meaning 0 is 1 s, -1 is 2 s, -2 is 4 s etc. Tv (10 ms) -- exposure time of each subexposure, in multiplies of 10 ms (10 for 1/10 s, 20 for 1/5 s, 100 for 1 s etc). The script does not change ISO, aperture, ND filter state or focus mode. Canon manual modes or CHDK overrides should be used to set these. @param a total Tv @default a 3 @values a 1s 2s 4s 8s 16s @param b Tv (*10 ms) @default b 10 --]] if a >0 then a = a * -1 end exptime=b*10 propcase=require("propcase") -- Register shutter control event procs depending on os and define functions -- openshutter() and closeshutter() to control mechanical shutter. function init() -- check for native call interface: if (type(call_event_proc) ~= "function" ) then error("CHDK unterstützt Native Calls nicht.") end local bi=get_buildinfo() if bi.os=="vxworks" then closeproc="CloseMShutter" openproc="OpenMShutter" if (call_event_proc("InitializeAdjustmentFunction") == -1) then error("InitAdjFunc gescheitert") end elseif bi.os=="dryos" then closeproc="CloseMechaShutter" openproc="OpenMechaShutter" if (call_event_proc("Mecha.Create") == -1) then error("Mecha.Create gescheitert") end else error("unbekanntes OS:" .. bi.os) end -- close mechanical shutter function closeshutter() if (call_event_proc(closeproc) == -1) then print("Schließe Verschluss gescheitert") end end -- open mechanical shutter function openshutter() if (call_event_proc(openproc) == -1) then print("Öffne Verschluss gescheitert") end end -- test for still photo rec mode: rec,vid=get_mode() if rec ~= true then error("Kein Aufnahmemodus") elseif vid == true then error("Video wird nicht unterstützt.") end end -- init() -- store current exposure params (to be called during half shoot, after autoexposure has finished) function get_exposure_params() tv96=get_prop(propcase.TV) -- exposure time sv96=get_prop(propcase.SV) -- ISO if get_nd_present() ~= 0 then -- aperture if camera has iris av96=get_prop(propcase.AV) end end -- set previously saved exposure params (to be called during half shoot, after autoexposure has finished) function set_exposure_params() set_prop(propcase.TV,tv96) -- exposure time set_prop(propcase.SV,sv96) -- ISO if get_nd_present() ~= 0 then -- aperture if camera has iris set_prop(propcase.AV,av96) end end -- script starts here init() -- half shoot and wait for autoexposure (if disabled, it'll finish real fast) press("shoot_half") repeat sleep(10) until get_shooting() == true get_exposure_params() -- store exposure params (we now have tv96 variable) tv96=a*96 set_exposure_params() -- set overrides -- wait for usb remote to start shooting print("Warte auf Fernbedienung") repeat sleep(10) until (is_pressed("remote") == true) press("shoot_full") -- start shooting by fully pressing the shutter tstart=get_tick_count() -- store exposure start time release("shoot_full") -- release shutter button sleep(10) release("shoot_half") -- while shooting is still in progress, take short exposures by opening and closing mechanical shutter repeat -- delay until user requested exposure time has passed and then close the shutter repeat sleep(10) until (get_tick_count() - tstart ) >= exptime closeshutter() -- wait for usb shutter press to stop (for users with slow hands and fast exposure times) repeat sleep(10) until is_pressed("remote") == false -- wait for usb shutter press to trigger an exposure (or until camera stops shooting) repeat sleep(10) until (is_pressed("remote") == true) or (get_shooting() ~= true) -- start next exposure only if camera is still shooting if get_shooting() == true then openshutter() tstart=get_tick_count() -- store exposure start time end until get_shooting() ~= true print("fertig")