Remote interval start with auto shut off - page 2 - Script Writing - CHDK Forum  

Remote interval start with auto shut off

  • 24 Replies
  • 5048 Views
Re: Remote interval start with auto shut off
« Reply #10 on: 10 / June / 2012, 11:46:23 »
Advertisements
Can it also be configured to loop rather than shutdown ? 

I don't think so.

To be honest, I would have to study the code.

That tells me that things are already too complicated.

I need to make the ultimate dumbed-down version.

Re: Remote interval start with auto shut off
« Reply #11 on: 10 / June / 2012, 12:06:00 »
To be honest, I would have to study the code.

That tells me that things are already too complicated.

I need to make the ultimate dumbed-down version.
I actually spent a few minutes looking at the code.  Its pretty tightly embedded in the core/kbd.c file.  Lots of interactions so I gave up and asked here instead.

This conversation probably belongs over in the UI 2.0 thread but I'm genuinely curious about what an "ultimate dumbed-down" version would look like ?    I believe it was George Bernard Shaw who said "Build a system that even a fool can use and only a fool will want to use it."  It can be a very fine line.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Remote interval start with auto shut off
« Reply #12 on: 10 / June / 2012, 12:21:21 »
I'm genuinely curious about what an "ultimate dumbed-down" version would look like ?

I have no idea.

It should just help me to do what I want to do, not hinder me.

If other people find it useful  .. fine.

If not .. fine.

Re: Remote interval start with auto shut off
« Reply #13 on: 10 / June / 2012, 14:23:33 »
That looks great, i´m going to test it tomorrow, thanks alot!!

It is a built-in feature of SDM.
Is there a link to describe that ?

While we wait for that link,  here's a tested Lua script that should work on every CHDK supported camera. Feel free to modify it to do exactly what you want it to do.

Code: [Select]
--[[
@title RC Plane Shooter 22
@param a Interval (sec)
@default a 5
@param b Repeat ? (0=no, 1=yes)
@default b 1
--]]

function restore()
  set_backlight(1)
  set_config_value(121, 0)
  shut_down()
end

count = 0
set_console_layout(1, 1, 35, 12)
print("started ...")
print("enabling USB")
set_config_value(121, 1)

repeat

  print("waiting for USB ...")

  repeat
     wait_click(100)
  until is_pressed("remote") == true

  print("USB activate")

  set_record(1)

  repeat
    sleep(500)
  until get_mode() == true

  print("in shooting mode")

  repeat
    nextshot = get_tick_count() + a*1000
    shoot()
    count = count + 1
    print("shoot", count)
    while (get_tick_count() <= nextshot) and (is_pressed("remote") == true ) do
sleep(100)
         set_backlight(0)
    end
  until is_pressed("remote") == false

  set_backlight(1)

  print("USB released")

  set_record(0)

  repeat
    sleep(100)
  until get_mode() == false

until b == 0

restore()

Note that the second parameter determines whether the camera shuts down when USB power is removed or if it loops back and starts shooting again once  USB power is re-applied.  Either way,  the camera is in playback mode with the lens retracted whenever there is no USB power.

You probably want to set the lens retract delay to zero in the Canon menus so that the lens retracts right away when shooting stops.

Update :  Incidentally,  the new trunk USB remote code can be configured to  automatically take continuous pictures whenever USB power is applied.  No scripting required.


Re: Remote interval start with auto shut off
« Reply #14 on: 10 / June / 2012, 14:28:49 »
The non response is simply because i have been away for the weekend

While we wait for that link,  here's a tested Lua script that should work on every CHDK supported camera.

It is simply the parameter settings in the timelapse script of SDM 1.86.

1.86 has not yet been released because testers keep letting me down.

airfoto.se did not respond to my request for testing the build other than acknowledging receipt.

No further assistance will be given and he will not be put in contact with another SDM user who is already doing a similar application.

Re: Remote interval start with auto shut off
« Reply #15 on: 11 / June / 2012, 14:46:50 »
I have now tried it but i think that a delay is needed for the check if usb is active, sometimes this lense retracts even though i have the usb active.

Re: Remote interval start with auto shut off
« Reply #16 on: 11 / June / 2012, 19:23:49 »
I have now tried it but i think that a delay is needed for the check if usb is active, sometimes this lense retracts even though i have the usb active.
Strange.  Is there any chance  you have the interval set long enough that the camera is shutting down on its own between shots ? The code is pretty straight foward so the only other likely cause is that your servo / RC setup is only giving marginal voltage levels ?

I'll can add code to wait for the signal to go away for a couple of seconds before shutting down the camera.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Remote interval start with auto shut off
« Reply #17 on: 11 / June / 2012, 21:28:10 »
Here you go - script #2.  Added a programmable delay so that the USB power has to stay off for that time before the camera will shut down.

Code: [Select]
--[[
@title RC Plane Shooter 24
@param a Interval (sec)
@default a 10
@param b Repeat ? (0=no, 1=yes)
@default b 1
@param c Shutdown Delay (sec)
@default c 2
--]]

function restore()
  set_backlight(1)
  set_config_value(121, 0)
  shut_down()
end

count = 0
odelay = c*1000

set_console_layout(1, 1, 35, 12)
print("started ...")
print("enabling USB")
set_config_value(121, 1)

repeat

   print("waiting for USB ...")

   repeat
     wait_click(100)
   until is_pressed("remote") == true

   print("USB activate")

   set_record(1)

   repeat
     sleep(500)
   until get_mode() == true

   print("in shooting mode")

   offtimer = odelay

   repeat
     nextshot = get_tick_count() + a*1000
     count = count + 1
     print("shoot", count)
     shoot()
     while (((get_tick_count() < nextshot) or (offtimer<odelay)) and (offtimer>0)) do
       if is_pressed("remote") == false then
          offtimer = offtimer - 100
       else
          offtimer = odelay
       end
       sleep(100)
       set_backlight(0)
     end
   until offtimer == 0

   set_backlight(1)

   print("USB released")

   set_record(0)

   repeat
     sleep(100)
   until get_mode() == false

until b == 0

restore()
Ported :   A1200    SD940   G10    Powershot N    G16


Re: Remote interval start with auto shut off
« Reply #18 on: 12 / June / 2012, 00:09:14 »
Great work!!!! I will try this asap!

I also think that it has something to do with how my usb trigger is setup, i´m using this one

http://www.gentles.ltd.uk/gentwire/usb.htm

Re: Remote interval start with auto shut off
« Reply #19 on: 12 / June / 2012, 00:27:07 »
I also think that it has something to do with how my usb trigger is setup, i´m using this one
http://www.gentles.ltd.uk/gentwire/usb.htm
From a quick read of that URL,  hopefully you have the gentWIRE-USB (and not the gentWIRE-USB2) and are using it in the "blue wire" mode.
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics