Set Backlight 0 with Motion Detect - Script Writing - CHDK Forum

Set Backlight 0 with Motion Detect

  • 1 Replies
  • 3198 Views
Set Backlight 0 with Motion Detect
« on: 23 / October / 2010, 01:10:07 »
Advertisements
Hello,

I've been trying to work out a motion detecting script that runs with the lcd off. This *was* working fine and now it won't and I cannot figure it out for the life of me. Maybe some of you guys can have a look and see what errors I have made.

I guess the problem is that the backlight will turn off initially but then turn back on after a shot has been taken. I have tried increasing the sleep time with no success (up to 1000ms sleep before the backlight command)

Also, if someone also could provide guidance on how to sleep this script for several hours (overnight, to wake up with the sun and take nice shots of wildlife) I would be greatly appreciated. Maybe there is an internal clock that could turn the camera on and off at certain times. I should mention that I'm planning on making an external battery pack for the camera so it can run for days in a waterproof container. My camera is an SX200is.

I really liked Fudgey's MDCCTV idea but I haven't got it dialed in yet, and it would be nice his script also ran with the lcd off.

Maybe there is a script that has already been written that is exactly what I need, but I haven't found it yet so I'll keep trying.

Thanks in advance for any help!

Nate



Here is what I have tried for sleeping the camera overnight:

press "print"
sleep 100
release "print"
sleep 28800000
press "print"
sleep 100
release "print"
sleep 1000
set_backlight(0)




And here is the main script:


rem Author: MLuna - based om MX3 sample script
rem Tested on S3IS only
rem Requires Fingalo's build v 119
rem Use with caution!

@title Motion Detection

rem Shot without auto-focus/with auto-focus/continuously (need to put in continuous mode manually)
rem T implies test mode with MD cells drawing and no shots taken
@param a Shot (0=nf/1=f/2=c/3=t)
@default a 1

rem How long the shutter button will be pressed in continuous mode
@param b Continuos shoot (secs)
@default b 10

@param c Threshold (0-255)
@default c 5

@param d Compare Interval (msecs)
@default d 20

@param e Compare Interval (secs)
@default e 0

rem If this value is too small, the camera goes continuously shooting after the 1st shot.
rem Experiment with this value to find one fitted to your needs
@param f Begin Delay (secs)
@default f 5

@param g Pix step(speed/accuracy adj)
@default g 5

@param h Columns
@default h 6

@param i Rows
@default i 6

rem Frame width in which no MD is performed (in cell units)
@param j Dead frame
@default j 0

if a<0 then let a=0
if a>3 then let a=3
if c<0 then let c=0
if d<0 then let d=0
if e<0 then let e=0
if g<1 then let g=1
if h<1 then let h=1
if i<1 then let i=1
if j<0 then let j=0

rem Conversions secs to msecs
let b=b*1000
let e=e*1000
let f=f*1000

let d=d+e

rem This is the timeout in msecs. After this period, the motion trap is rearmed.
let T=600000

rem Parameters for the Dead Frame
let J=j+1
let H=h-j
let I=i-j

let t=0

sleep 400
set_backlight(0)

print "press Shutter Button to Stop"

:repete
   sleep 400
   set_backlight(0)

   md_detect_motion h, i, 1, T, d, c, 1, t, 1, J, J, H, I, 0, g, f

   if a=0 and t>0 then click "shoot_full"
   if a=1 and t>0 then shoot
   if a=2 and t>0 then goto "continuos"
   if a=3 then goto "test"

   let t=0

goto "repete"

sleep 400
set_backlight(0)

:continuos
   let X=get_tick_count
   press "shoot_full"

   :contloop
      let U=get_tick_count
      let V=(U-X)
   if V<b then goto "contloop"

   release "shoot_full"
goto "repete"

sleep 400
set_backlight(0)

:test
   if t>0 then print "Detected cells: ",t else print "No detection in 10 min!"
   let t=0
goto "repete"

« Last Edit: 23 / October / 2010, 01:13:42 by Nate »

Re: Set Backlight 0 with Motion Detect
« Reply #1 on: 01 / November / 2010, 03:53:34 »
this script is working?

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal