Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/Tools/CHDK-Scripts/Cannon SX260/3DR_EAI_SX260.lua
Views: 1799
1--[[23KAP UAV Exposure Control Script v3.14-- Released under GPL by waterwingz and wayback/peabody5http://chdk.wikia.com/wiki/KAP_%26_UAV_Exposure_Control_Script673DR EAI 1.0 is a fork of KAP 3.1 with settings specific to Canon cameras triggered off the Pixhawk autopilot.8Changelog:9-Modified Tv, Av, and ISO settings for the Canon SX26010-Added an option to turn the GPS on and off11-Added control of GPS settings in Main Loop12-Changed USB OneShot mode to listen for 100ms command pulse from Pixhawk1314@title 3DR EAI 1.0 - Lets Map!15@param i Shot Interval (sec)16@default i 217@range i 2 12018@param s Total Shots (0=infinite)19@default s 020@range s 0 1000021@param j Power off when done?22@default j 023@range j 0 124@param e Exposure Comp (stops)25@default e 626@values e -2.0 -1.66 -1.33 -1.0 -0.66 -0.33 0.0 0.33 0.66 1.00 1.33 1.66 2.0027@param d Start Delay Time (sec)28@default d 029@range d 0 1000030@param y Tv Min (sec)31@default y 532@values y None 1/60 1/100 1/200 1/400 1/64033@param t Target Tv (sec)34@default t 735@values t 1/100 1/200 1/400 1/640 1/800 1/1000 1/1250 1/1600 1/200036@param x Tv Max (sec)37@default x 438@values x 1/1000 1/1250 1/1600 1/2000 1/3200 1/5000 1/1000039@param f Av Low(f-stop)40@default f 641@values f 1.8 2.0 2.2 2.6 2.8 3.2 3.5 4.0 4.5 5.0 5.6 6.3 7.1 8.042@param a Av Target (f-stop)43@default a 744@values a 1.8 2.0 2.2 2.6 2.8 3.2 3.5 4.0 4.5 5.0 5.6 6.3 7.1 8.045@param m Av Max (f-stop)46@default m 1347@values m 1.8 2.0 2.2 2.6 2.8 3.2 3.5 4.0 4.5 5.0 5.6 6.3 7.1 8.048@param p ISO Min49@default p 050@values p 80 100 200 400 800 1250 160051@param q ISO Max152@default q 153@values q 100 200 400 800 1250 160054@param r ISO Max255@default r 356@values r 100 200 400 800 1250 160057@param n Allow use of ND filter?58@default n 059@values n No Yes60@param z Zoom position61@default z 062@values z Off 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%63@param c Focus @ Infinity Mode64@default c 365@values c None @Shot AFL MF66@param v Video Interleave (shots)67@default v 068@values v Off 1 5 10 25 50 10069@param w Video Duration (sec)70@default w 1071@range w 5 30072@param u Trigger Type73@default u 274@values u Interval Cont. USB PWM75@param g GPS On76@default g 177@range g 0 178@param b Backlight Off?79@default b 180@range b 0 181@param l Logging82@default l 383@values l Off Screen SDCard Both84--]]8586props=require("propcase")87capmode=require("capmode")8889-- convert user parameter to usable variable names and values90tv_table = { -320, 576, 640, 736, 832, 896, 928, 960, 992, 1024, 1056, 1113, 1180, 1276}91tv96target = tv_table[t+3]92tv96max = tv_table[x+8]93tv96min = tv_table[y+1]94sv_table = { 381, 411, 507, 603, 699, 761, 795 }95sv96min = sv_table[p+1]96sv96max1 = sv_table[q+2]97sv96max2 = sv_table[r+2]98av_table = { 171, 192, 218, 265, 285, 322, 347, 384, 417, 446, 477, 510, 543, 576 }99av96target = av_table[a+1]100av96minimum = av_table[f+1]101av96max = av_table[m+1]102ec96adjust = (e - 6)*32103video_table = { 0, 1, 5, 10, 25, 50, 100 }104video_mode = video_table[v+1]105video_duration = w106interval = i*1000107max_shots = s108poff_if_done = j109start_delay = d110backlight = b111log_mode= l112focus_mode = c113usb_mode = u114gps = g115if ( z==0 ) then zoom_setpoint = nil else zoom_setpoint = (z-1)*10 end116117-- initial configuration values118nd96offset=3*96 -- ND filter's number of equivalent f-stops (f * 96)119infx = 50000 -- focus lock distance in mm (approximately 55 yards)120shot_count = 0 -- shot counter121blite_timer = 300 -- backlight off delay in 100mSec increments122old_console_timeout = get_config_value( 297 )123shot_request = false -- pwm mode flag to request a shot be taken124125-- check camera Av configuration ( variable aperture and/or ND filter )126if n==0 then -- use of nd filter allowed?127if get_nd_present()==1 then -- check for ND filter only128Av_mode = 0 -- 0 = ND disabled and no iris available129else130Av_mode = 1 -- 1 = ND disabled and iris available131end132else133Av_mode = get_nd_present()+1 -- 1 = iris only , 2=ND filter only, 3= both ND & iris134end135136function printf(...)137if ( log_mode == 0) then return end138local str=string.format(...)139if (( log_mode == 1) or (log_mode == 3)) then print(str) end140if ( log_mode > 1 ) then141local logname="A/3DR_EAI_log.log"142log=io.open(logname,"a")143log:write(os.date("%Y%b%d %X ")..string.format(...),"\n")144log:close()145end146end147148tv_ref = { -- note : tv_ref values set 1/2 way between shutter speed values149-608, -560, -528, -496, -464, -432, -400, -368, -336, -304,150-272, -240, -208, -176, -144, -112, -80, -48, -16, 16,15148, 80, 112, 144, 176, 208, 240, 272, 304, 336,152368, 400, 432, 464, 496, 528, 560, 592, 624, 656,153688, 720, 752, 784, 816, 848, 880, 912, 944, 976,1541008, 1040, 1072, 1096, 1129, 1169, 1192, 1225, 1265, 1376 }155156tv_str = {157">64",158"64", "50", "40", "32", "25", "20", "16", "12", "10", "8.0",159"6.0", "5.0", "4.0", "3.2", "2.5", "2.0", "1.6", "1.3", "1.0", "0.8",160"0.6", "0.5", "0.4", "0.3", "1/4", "1/5", "1/6", "1/8", "1/10", "1/13",161"1/15", "1/20", "1/25", "1/30", "1/40", "1/50", "1/60", "1/80", "1/100", "1/125",162"1/160", "1/200", "1/250", "1/320", "1/400", "1/500", "1/640", "1/800", "1/1000","1/1250",163"1/1600","1/2000","1/2500","1/3200","1/4000","1/5000","1/6400","1/8000","1/10000","hi" }164165function print_tv(val)166if ( val == nil ) then return("-") end167local i = 1168while (i <= #tv_ref) and (val > tv_ref[i]) do i=i+1 end169return tv_str[i]170end171172av_ref = { 160, 176, 208, 243, 275, 304, 336, 368, 400, 432, 464, 480, 496, 512, 544, 592, 624, 656, 688, 720, 752, 784 }173av_str = {"n/a","1.8", "2.0","2.2","2.6","2.8","3.2","3.5","4.0","4.5","5.0","5.6","5.9","6.3","7.1","8.0","9.0","10.0","11.0","13.0","14.0","16.0","hi"}174175function print_av(val)176if ( val == nil ) then return("-") end177local i = 1178while (i <= #av_ref) and (val > av_ref[i]) do i=i+1 end179return av_str[i]180end181182sv_ref = { 370, 397, 424, 456, 492, 523, 555, 588, 619, 651, 684, 731, 779, 843, 907 }183sv_str = {"n/a","80","100","120","160","200","250","320","400","500","640","800","1250","1600","3200","hi"}184185function print_sv(val)186if ( val == nil ) then return("-") end187local i = 1188while (i <= #sv_ref) and (val > sv_ref[i]) do i=i+1 end189return sv_str[i]190end191192function pline(message, line) -- print line function193fg = 258 bg=259194195end196197-- switch between shooting and playback modes198function switch_mode( m )199if ( m == 1 ) then200if ( get_mode() == false ) then201set_record(1) -- switch to shooting mode202while ( get_mode() == false ) do203sleep(100)204end205sleep(1000)206end207else208if ( get_mode() == true ) then209set_record(0) -- switch to playback mode210while ( get_mode() == true ) do211sleep(100)212end213sleep(1000)214end215end216end217218-- focus lock and unlock219function lock_focus()220if (focus_mode > 1) then -- focus mode requested ?221if ( focus_mode == 2 ) then -- method 1 : set_aflock() command enables MF222if (chdk_version==120) then223set_aflock(1)224set_prop(props.AF_LOCK,1)225else226set_aflock(1)227end228if (get_prop(props.AF_LOCK) == 1) then printf(" AFL enabled") else printf(" AFL failed ***") end229else -- mf mode requested230if (chdk_version==120) then -- CHDK 1.2.0 : call event proc or levents to try and enable MF mode231if call_event_proc("SS.Create") ~= -1 then232if call_event_proc("SS.MFOn") == -1 then233call_event_proc("PT_MFOn")234end235elseif call_event_proc("RegisterShootSeqEvent") ~= -1 then236if call_event_proc("PT_MFOn") == -1 then237call_event_proc("MFOn")238end239end240if (get_prop(props.FOCUS_MODE) == 0 ) then -- MF not set - try levent PressSw1AndMF241post_levent_for_npt("PressSw1AndMF")242sleep(500)243end244elseif (chdk_version >= 130) then -- CHDK 1.3.0 : set_mf()245if ( set_mf(1) == 0 ) then set_aflock(1) end -- as a fall back, try setting AFL is set_mf fails246end247if (get_prop(props.FOCUS_MODE) == 1) then printf(" MF enabled") else printf(" MF enable failed ***") end248end249sleep(1000)250set_focus(infx)251sleep(1000)252end253end254255function unlock_focus()256if (focus_mode > 1) then -- focus mode requested ?257if (focus_mode == 2 ) then -- method 1 : AFL258if (chdk_version==120) then259set_aflock(0)260set_prop(props.AF_LOCK,0)261else262set_aflock(0)263end264if (get_prop(props.AF_LOCK) == 0) then printf(" AFL unlocked") else printf(" AFL unlock failed") end265else -- mf mode requested266if (chdk_version==120) then -- CHDK 1.2.0 : call event proc or levents to try and enable MF mode267if call_event_proc("SS.Create") ~= -1 then268if call_event_proc("SS.MFOff") == -1 then269call_event_proc("PT_MFOff")270end271elseif call_event_proc("RegisterShootSeqEvent") ~= -1 then272if call_event_proc("PT_MFOff") == -1 then273call_event_proc("MFOff")274end275end276if (get_prop(props.FOCUS_MODE) == 1 ) then -- MF not reset - try levent PressSw1AndMF277post_levent_for_npt("PressSw1AndMF")278sleep(500)279end280elseif (chdk_version >= 130) then -- CHDK 1.3.0 : set_mf()281if ( set_mf(0) == 0 ) then set_aflock(0) end -- fall back so reset AFL is set_mf fails282end283if (get_prop(props.FOCUS_MODE) == 0) then printf(" MF disabled") else printf(" MF disable failed") end284end285sleep(100)286end287end288289-- zoom position290function update_zoom(zpos)291local count = 0292if(zpos ~= nil) then293zstep=((get_zoom_steps()-1)*zpos)/100294printf("setting zoom to "..zpos.." percent step="..zstep)295sleep(200)296set_zoom(zstep)297sleep(2000)298press("shoot_half")299repeat300sleep(100)301count = count + 1302until (get_shooting() == true ) or (count > 40 )303release("shoot_half")304end305end306307-- restore camera settings on shutdown308function restore()309set_config_value(121,0) -- USB remote disable310set_config_value(297,old_console_timeout) -- restore console timeout value311if (backlight==1) then set_lcd_display(1) end -- display on312unlock_focus()313if( zoom_setpoint ~= nil ) then update_zoom(0) end314if( shot_count >= max_shots) and ( max_shots > 1) then315if ( poff_if_done == 1 ) then -- did script ending because # of shots done ?316printf("power off - shot count at limit") -- complete power down317sleep(2000)318post_levent_to_ui('PressPowerButton')319else320set_record(0) end -- just retract lens321end322end323324-- Video mode325function check_video(shot)326local capture_mode327if ((video_mode>0) and(shot>0) and (shot%video_mode == 0)) then328unlock_focus()329printf("Video mode started. Button:"..tostring(video_button))330if( video_button ) then331click "video"332else333capture_mode=capmode.get()334capmode.set('VIDEO_STD')335press("shoot_full")336sleep(300)337release("shoot_full")338end339local end_second = get_day_seconds() + video_duration340repeat341wait_click(500)342until (is_key("menu")) or (get_day_seconds() > end_second)343if( video_button ) then344click "video"345else346press("shoot_full")347sleep(300)348release("shoot_full")349capmode.set(capture_mode)350end351printf("Video mode finished.")352sleep(1000)353lock_focus()354return(true)355else356return(false)357end358end359360-- PWM USB pulse functions361362function ch1up()363printf(" * usb pulse = ch1up")364shot_request = true365end366367function ch1mid()368printf(" * usb pulse = ch1mid")369if ( get_mode() == false ) then370switch_mode(1)371lock_focus()372end373end374375function ch1down()376printf(" * usb pulse = ch1down")377switch_mode(0)378end379380function ch2up()381printf(" * usb pulse = ch2up")382update_zoom(100)383end384385function ch2mid()386printf(" * usb pulse = ch2mid")387if ( zoom_setpoint ~= nil ) then update_zoom(zoom_setpoint) else update_zoom(50) end388end389390function ch2down()391printf(" * usb pulse = ch2down")392update_zoom(0)393end394395function pwm_mode(pulse_width)396if pulse_width > 0 then397if pulse_width < 5 then ch1up()398elseif pulse_width < 8 then ch1mid()399elseif pulse_width < 11 then ch1down()400elseif pulse_width < 14 then ch2up()401elseif pulse_width < 17 then ch2mid()402elseif pulse_width < 20 then ch2down()403else printf(" * usb pulse width error") end404end405end406407-- Basic exposure calculation using shutter speed and ISO only408-- called for Tv-only and ND-only cameras (cameras without an iris)409function basic_tv_calc()410tv96setpoint = tv96target411av96setpoint = nil412local min_av = get_prop(props.MIN_AV)413-- calculate required ISO setting414sv96setpoint = tv96setpoint + min_av - bv96meter415-- low ambient light ?416if (sv96setpoint > sv96max2 ) then -- check if required ISO setting is too high417sv96setpoint = sv96max2 -- clamp at max2 ISO if so418tv96setpoint = math.max(bv96meter+sv96setpoint-min_av,tv96min) -- recalculate required shutter speed down to Tv min419-- high ambient light ?420elseif (sv96setpoint < sv96min ) then -- check if required ISO setting is too low421sv96setpoint = sv96min -- clamp at minimum ISO setting if so422tv96setpoint = bv96meter + sv96setpoint - min_av -- recalculate required shutter speed and hope for the best423end424end425426427-- Basic exposure calculation using shutter speed, iris and ISO428-- called for iris-only and "both" cameras (cameras with an iris & ND filter)429function basic_iris_calc()430tv96setpoint = tv96target431av96setpoint = av96target432-- calculate required ISO setting433sv96setpoint = tv96setpoint + av96setpoint - bv96meter434-- low ambient light ?435if (sv96setpoint > sv96max1 ) then -- check if required ISO setting is too high436sv96setpoint = sv96max1 -- clamp at first ISO limit437av96setpoint = bv96meter + sv96setpoint - tv96setpoint -- calculate new aperture setting438if ( av96setpoint < av96min ) then -- check if new setting is goes below lowest f-stop439av96setpoint = av96min -- clamp at lowest f-stop440sv96setpoint = tv96setpoint + av96setpoint - bv96meter -- recalculate ISO setting441if (sv96setpoint > sv96max2 ) then -- check if the result is above max2 ISO442sv96setpoint = sv96max2 -- clamp at highest ISO setting if so443tv96setpoint = math.max(bv96meter+sv96setpoint-av96setpoint,tv96min) -- recalculate required shutter speed down to tv minimum444end445end446-- high ambient light ?447elseif (sv96setpoint < sv96min ) then -- check if required ISO setting is too low448sv96setpoint = sv96min -- clamp at minimum ISO setting if so449tv96setpoint = bv96meter + sv96setpoint - av96setpoint -- recalculate required shutter speed450if (tv96setpoint > tv96max ) then -- check if shutter speed now too fast451tv96setpoint = tv96max -- clamp at maximum shutter speed if so452av96setpoint = bv96meter + sv96setpoint - tv96setpoint -- calculate new aperture setting453if ( av96setpoint > av96max ) then -- check if new setting is goes above highest f-stop454av96setpoint = av96max -- clamp at highest f-stop455tv96setpoint = bv96meter + sv96setpoint - av96setpoint -- recalculate shutter speed needed and hope for the best456end457end458end459end460461-- calculate exposure for cams without adjustable iris or ND filter462function exposure_Tv_only()463insert_ND_filter = nil464basic_tv_calc()465end466467-- calculate exposure for cams with ND filter only468function exposure_NDfilter()469insert_ND_filter = false470basic_tv_calc()471if (tv96setpoint > tv96max ) then -- check if shutter speed now too fast472insert_ND_filter = true -- flag the ND filter to be inserted473bv96meter = bv96meter - nd96offset -- adjust meter for ND offset474basic_tv_calc() -- start over, but with new meter value475bv96meter = bv96meter + nd96offset -- restore meter for later logging476end477end478479-- calculate exposure for cams with adjustable iris only480function exposure_iris()481insert_ND_filter = nil482basic_iris_calc()483end484485-- calculate exposure for cams with both adjustable iris and ND filter486function exposure_both()487insert_ND_filter = false -- NOTE : assume ND filter never used automatically by Canon firmware488basic_iris_calc()489if (tv96setpoint > tv96max ) then -- check if shutter speed now too fast490insert_ND_filter = true -- flag the ND filter to be inserted491bv96meter = bv96meter - nd96offset -- adjust meter for ND offset492basic_iris_calc() -- start over, but with new meter value493bv96meter = bv96meter + nd96offset -- restore meter for later logging494end495end496497-- ========================== Main Program =================================498499set_console_layout(1 ,1, 45, 14 )500501--printf("KAP 3.1 started - press MENU to exit")502printf("3DR EAI 1.0 Canon SX260 - Lets Map!")503printf("Based On KAP 3.1")504printf("Press the shutter button to pause")505bi=get_buildinfo()506printf("%s %s-%s %s %s %s", bi.version, bi.build_number, bi.build_revision, bi.platform, bi.platsub, bi.build_date)507chdk_version= tonumber(string.sub(bi.build_number,1,1))*100 + tonumber(string.sub(bi.build_number,3,3))*10 + tonumber(string.sub(bi.build_number,5,5))508if ( tonumber(bi.build_revision) > 0 ) then509build = tonumber(bi.build_revision)510else511build = tonumber(string.match(bi.build_number,'-(%d+)$'))512end513514if ((chdk_version<120) or ((chdk_version==120)and(build<3276)) or ((chdk_version==130)and(build<3383))) then515printf("CHDK 1.2.0 build 3276 or higher required")516else517if( props.CONTINUOUS_AF == nil ) then caf=-999 else caf = get_prop(props.CONTINUOUS_AF) end518if( props.SERVO_AF == nil ) then saf=-999 else saf = get_prop(props.SERVO_AF) end519cmode = capmode.get_name()520printf("Mode:%s,Continuous_AF:%d,Servo_AF:%d", cmode,caf,saf)521printf(" Tv:"..print_tv(tv96target).." max:"..print_tv(tv96max).." min:"..print_tv(tv96min).." ecomp:"..(ec96adjust/96).."."..(math.abs(ec96adjust*10/96)%10) )522printf(" Av:"..print_av(av96target).." minAv:"..print_av(av96minimum).." maxAv:"..print_av(av96max) )523printf(" ISOmin:"..print_sv(sv96min).." ISO1:"..print_sv(sv96max1).." ISO2:"..print_sv(sv96max2) )524printf(" MF mode:"..focus_mode.." Video:"..video_mode.." USB:"..usb_mode)525printf(" AvM:"..Av_mode.." int:"..(interval/1000).." Shts:"..max_shots.." Dly:"..start_delay.." B/L:"..backlight)526sleep(500)527528if (start_delay > 0 ) then529printf("entering start delay of ".. start_delay.." seconds")530sleep( start_delay*1000 )531end532533-- CAMERA CONFIGURATION -534-- FIND config table here http://subversion.assembla.com/svn/chdk/trunk/core/conf.c535set_config_value(2,0) --Save raw: off536if (gps==1) then537set_config_value(282,1) --turn GPS on538--set_config_value(278,1) --show GPS symbol539set_config_value(261,1) --wait for signal time540set_config_value(266,5) --battery shutdown percentage541end542543-- enable USB remote in USB remote moded544if (usb_mode > 0 ) then545set_config_value(121,1) -- make sure USB remote is enabled546if (get_usb_power(1) == 0) then -- can we start ?547printf("waiting on USB signal")548repeat wait_click(20) until ((get_usb_power(1) == 1) or ( is_key("menu")))549--changed sleep from 1000 to 500550else sleep(500) end551printf("USB signal received")552end553554-- switch to shooting mode555switch_mode(1)556557-- set zoom position558update_zoom(zoom_setpoint)559-- lock focus at infinity560lock_focus()561-- disable flash and AF assist lamp562set_prop(props.FLASH_MODE, 2) -- flash off563set_prop(props.AF_ASSIST_BEAM,0) -- AF assist off if supported for this camera564set_config_value( 297, 60) -- set console timeout to 60 seconds565566if (usb_mode > 2 ) then repeat until (get_usb_power(2) == 0 ) end -- flush pulse buffer567next_shot_time = get_tick_count()568script_exit = false569if( get_video_button() == 1) then video_button = true else video_button = false end570set_console_layout(2 ,0, 45, 4 )571repeat572--BB: Set get_usb_power(2) > 7 for a 70/100s pulse573--BB: Could consider a max threshold to prevent erroneous trigger events574--eg. get_usb_power(2) > 7 && get_usb_power(2) < 13575if( ( (usb_mode < 2 ) and ( next_shot_time <= get_tick_count() ) )576or ( (usb_mode == 2 ) and (get_usb_power(2) > 7 ) )577or ( (usb_mode == 3 ) and (shot_request == true ) ) ) then578579-- time to insert a video sequence ?580if( check_video(shot_count) == true) then next_shot_time = get_tick_count() end581582-- intervalometer timing583next_shot_time = next_shot_time + interval584585-- set focus at infinity ? (maybe redundant for AFL & MF mode but makes sure it's set right)586if (focus_mode > 0) then587set_focus(infx)588sleep(100)589end590591-- check exposure592local count = 0593local timeout = false594press("shoot_half")595repeat596sleep(50)597count = count + 1598if (count > 40 ) then timeout = true end599until (get_shooting() == true ) or (timeout == true)600601-- shoot in auto mode if meter reading invalid, else calculate new desired exposure602if ( timeout == true ) then603release("shoot_half")604repeat sleep(50) until get_shooting() == false605shoot() -- shoot in Canon auto mode if we don't have a valid meter reading606shot_count = shot_count + 1607printf(string.format('IMG_%04d.JPG',get_exp_count()).." : shot in auto mode, meter reading invalid")608else609-- get meter reading values (and add in exposure compensation)610bv96raw=get_bv96()611bv96meter=bv96raw-ec96adjust612tv96meter=get_tv96()613av96meter=get_av96()614sv96meter=get_sv96()615616-- set minimum Av to larger of user input or current min for zoom setting617av96min= math.max(av96minimum,get_prop(props.MIN_AV))618if (av96target < av96min) then av96target = av96min end619620-- calculate required setting for current ambient light conditions621if (Av_mode == 1) then exposure_iris()622elseif (Av_mode == 2) then exposure_NDfilter()623elseif (Av_mode == 3) then exposure_both()624else exposure_Tv_only()625end626627-- set up all exposure overrides628set_tv96_direct(tv96setpoint)629set_sv96(sv96setpoint)630if( av96setpoint ~= nil) then set_av96_direct(av96setpoint) end631632if(Av_mode > 1) and (insert_ND_filter == true) then -- ND filter available and needed?633set_nd_filter(1) -- activate the ND filter634nd_string="NDin"635else636set_nd_filter(2) -- make sure the ND filter does not activate637nd_string="NDout"638end639640-- and finally shoot the image641press("shoot_full_only")642sleep(100)643release("shoot_full")644repeat sleep(50) until get_shooting() == false645shot_count = shot_count + 1646647-- update shooting statistic and log as required648shot_focus=get_focus()649if(shot_focus ~= -1) and (shot_focus < 20000) then650focus_string=" foc:"..(shot_focus/1000).."."..(((shot_focus%1000)+50)/100).."m"651if(focus_mode>0) then652error_string=" **WARNING : focus not at infinity**"653end654else655focus_string=" foc:infinity"656error_string=nil657end658printf(string.format('%d) IMG_%04d.JPG',shot_count,get_exp_count()))659printf(" meter : Tv:".. print_tv(tv96meter) .." Av:".. print_av(av96meter) .." Sv:"..print_sv(sv96meter).." "..bv96raw ..":"..bv96meter)660printf(" actual: Tv:".. print_tv(tv96setpoint).." Av:".. print_av(av96setpoint).." Sv:"..print_sv(sv96setpoint))661printf(" AvMin:".. print_av(av96min).." NDF:"..nd_string..focus_string )662663if ((max_shots>0) and (shot_count >= max_shots)) then script_exit = true end664665shot_request = false -- reset shot request flag666667end668collectgarbage()669end670671-- check if USB remote enabled in intervalometer mode and USB power is off -> pause if so672if ((usb_mode == 1 ) and (get_usb_power(1) == 0)) then673printf("waiting on USB signal")674unlock_focus()675switch_mode(0)676repeat wait_click(20) until ((get_usb_power(1) == 1) or ( is_key("menu")))677switch_mode(1)678lock_focus()679if ( is_key("menu")) then script_exit = true end680printf("USB wait finished")681sleep(100)682end683684if (usb_mode == 3 ) then pwm_mode(get_usb_power(2)) end685686if (blite_timer > 0) then687blite_timer = blite_timer-1688if ((blite_timer==0) and (backlight==1)) then set_lcd_display(0) end689end690691if( error_string ~= nil) then692draw_string( 16, 144, string.sub(error_string.." ",0,42), 258, 259)693end694695wait_click(100)696697if( not( is_key("no_key"))) then698if ((blite_timer==0) and (backlight==1)) then set_lcd_display(1) end699blite_timer=300700if ( is_key("menu") ) then script_exit = true end701end702703until (script_exit==true)704printf("script halt requested")705restore()706end707708--[[ end of file ]]--709710711712713