Hallo und willkommen,
für die Bewegungserkennung muss das Display zwingend an sein, sonst funktioniert diese Erkennung nicht.
Gruß msl
Maddin hat geschrieben:...Und weiss jemand warum das Display an bleiben muss ?
md_detect_motion a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p
if h>0 then
click "shoot_full"
bla bla bla
endif
md_detect_motion a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p
if h>0 then click "shoot_full"
while Q=4
gosub "##foc"
Q=(get_tv96>768)
md_detect_motion 5-Q,5+Q,1,4*Q*t,t,99,3,Q,Q+1,2,2,1,3, Q ,Q,Q
Q=4*(Q=0)
wend
rem get_tv96>768 löst ab s/250 aus, Q=get_tv96<768 bis s/250
rem ? Q= () * (get_focus=-1)
& noch was für die Vitrine:
rem mittelfristig selbsterklärend & DAS gosub Intro für md_abc..p Anwendungen:
:##place
do
T=get_tick_count+20
md_detect_motion a,b,c,200,e,f,random 1 3,h,i,j,k,j+(a%2=0)-(a=2),k+(b%2=0)-(b=2),0,o,9
if h*(z=0)*(f<99) then print get_capture_mode,f,"(";a;"*";b;") ",h,T-get_tick_count
j=(j-is_pressed "left"+is_pressed "right"-(j>a))|(j<2)
k=(k-is_pressed "up"+is_pressed "down"-(k>b))|(k<2)
a=((a+is_pressed "zoom_in")%13)|(a<2)
b=((b+is_pressed "zoom_out")%13)|(b<2)
i=(i+is_pressed "set")%3
if is_pressed "menu" then gosub "##foc"
until is_key "shoot_half"
if i=2 then g=1 else g=3
l=j+(a%2=0)-(a=2)
m=k+(b%2=0)-(b=2)
return
:##foc
set_aflock 0
press "shoot_half"
do
sleep 99
until not get_shooting
set_aflock 1
release "shoot_half"
print get_exp_count,-get_zoom,-get_focus
sleep 999
return
:...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,....
--- reusable Intro, enjoy, Caefix 2019
--[[
-- standalone too
@param h IntroConfiguratiX Use Keys!
@default h 1
@range h 0 1
--]]--
function look(x)
set_aelock(0); set_aflock(0)
press("shoot_half")
repeat sleep(42) until not get_shooting()
set_aflock(1); set_aelock(1)
release("shoot_half")
if x>0 then -- ubasic:
-- print get_min_stack_dist;"mm",get_near_limit,-get_focus,-get_far_limit
print(get_exp_count(),-get_focus(),"-av",get_av96()/32,"-tv",get_tv96()/32) end
x=get_free_disk_space()
wait_click(999)
return x
end
function place(...)
local a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,X=... -- for scripts/calls without settings:
if a==nil then a=3 end
if b==nil then b=3 end
c=(c or 0)%6
if d==nil then d=60000 end
if e==nil then e=20 end
if f==nil then f=3 end
if g==nil then g=2 else g=g-1 end
h=0
if i==nil then i=1 end
if j==nil then j=(a+1)/2 end
if k==nil then k=(b+1)/2 end
if l==nil then l=j end
if m==nil then m=k end
n=n or 0
if o==nil then o=3 end
if p==nil then p=16 end --
X=X or 0
local ab=a+b
repeat
local a2=0; if a==2 then a2=1 end
local b2=0; if b==2 then b2=1 end
if j>a then j=a end
if k>b then k=b end
l=j+1-a%2-a2; m=k+1-b%2-b2; g=g%3+1
local T=get_tick_count()
h=md_detect_motion(a,b,1,200,e,f,g,h,i%3,j,k,l,m,0,o,9)
if (h>0) or (ab~=a+b) and (X<2) and (f<99) then
print(e,-f,"(",a,-b,")",h,T-get_tick_count())
ab=a+b
while is_pressed("shoot_half") do
sleep(42); II=II end
else console_redraw() end
wait_click(9)
if is_key("zoom_in") then a=a%12+1 end
if is_key("zoom_out") then b=b%12+1 end
if is_key("left") and j>1 then j=j-1 end
if is_key("right") and j<a then j=j+1 end
if is_key("up") and k>1 then k=k-1 end
if is_key("down") and k<b then k=k+1 end
if is_key("set") then i=(i+1)%3 end
if is_pressed("menu") then look(1) end -- oder Alt-Modus für Einstellungen verlassen.
if is_key("display") then --<< use Your key!
-- a=(a+1)/2; b=(b+1)/2 end --oder
if a>1 then a=a-1 end
if b>1 then b=b-1 end end
repeat sleep(222) until get_alt_mode()
until (h==0) and (is_key("shoot_half") or (X>0)) --!
g=3; if i==2 then g=1 end
wait_click(999); wait_click(99)
return a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p
end --V-^ keeps setting
if (h==nil) or (h>0) then --<< Use Your condition or none!
a,b,h,d,e,f,h,h,i,j,k,l,m,n,o,p= --<< new global values, use the scripts´s!!
place(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,0) end --<< old global values, use the scripts´s!!
--- :...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,....
--[[
@title mdfasap86m8k.lua
@chdk_version 1.5
@param S addshreshold 1-99
@range S 0 99
@default S 3
@param I ISO 0=A,1..7=50..
@default I 3
@values I 0 1 2 3 4 5 6 7
@param z Zoom (0=WW...8=Tele)
@default z 0
@values z 0 1 2 3 4 5 6 7 8
@param X Zoom&Grid-Adj
@default X 0
@values X 0 1
@param E man-focus-adj
@default E 0
@range E 0 1
@param W Wait4calm
@default W 0
@values W 0 1
@param maxtakes No. of takes
@default maxtakes 1
@range maxtakes 1 99
@param P pause-start (h)
@default P 0
@range P 0 23
@param Q pause-stop (h)
@default Q 0
@range Q 0 23
@param A AFassistBeam
@default A 1
@range A 0 1
@param B flash-on
@default B 0
@range B 0 1
@param L display-on
@default L 1
@range L 0 1
@param M skip if tv<100
@default M 0
@range M 0 1
@param p re-tr.dly
@range p 0 600
@default p 200
@param RAWON RAW on ?
@default RAWON 0
@range RAWON 0 1
@param t test-only
@default t 0
@range t 0 2
--]]
--
-- mdfasap ("motion detection, fast, as soon as possible") is a 2022 written lua script for experiments with CHDK motion detection
-- written by (c) joedi 2021-2023, except for the following excellent "basic_iris_calc()" function taken from CHDKPlus2.8.
-- submitted to the forum for comments
-- *******************************************
-- basic_iris_calc() is mainly taken from: (slight modif only)
-- *******************************************
-- CHDK Plus v2.8
-- Licence: GPL
-- (c) waterwingz,msl,wayback/peabody 2014
-- artistic direction provide by fabri22
-- *******************************************
-- ISO+ : BASIC EXPOSURE CALCULATION USING SHUTTER SPEED, IRIS AND ISO
-- CALLED FOR IRIS-ONLY AND "BOTH" CAMERAS
-- (CAMERAS WITH AN IRIS & ND FILTER)
function basic_iris_calc()
tv96setpoint = tv96target
av96setpoint = av96target
-- CALCULATE REQUIRED ISO SETTING
sv96setpoint = tv96setpoint + av96setpoint - bv96meter
-- modif to original function here, forcing hi iso recalc as per "I":
if (I>0) then sv96max1=99+sv_table[I+1] end -- triggs comp 3 l dwn
-- LOW AMBIENT LIGHT ?
-- CHECK IF REQUIRED ISO SETTING IS TOO HIGH
if (sv96setpoint > sv96max1 ) then
-- CLAMP AT FIRST ISO LIMIT
sv96setpoint = sv96max1
-- CALCULATE NEW APERTURE SETTING
av96setpoint = bv96meter + sv96setpoint - tv96setpoint
-- CHECK IF NEW SETTING IS GOES BELOW LOWEST F-STOP
if ( av96setpoint < av96minimum ) then
-- CLAMP AT LOWEST F-STOP
av96setpoint = av96minimum
-- RECALCULATE ISO SETTING
sv96setpoint = tv96setpoint + av96setpoint - bv96meter
-- CHECK IF THE RESULT IS ABOVE MAX2 ISO
if (sv96setpoint > sv96max2 ) then
-- CLAMP AT HIGHEST ISO SETTING IF SO
sv96setpoint = sv96max2
-- RECALCULATE SHUTTER SPEED NEEDED
tv96setpoint = bv96meter + sv96setpoint - av96setpoint
-- RECALCULATE REQUIRED SHUTTER SPEED DOWN TO TV MINIMUM
tv96setpoint = math.max(bv96meter+sv96setpoint-av96setpoint,tv96min)
end
end
-- HIGH AMBIENT LIGHT ?
-- CHECK IF REQUIRED ISO SETTING IS TOO LOW
elseif (sv96setpoint < sv96min ) then
-- CLAMP AT MINIMUM ISO SETTING IF SO
sv96setpoint = sv96min
-- RECALCULATE REQUIRED SHUTTER SPEED
tv96setpoint = bv96meter + sv96setpoint - av96setpoint
-- CHECK IF SHUTTER SPEED NOW TOO FAST
if (tv96setpoint > tv96max ) then
-- CLAMP AT MAXIMUM SHUTTER SPEED IF SO
tv96setpoint = tv96max
-- CALCULATE NEW APERTURE SETTING
av96setpoint = bv96meter + sv96setpoint - tv96setpoint
-- CHECK IF NEW SETTING IS GOES ABOVE HIGHEST F-STOP
if ( av96setpoint > av96max ) then
-- CLAMP AT HIGHEST F-STOP
av96setpoint = av96max
-- RECALCULATE SHUTTER SPEED NEEDED AND HOPE FOR THE BEST (CALLING FUNCTION MAY ACTIVATE ND FILTER IF AVAILABLE)
tv96setpoint = bv96meter + sv96setpoint - av96setpoint
end
end
end
end -- *****************************************
-- functions: --------
function wait_for_calmness()
print "We wait for the scenery to calm down..."
mab=a*b -- max of possible zones affected by motion
-- local zones=md_detect_motion(a,b,c,d, e,f,g,h,i,j,k,l,m,n,o,p)
repeat local zones=md_detect_motion(a,b,c,1500,e,1,g,h,i,j,k,l,m,0,o,p)
print(zones,os.date("%Y%m%d-%H%M%S"))
if zones>=(mab/2) then print("far too much noise, MD of details won't work...!") end
until zones<=1
end -- of function
function set_threshold_f()
-- sets -f- slightly larger than the noise ...
dold=d
-- d=500 -- timeout val only 0.5s here,
d=1500 -- timeout val only 1.5s here,
n=0 -- no shot, only measuring...
f=0 -- starting f with a value of 1
repeat
print("assessing threshold...")
f=f+2
zones=md_detect_motion(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)
sleep(200)
if t==2 then print (" f=",f," --> zones=",zones) end
-- does given f still produce a response ?
until ( zones == 0 )
f=f+S -- zur Sicherkeit um S mehr...
-- Param S and the below add are safety margins, added onto noise level found
if (bv96<0) then f=f-(bv96/30) end -- bei -600 ca +20
print("f set to ",f)
d=dold -- wieder den alten timeout-Wert
sleep(500)
end
function get_current_tv96()
-- wie unten bei "measure_and_set_exposure_params()":
press ("shoot_half")
repeat sleep(250) until get_shooting()==true
bv96=get_bv96()
if t==2 then print("bv96 found as ",bv96) end
sleep(1000)
release("shoot_half")
repeat sleep(50) until get_shooting()==false
-- NOT CALLING basic_iris_calc()
tv96 = bv96 + sv96setpoint - av96setpoint
if (t==2) then print("tv96=",tv96) end
end
function measure_and_set_exposure_params()
press ("shoot_half")
repeat sleep(250) until get_shooting()==true
-- set exposure values based on "luminance of the field"
bv96=get_bv96()
if t==2 then print("bv96 found as ",bv96) end
bv96meter=bv96 -- variablenname wie oben gefordert...
sleep(1000)
release("shoot_half")
repeat sleep(50) until get_shooting()==false
sleep(100)
-- target parameters are:
tv96target=1056 -- =1/2000 sec; as fast as poss
tv96max=1056 --= 1/2000 sec für kürzeste Zeit
tv96min=-384 --= 16 sec für allerlängste Zeit
av96target=288 -- =f/2.8 ; wg. asap
av96minimum=288 --=f/2.8 bei A570IS
av96max=576 --=f/8 bei A570IS
-- =ISO 50 100 200 400 800 1600 3200 6400 12800
sv_table = { 380, 411, 507, 603, 699, 795, 891, 987, 1083 }
-- used in basic_iris-calc function, see there above:
-- sv96max1 = sv_table[I+1]
sv96min = sv_table[1]
sv96max1 = sv_table[6]
sv96max2 = sv_table[7]
if t==2 then print("sv-min:",sv96min, "target:",sv96target,"max1:",sv96max1,"max2:",sv96max2) end
basic_iris_calc() -- calling the expos function
if t==2 then print("setpts:sv96=",sv96setpoint,"av96=",av96setpoint,"tv96=",tv96setpoint)
end
-- apply 'em setpoints:
set_sv96(sv96setpoint)
sleep(300)
set_tv96(tv96setpoint)
sleep(300)
set_tv96_direct(tv96setpoint)
sleep(300)
set_av96(av96setpoint)
sleep(300)
end -- of function --
function print_params()
print("bv96=",bv96,"f=",f,"ISO=",sv96_to_iso(sv96setpoint),"F/",av96_to_aperture(av96setpoint), "T=",tv96_to_usec(tv96setpoint))
end -- of function() --
function change_zoom()
zn=z -- z is from param header ...
repeat
zn100=zn*100
zoomrange=get_zoom_steps() curzoom=get_zoom()
znov=zn100*zoomrange/800 -- correctly generalized now ...
if (curzoom~=znov) then set_zoom(znov) sleep(3000) end
-- print("cam's zoom is now:",get_zoom(),"/",get_zoom_steps())
wait_click(1000)
if (is_pressed("up")) then set_zoom_rel(1) zn=zn+1 end
if (is_pressed("down")) then set_zoom_rel(-1) zn=zn-1 end
if (is_pressed("zoom_in")) then set_zoom_rel(1) zn=zn+1 end
if (is_pressed("zoom_out")) then set_zoom_rel(-1) zn=zn-1 end
if zn<0 then zn=0 end
if zn>(zoomrange-1) then zn=zoomrange-1 end
print("zoom=",get_zoom(),"/",get_zoom_steps(),"ok?->SET,or Up/Dn")
sleep(1000)
until (is_key("set"))
end -- of function --
function change_focus()
focw=10000 -- set to 10m, a fairly distant value
set_aflock(1) -- is important for subseq set_focus
set_focus(focw)
sleep(1000)
repeat
set_exit_key("no_key")
print("foc=",get_focus(),"ok?->SET,or Up/Dn,or TestShoot")
wait_click()
if (is_pressed("up")) then focw=(5*focw)/3 set_focus(focw) sleep(1500) end
if (is_pressed("down")) then focw=(5*focw)/7 set_focus(focw) sleep(1500) end
if (is_pressed("zoom_in")) then focw=focw*2 set_focus(focw) sleep(1500) end
if (is_pressed("zoom_out")) then focw=focw/2 set_focus(focw) sleep(1500) end
if (is_pressed("erase")) then focw=55 set_focus(focw) sleep(1500) end
-- for a quick manual take:
if (is_pressed("shoot_full")) then shoot() print("TestShoot w/",get_focus(),"mm") end
until (is_key("set"))
set_exit_key("shoot_full")
end -- of function --
function set_grid_size()
-- note: we _do_ manipulate the global variables a,i,j,l,b,k,m -----
-- motion detect parameters only valid here in this function:
-- a= columns, b= rows to split picture into
-- if main was loaded and started remotely:
if (type(S) =="nil") then i=1 a=15 b=12 j=7 l=9 k=7 m=6 end
-- <--as a default starting pattern
neg=1
local c=1 -- measure mode (U,Y,V R,G,B)
local d=200 -- timeout (mSec)
local e=100 -- comparison interval (msec) - less than 100
-- will slow down other CHDK functions
local g=1 -- draw grid (0=no,1=grid,2=sensitivityr eadout,
-- 3=sensitivity readout & grid)
local h=0 -- not used in LUA
local n=0 -- opt. params. (0=no action, 1=shoot immediate)
-- n=1 & 9 apparently (always ?) rigger flash j.j.
local o=6 -- pixel step
local p=1000 -- (re-)Start delay in msec
-- release("set")
while not((is_pressed("set")))
do
a=math.max(a,3) b=math.max(b,2)
md_detect_motion(a,b,c,d,e,f,g,0,i,j,k,l,m,n,o,p)
print("i",i,"a/b=",a,b,"jklm=",j,k,l,m," ok?->SET")
-- COLS ROWS Maskengrösse in Spalten/Zeilen:
-- links oben rechs unten
-- a b j k l m
wait_click(0)
if (is_pressed("zoom_in")) then a=math.max((a+5),4) b=math.max((b+4),6) rb=math.max(a/10,1) j=rb k=rb l=a-rb m=b-rb end
if (is_pressed("zoom_out")) then a=math.max((a-5),4) b=math.max((b-4),6) rb=math.max(a/10,1) j=rb k=rb l=a-rb m=b-rb end
if (t~=2) then -- normal mode of grid adjust ---
if (is_pressed("display")) then i=(i+1) if i>2 then i=0 end end
if (is_pressed("left")) then a=a-1 b=b-1 j=j-1 k=k-1 end
if (is_pressed("up")) then j=j-1 l=l+1 k=k-1 m=m+1 end
if (is_pressed("right")) then a=a+1 b=b+1 j=j+1 k=k+1 end
if (is_pressed("down")) then j=j+1 l=l-1 k=k+1 m=m-1 end
if (is_pressed("erase")) then a=38 b=36 j=16 l=22 k=16 m=20 end
else -- t==2 -->grid debug mode ----------------
if (is_pressed("shoot_half")) then neg=(-neg) end -- dir flag toggle
if (is_pressed("display")) then i=(i+1) if i>2 then i=0 end end
if (is_pressed("left")) then j=j+neg end
if (is_pressed("up")) then k=k-neg end
if (is_pressed("right")) then l=l+neg end
if (is_pressed("down")) then m=m-neg end
-- now make use of curr params from here, & leaving test mode:
if (is_pressed("erase")) then t=0 end -- a subsequent "set" leaves loop
end
end -- of the do loop
end -- of the lua function
-- =========================================================
-- ----- M A I N P R O G S T A R T S H E R E :---------
-- =========================================================
-- -- tested with A570IS mainly
props=require("propcase")
-- general preparations (=only once)
set_console_layout(1,1,44,4)
-- modified defaults if main was loaded and started remotely:
if (type(S) =="nil") then print("remote callup w/ spec. default params") end
if (type(S) =="nil") then S=8 I=0 z=0 X=0 maxtakes=1 A=0 L=1 M=1 p=600 t=0 P=0 Q=0 RAWON=0 end
-- switch to shooting mode if necessary
if ( get_mode() == false ) then
set_record(1)
while ( get_mode() == false ) do sleep(100) end
sleep(1000)
end
-- all printing is logged into this file:/CHDK/LOGS/LOG_0005.TXT
set_console_autoredraw(0) ; print_screen(-5)
if (get_raw()==false) and (RAWON==1) then error("switch RAW on in CHDK's main menu!") end
if (get_raw()==true) and (RAWON==0) then set_raw(false) end
-- switching flash off
if (B==0) then set_prop(props.FLASH_MODE, 2) sleep(1000) end -- flash off
set_prop(props.IS_MODE, 3) -- IS_MODE off
set_prop(props.AF_ASSIST_BEAM,A) -- AF assist on/off
-- Zoom&Grid-Adj-----
if X==1 then
-- Start values now reasonably correct (:-))):
i=1 a=15 b=12 j=2 k=2 l=a-j+1 m=b-k+1
change_zoom()
cls()
set_grid_size()
else
-- use the 0...8 value of z from header:
proz=(z*100/8)
szv=get_zoom_steps()*proz/100
set_zoom(szv)
end
-- Manual focus setting if that was selected in menu
ovm=get_sd_over_modes()
if (E==1) and (ovm==0x07) then change_focus() end
-- print prog's name:
sn=get_config_value(1054)
sn=string.sub(sn,16) -- "CHDK" und "SCRIPTS" ausblenden
print() print("=========================")
print("This is ",sn) print(os.date("%Y%m%d-%H%M%S"))
set_console_layout(1,1,40,14)
zones=0 -- triggers the inital noise margin measurement...
print("I=",I) asa=50*I print("ISO-target=",asa)
set_iso_mode(I) -- IS0 80 - 1600 -- maybe overridden later...??
sleep(300)
print("iso-mode now set to:",get_iso_mode())
-- motion detect parameters are preset, if X==0, as follows:
-- a= columns, b= rows to split picture into
--?? COLS beg..end ROWS beg..end mask mode
if X==0 then a=8 j=2 l=7 b=6 k=2 m=5 i=1 end
c=1 -- measure mode (U,Y,V R,G,B)
d=300000 -- timeout (mSec)
e=100 -- comparison interval (msec) - less than 100
-- will slow down other CHDK functions, they say
g=1 -- draw grid (0=no,1=grid,2=sensitivityr eadout,
-- 3=sensitivity readout & grid)
h=0 -- not used in LUA
-- j,k,l,m see above
n=1 -- optional parameters (1=shoot immediate)
o=6 -- pixel step
p=800 -- (re-)Start delay in msec
print("p set to ",p)
if (L==0) then set_lcd_display(0) end
sleep(500)
press ("shoot_half")
repeat sleep(250) until get_shooting()==true
-- use autofocus; if impossible, then use hyp-dist.
dof=get_dofinfo() fw=5000
if (dof.hyp_valid == true ) then fw=dof.hyp_dist end
entf=get_focus()
gfok=get_focus_ok()
if gfok==0 then set_aflock(1) set_focus(fw) end
if (E==1) then set_aflock(1) set_focus(focw) end
print("FOKUS=",get_focus())
release("shoot_half")
if t>=1 then pzz=0
repeat -- testing the expo params' calculus ---
set_console_layout(0,0,48,14)
measure_and_set_exposure_params()
set_threshold_f() -- a bit higher than the noise
print_params()
if (pzz/10)==0 then pzz=0 print(sn,"TEST,key=cont,shoot=stop") end
pzz=pzz+10
wait_click()
until (0==1)
end
if (W==1) then wait_for_calmness() end
check0=get_exp_count() -- monit stor img no.
zones=0 -- initial value, nothing detected yet, of course
dlt=60000 -- delay time initially 1 min, 32 min max
-- **** M A I N'S *** M o t D e t L O O P starts here: *************
repeat -- forever, see bottom line's "until(false)" statement
-- if nothing had been detected till timeout,
-- we now fist check if any inactivity time is due:
--from the internet:
--Gets the current time: Examples:
--print (os.date ("%x")) --> 25/04/07
--print (os.date ("%c")) --> 25/04/07 10:10:05
--print (os.date ("%A, %m %B %Y")) --> Wednesday, 04 April 2007
-- t = os.date ("*t") --> produces a table like this:
-- { t.sec=18 ,t.min=13,t.hour=10, t.day=25 t.month=4, t.year=2007,
-- t.wday=4, t.yday=115, t.isdst=false }
if (not((P==0) and (Q==0)))
then
AT=os.date("%c") -- = Zuweisung an einfachen String
-- nur Stunde herausholen
ASX=string.byte(string.sub(AT,8,8))-48
ASE=string.byte(string.sub(AT,9,9))-48
AS=10*ASX+1*ASE
-- print(AT,AS)
-- print(P, AS, Q)
-- sleep(9000)
if ( (P<=AS) and (Q>AS))
then
print("Pause bis ", Q,": 00")
slms=(Q-AS)*3600*1000
sleep(slms)
-- verbleibende Zeit verschlafen
else
end
end
-- and we now recalculate expo and threshold:
if zones==0 then
measure_and_set_exposure_params()
set_threshold_f() -- a bit higher than the noise
end
-- set some params:
g=1 -- show grid only
n=9 -- =1001 bin, immediate triggering and hold, see handbook
p=1000 -- ????? as an anti-looping
check1=get_exp_count() -- monit stor img no.
banz=get_exp_count()-check0
--(os.date("%Y%m%d-%H%M%S")) <---format example
if zones~=0 then du=(os.date("%H%M%S")) print_params()
print(sn,"#:",banz,"IMG_",check1,"@",du,"h")
end
sleep(400) -- it appears it's necessary...
set_console_layout(0,0,40,5)
-- prepare for first take, in fast mode: (ds is "disk space")
ds0=get_free_disk_space()
if (t>=1) then print("M=",M," tv96stp=",tv96setpoint,"bv96=",bv96) end
get_current_tv96()
-- The very Motion Detection follows here: -----------
-- n.b. M==1 is "do not shoot if expo time is too slow"
if M==0 or (M==1 and tv96>640) -- +640 = 1/100 s
then
dlt=60000
-- now MotDet with n=9, which shoots immediately if someting is detected:
print(banz,"taken, waitin' for motion now:")
tb4=get_tick_count() -- get time before md start (ms)
-- sys bug? it appears that MotDet with n=9 retriggers flash although
-- it was turned off?:
-- work-around: if (tv<640), i.e. low light, we use n=0's slow MotDet instead:
if (tv96<640)
then nold=n n=0
zones=md_detect_motion(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)
n=nold
if (zones>0) then press("shoot_half") press("shoot_full") end
print("tv96 was:",tv96,"slow MD used")
else
zones=md_detect_motion(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)
print("tv96 was:",tv96,"fast MD used")
end
tb5=get_tick_count() -- get time afer md finished (ms)
-- too many takes in a short period may mean: too much noise yet--:
mddur=tb5-tb4
if mddur<(d/20) then S=S+2 end -- inc S, thus desesitize
release("shoot_full") -- mandatory anyway in the e.g. n=9 case
release("shoot_half")
sleep(2000)
else
dlt=dlt*2
if dlt>1800000 then dlt=1800000 end
dltm=dlt/60000
print("waitin'",dltm,"min for more light...")
zones=0 sleep(dlt)
end
repeat sleep(150) until (get_shooting()==false)
if zones~=0
then
repeat sleep(150) until (get_exp_count()~=check1)
repeat sleep(100) ds1=get_free_disk_space() until ds1<ds0
repeat dsv=get_free_disk_space() sleep(100) until
get_free_disk_space()==dsv -- Stabilität abwarten
takeno=1
-- 'maxtakes' trail takes now taken asap: --------
while (takeno<maxtakes)
do
takeno=takeno+1
ds0=get_free_disk_space()
check2=get_exp_count() -- mon stor img no.
shoot()
repeat sleep(50) until (get_exp_count()~=check2)
repeat sleep(50) ds1=get_free_disk_space() until ds1<ds0
repeat dsv=get_free_disk_space() sleep(50) until
get_free_disk_space()==dsv
end -- (of "trailer imgs taken" section)
-- gotten here, we loop back quickly
end
-- Note; a 'zones==0' retd from MD would trigger re-calc etc
until (false) -- loops forever. Press "shoot full" to stop!
-- ****** the main M o t D e t L O O P ends here ************
-- ======= M A I N P R O G E N D S H E R E ================
Mitglieder in diesem Forum: 0 Mitglieder und 5 Gäste