Continuous Shutter & Shut Down Script - Script Writing - CHDK Forum

Continuous Shutter & Shut Down Script

  • 8 Replies
  • 5015 Views
Continuous Shutter & Shut Down Script
« on: 31 / August / 2010, 19:04:28 »
Advertisements
Could someone shed some light on this? I have remote enabled, and I want it to continuously take photos when the channel is turned on. I have another channel set to shut down the camera when a different switch is enabled. The shut down works, and independently, the remote continuous shutter does too. But not together. What am I doing wrong here?

Code: [Select]
@title chdk2 continuous shutter and shut-off
rem author mike
rem use gear and aux 1 ports
rem single wire cable goes into AUX 1
rem multi wire cable goes into GEAR

while 1
wait_click 1
   do
      a = get_usb_power
   until a>0
   if a < 5 then gosub "ch1up"
   if a > 4 and a < 8 then gosub "ch1mid"
   if a > 7 and a < 11 then gosub "burst"
   if a > 10 and a < 14 then gosub "ch2up"
   if a > 13 and a < 17 then gosub "ch2mid"
   if a > 16 and a < 20 then gosub "shutdown"
   if a > 19 then print "error"
wend
end

:ch1up
   print "camera shutter off"
   return

:ch1mid
   print "channel 1 middle"
   return

:ch1down
   print "channel 1 down"
   return

:ch2up
   print "channel 2 up"
   return

:ch2mid
   print "channel 2 middle"
   return

:ch2down
   print "channel 2 down"
   return

:shutdown
   shut_down
   return

:burst
press "shoot_half"
sleep 500
press "shoot_full"
while is_key "remote"
press "shoot_full"
wend
release "shoot_full"
release "shoot_half"
return

*

Offline zeno

  • *****
  • 891
Re: Continuous Shutter & Shut Down Script
« Reply #1 on: 01 / September / 2010, 05:41:21 »
Hi Averion

the way the script is written, it won't do a shutdown as long as the burst switch is on, because it won't leave the burst subroutine. However once the burst switch is off and control returns to the main loop, it certainly should exit when you turn the other switch on.
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit

Re: Continuous Shutter & Shut Down Script
« Reply #2 on: 01 / September / 2010, 07:21:33 »
That's the thing... in this script, shut down works OK. However, it doesn't go into burst mode and "loop" - by continuously taking photos. It just takes one and then stops.

*

Offline zeno

  • *****
  • 891
Re: Continuous Shutter & Shut Down Script
« Reply #3 on: 01 / September / 2010, 07:54:22 »
Try writing the burst sub like this:
Code: [Select]
:burst
  press "shoot_half"
  sleep 500
  press "shoot_full"
  while get_usb_power > 0
     press "shoot_full"
     sleep 10
  wend
  release "shoot_full"
  release "shoot_half"
return
I think the problem may be that the there isn't enough time for the usb power counter to get set non-zero in that tight loop.
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit


Re: Continuous Shutter & Shut Down Script
« Reply #4 on: 02 / September / 2010, 16:19:45 »
Still no luck; it only takes one shot.
How do I create a loop with a CHDK2 cable? It should be taking burst photos when voltage X is detected, and not stop until voltage Y is detected. And if voltage Z shows up, turn off camera.

Re: Continuous Shutter & Shut Down Script
« Reply #5 on: 02 / September / 2010, 16:58:51 »
You talk about voltages X,Y and Z.

Do you really mean pulse widths ?


David

*

Offline zeno

  • *****
  • 891
Re: Continuous Shutter & Shut Down Script
« Reply #6 on: 02 / September / 2010, 16:59:52 »
Well it's not quite like that. A CHDK2 generates pulses of 6 different lengths depending on the state of the two joysticks or switches. The trouble is, with both inputs connected, there are going to be two different pulse lengths generated alternately. A burst length pulse will send you to the burst subroutine, but then the other pulse length (generated by the other switch) will take you out. Needs more thought on my part.
« Last Edit: 02 / September / 2010, 17:03:49 by zeno »
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit

*

Offline zeno

  • *****
  • 891
Re: Continuous Shutter & Shut Down Script
« Reply #7 on: 02 / September / 2010, 17:10:54 »
OK, try this
Code: [Select]
burst:
   press "shoot_half"
   sleep 500  
   press "shoot_full"
   b = 1
   while b
      press "shoot_full"
      do
         a = get_usb_power
      until a>0
      if a < 8 then b = 0
      if a > 16 then b = 0
   wend
   release "shoot_full"
   release "shoot_half"
   return  
The idea is to loop as long as the burst switch is not off and the shutdown switch is not on
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit


Re: Continuous Shutter & Shut Down Script
« Reply #8 on: 02 / September / 2010, 21:52:58 »
That worked very well! Thank you so much!

 

Related Topics