Timelapse with auto restart - Script Writing - CHDK Forum supplierdeeply

Timelapse with auto restart

  • 3 Replies
  • 1702 Views
Timelapse with auto restart
« on: 11 / August / 2012, 18:39:45 »
Advertisements
Hi there

I've set up my A480 to do timelapse using a script which also checks for daylight and it seems to work great :) (thanks to Fraser McCrossman).  I need to dump the photos off the camera every day and have set up a USB cable to do so.  Is it possible though to get the camera to automatically restart in capture mode after I've disconnected the USB cable?  I'd be quite happy if I could just get it to automatically go back into capture mode at a certain time of day (eg. 5am).

I've configured the script to autostart and the card to autoboot, so I really just need the camera to reboot at a certain time of day I guess?

Cheers
Simon

Re: Timelapse with auto restart
« Reply #1 on: 11 / August / 2012, 18:52:00 »
Assuming you have your script running when you plug / unplug the USB cable,  you can use the get_usb_power function to detect when the cable is plugged in..  With a little logic in your code,  you could then force the camera back into record mode with something like this :

Code: [Select]
  do p = get_usb_power 1 until p<1

  if get_mode = 0 then goto "in_rec"
  sleep 1000
  set_record 1
:wait_rec
  sleep 100
  if get_mode <> 0 then goto "wait_rec"
:in_rec
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Timelapse with auto restart
« Reply #2 on: 12 / August / 2012, 09:10:35 »
Hi

Thanks for the pointer, sounds like what I need.  But I don't seem to be able to get the get_usb_power function to work.  I get an "unexpected symbol near '1'" error which suggests to me that this function is unknown.

I'm using the a480-100b-1.1.0-2053-full firmware.  Am I missing something?

I thought this might work in my LUA script;

Code: [Select]
:INREC
do p = get_usb_power(1) until p>0

while endless or frame <= total_frames do
 wait_for_light()
 print_status(frame, total_frames, ticks_per_frame, end_ticks, endless)
 if display_off_frame > 0 and frame >= display_off_frame then
 seek_display_mode(target_display_mode)
 end
 shoot()
 if frame_delay(frame, start_ticks, ticks_per_frame) then
 print "User quit"
 break
 end
 frame = frame + 1
 p = get_usb_power(1)
end

while p > 0 do
 print "Waiting for record mode"
 sleep 100
 p = get_usb_power(1)
end
set_record 1
goto "INREC"

Thanks
Simon
« Last Edit: 12 / August / 2012, 09:22:30 by spfunnell »

Re: Timelapse with auto restart
« Reply #3 on: 12 / August / 2012, 10:54:48 »
Close.  I think I'd do it like this though :

Code: [Select]

while endless or frame <= total_frames do
   wait_for_light()
   print_status(frame, total_frames, ticks_per_frame, end_ticks, endless)
   if display_off_frame > 0 and frame >= display_off_frame then
      seek_display_mode(target_display_mode)
   end
   shoot()
   if frame_delay(frame, start_ticks, ticks_per_frame) then
      print "User quit"
     break
   end
   frame = frame + 1

   p = get_usb_power(1)
   if p > 0 then
      while p > 0 do
          print "Waiting for record mode"
          sleep 1000
          p = get_usb_power(1)
      end
      set_record 1
      sleep 2000
 end

end

Ported :   A1200    SD940   G10    Powershot N    G16


 

Related Topics