--[[ ******************************** exp_log.lua Dieses Script bietet ein Menue zum Einstellen von Tv und loggt den Bildnamen zusammen mit den APEX-Parametern in eine Datei. Ausgeloest wird mit 'SET'-Taste. Ausloesung erfolg verzoegert (zum Ausschwingen). Licence: GPL AaTeWe 05/2011 zusammengeklaubt aus den folgenden scripts: - conf_rw.lua - br_h_new.lua - tv-mode.lua Thx: msl et al. ******************************** @title Exposure Log @param a Tv_Id Anfangswert (-12 entspricht 16 Sek.) @default a -12 @param b Delay vor shoot @default b 3 ]] --******************************* -- Texte --******************************* txt_keys = " [\18] [Set] [MENU]" txt_decl = " Auswahl Trigger Ende" txt_line = "-----------------------" --******************************* -- Funktionen --******************************* --******************************* -- print_tv(Id) --******************************* function print_tv(Id) tv_output = {"1625","1290","1024","812","645","512","406","322","256","203","161", "128","101","80","64","50","40","32","25","20","15","13","10","8","6","5","4", "3.2","2.5","2","1.6","1.3","1","0.8","0.6","0.5","0.4","0.3","1/4","1/5", "1/6","1/8","1/10","1/13","1/15","1/20","1/25","1/30","1/40","1/50","1/60", "1/80","1/100","1/125","1/160","1/200","1/250","1/320","1/400","1/500", "1/640","1/800","1/1000","1/1250","1/1600","1/2000","1/2500","1/3200", "1/4000","1/5000","1/6400","1/8000","1/10000", "1/12500","1/16000", "1/20000","1/25000","1/32000","1/40000","1/50000"} return " Tv_Id = "..Id.." Tv = "..tv_output[Id + 33].."s" end --******************************* -- log_name() --******************************* function log_name() log_path = "A/CHDK/LOGS/" log_file_name = "exlog_" log_file_ending = ".log" log_name = log_path..log_file_name..log_file_ending logfile=io.open(log_name,"wb") io.output(logfile) end --******************************* -- log() --******************************* function log(...) io.write(...) io.write("\n") end --******************************* -- delay() --******************************* function delay(sec) repeat cls() print("Start in ", sec, "Sekunden") sleep(960) sec = sec - 1 until sec==0 cls() end --******************************* -- fastshoot() --******************************* function fastshoot() press("shoot_half") repeat sleep(1) until get_shooting() == true press("shoot_full") release("shoot_full") release("shoot_half") repeat sleep(1) until get_shooting() ~= true end --******************************* -- log_apex_info() --******************************* function log_apex_info() Bv=get_bv96() Av=get_av96() Sv=get_sv96() Tv=get_tv96() local timeString2 = print_tv(Tv_Id) log("Bv=", Bv," Sv=", Sv, " Av=", Av, " Tv=", Tv, timeString2) end --******************************* -- getImageDirs() --******************************* function getImageDirs() local dcimList = os.listdir("A/DCIM", false) local i=1 if(dcimList) then table.sort(dcimList) -- while i<=#dcimList do -- if string.upper(string.sub(dcimList[i],4))~="CANON" then -- table.remove(dcimList,i) -- else i=i+1 end -- end end return dcimList end --******************************* -- getImageList() --******************************* function getImageList() local imgTable = {} local dcimList = getImageDirs() local dirCount = table.getn(dcimList) local i = 0 while ( dirCount ~= i) do i = i + 1 local imgDirList = os.listdir("A/DCIM/"..dcimList[i], false) local imgCount = table.getn(imgDirList) table.sort(imgDirList) local a = 0 while (imgCount ~= a) do a = a + 1 table.insert(imgTable,"A/DCIM/"..dcimList[i].."/"..imgDirList[a]) end end return imgTable end --******************************* -- filter() --******************************* function filter(searchString) local imageList = getImageList() local count = table.getn(imageList) local i = 0 while i ~= count do i = i + 1 if(string.find(imageList[i],searchString,17, true) == nil) then table.remove(imageList,i) i = i - 1 count = count - 1 end end return imageList end --******************************* -- last_jpg() --******************************* function last_jpg() list_jpg = filter("JPG") count_jpg = table.getn(list_jpg) log("Datei: ", list_jpg[count_jpg]) end --******************************* -- rename_log() --******************************* function rename_log() log_num = 1 while os.stat(log_path..log_file_name..log_num..log_file_ending) do log_num = log_num + 1 end os.rename(log_name, log_path..log_file_name..log_num..log_file_ending) end --******************************* -- set_shoot_and_log() --******************************* function set_shoot_and_log(tv) set_tv96_direct(tv) fastshoot() -- log("\nBild:") delay(2) last_jpg() log_apex_info() end --******************************* -- restore() --******************************* function restore() logfile:close() rename_log() set_console_layout(0, 0, 25, 5) set_console_autoredraw(1) cls() end function menu() while true do cls() local timeString = print_tv(Tv_Id) print(txt_keys) print(txt_decl) print(txt_line) print(timeString) print(txt_line) console_redraw() wait_click(0) if is_pressed("down") then Tv_Id = Tv_Id - 1 sleep(100) elseif is_pressed("up") then Tv_Id = Tv_Id + 1 sleep(100) elseif is_pressed("set") then delay(delay_time) set_shoot_and_log(Tv_Id * 32) sleep(1000) elseif is_pressed("menu") then cls() break end end end --******************************* --************* MAIN ************ --******************************* --Parameter Check & Default if a < -50 or a > -15 then a = -15 end if b < 1 or b > 10 then b = 5 end --Define & set variables Tv_Id = a delay_time = b --MAIN log_name() log("Exposure Log ", os.date("%d.%m.%Y %X\n")) local bi= get_buildinfo() log("Build Info: platform:", bi.platform, " platsub: " , bi.platsub, " version: ",bi.version , " build_number: ", bi.build_number , " build_date: ",bi.build_date , " build_time: ", bi.build_time) log("") set_console_layout(8, 3, 33, 10) set_console_autoredraw(0) menu() sleep(1000) restore()