Script writing assistance for intervalometer with shut off - Script Writing - CHDK Forum

Script writing assistance for intervalometer with shut off

  • 56 Replies
  • 17359 Views
Script writing assistance for intervalometer with shut off
« on: 21 / July / 2011, 02:42:50 »
Advertisements
Hi! I need help writing an intervalometer script that takes pictures every 10 seconds until the memory card is full. I was able to do this with the "endless" mode of the Ultra Intervalometer script but I don't know how to tell the camera to turn off once the memory card has no more room for pictures. Thank you!

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Script writing assistance for intervalometer with shut off
« Reply #1 on: 21 / July / 2011, 13:46:49 »
Adding

X=get_jpg_count
if X<2 then shut_down

somewhere in the script should probably do the trick (disclaimer: no, I didn't test it and no, I don't remember ubasic syntax very well...).

In case someone's wondering, I put X<2 instead of X<1 in case it's slightly inaccurate :)

Re: Script writing assistance for intervalometer with shut off
« Reply #2 on: 21 / July / 2011, 20:27:25 »
or this way

.........shortened

for J=1 to S
   if get_vbatt<j or get_free_disk_space<5000 then gosub "stop"
   shoot
   sleep xx
next J

end

:stop
   shutdown
   sleep 3000
   return

from this german-skript
http://forum.chdk-treff.de/viewtopic.php?f=7&t=939
pdf-doku also in german

gehtnix

Re: Script writing assistance for intervalometer with shut off
« Reply #3 on: 22 / July / 2011, 02:59:12 »
Ok that worked, thanks so much! Also, is there a command to switch between photo and video modes (without using "click" on the buttons you would manually do it with)? I have an A490, if that makes a difference, and I would like to have the intervalometer script take 10 photos 30 seconds apart, then a 30 second video, then repeat until it shuts down when memory is full. It will run off an external power supply so I don't need a shut off command for low battery voltage.

Re: Script writing assistance for intervalometer with shut off
« Reply #4 on: 22 / July / 2011, 05:39:52 »
You don't actually say so but from your username I am guessing you are interested in stratospheric balloon flights.

If so, the following may be of interest.
It is being tested now for a flight next week.

 First the script and then (as an attachment) a log produced by the test that was 5x shorter duration than the real flight :-

Code: [Select]
@title Stratosphere
@param i interval time unit
@default i 5
@param n numerator
@default n 1
@param b  beep Interval
@default b 10
@param o ISO max
@default o 400
rem -----------------------------
rem High altitude balloon project
rem -----------------------------
flash_off
sync_off
enable_logging

rem  Wait for lens cap removal
gosub "phaseA"
line_1 "phaseA finished"

rem Liftoff movie
M=5
log "Liftoff movie"
gosub "phaseB"

rem Low altitude shots
D = 25
log "Low altitude fast shots"
gosub "phaseC"

rem Higher altitude movie
M=3
log "Higher altitude ascent movie"
gosub "phaseB"

rem Higher altitude shots
D = 30
log "Higher altitude fast shots"
gosub "phaseC"

rem Compute Bv from meter readings
gosub "phaseD"

rem High altitude shots, computed Bv
D = 25
gosub "phaseF"

rem High altitude Shoot movie
M=3
log "High altitude movie"
gosub "phaseB"

rem Descent,continually computed
D = 20
gosub "phaseE"

:loop
rem High altitude Shoot movie
M=2
gosub "phaseB"

rem Descent, continually computed
D = 35
gosub "phaseE"

goto "loop"

end

:phaseA
sync_off
flash_off
beep 10
log "------------------------------------------------"
log "            Stratospheric Balloon Mission       "
log "------------------------------------------------"
log ""
log "phaseA: Script started, wait for lens cap removal"
line_1 " Script started"
line_2 " pauses until"
line_3 " lens cap removed"
sleep_for_seconds 5
turn_backlight_off
log "Backlight turned off"
C = 15/i
sleep_for_minutes C
cover_lens 10
log "Lens cap removed"
turn_backlight_on
log "Backlight turned on"
log "------------------------------------------------"
log ""
beep_off
start_clock
return

:phaseB
line_1 "#Shooting movie"
line_2 "#"
line_3 "#"
C= M*60/i
log elapsed_time, "phaseB: Recording movie for",C," seconds"
shoot_movie_for C
sleep_for_seconds 5
flash_off
log "Flash off"
log "------------------------------------------------"
log ""
return

:phaseC
line_1 "!Fast shooting"
line_2 "!at low altitude"
line_3 "!metered brightness"
T = get_day_seconds
sleep_for_seconds 3
set_max_iso_to o
log elapsed_time,"phaseC: Fast shots every 30 seconds for",(D * 60 / i)," seconds"
log "Maximum ISO set to",o
log "Target shutter speed =",n,"/4000"
do
 shoot_fast_at n/2000,z
I = image_number
if z < 0 then gosub "fast" else gosub "slow"
 sleep_for_seconds 30
S = get_day_seconds
until (S - T) >= (D * 60 / i)
sleep_for_seconds 3
log "------------------------------------------------"
log ""
return

:phaseD
line_1 " Filling buffer"
line_2 " for brightness"
line_3 " at 60 minutes"
log elapsed_time,"Taking 100 brightness readings"
meter_brightness 1
sleep_for_seconds 3
log "------------------------------------------------"
log ""
return

rem ----------------------------
rem Descent,fast shots computed
rem ----------------------------
:phaseE
line_1 "#Descent"
line_2 "#Bv continuously"
line_3 "#updated"
log elapsed_time,"phaseE: Descent,exposure computed every 20 shots"
log "Fast shots every 3 seconds for",(D * 60 / i)," seconds"
N = 0
T = get_day_seconds
do
 do
  shoot_fast_at n/2000,z,1
 I = image_number
 if z < 0 then gosub "fast" else gosub "slow"
  sleep_for_seconds 3
  N = N+1
 until N = 20
 N = 0
 meter_brightness
 S = get_day_seconds
until (S - T) >= (D * 60 / i)
log "------------------------------------------------"
log ""
return

:phaseF
line_1 "!Using fixed"
line_2 "!Computed exposure"
line_3 "!at high altitude"
log elapsed_time,"Fast shots using computed exposure"
T = get_day_seconds
set_max_iso_to o
log "phaseF: Fast shots every 30 seconds for",(D * 60 / i)," seconds"
log "Maximum ISO set to",o
log "Target shutter speed =",n,"/4000"
do
 shoot_fast_at n/4000,z,1
I = image_number
if z < 0 then gosub "fast" else gosub "slow"
 sleep_for_seconds 30
S = get_day_seconds
until (S - T) >= (D * 60 / i)
sleep_for_seconds 3
log "------------------------------------------------"
log ""
return

:fast
log elapsed_time,"IMG_";I,"Fast shoot at",-z,"ISO"
return

:slow
log elapsed_time,"IMG_";I,"shutter was 1/",z,"at max ISO"
return

:interrupted
beep
turn_backlight_on
line_1 " restore"
line_2 "!restore"
line_3 "#restore"
sleep_for_seconds 5
end



and the logfile below :-



« Last Edit: 22 / July / 2011, 05:41:44 by Microfunguy »

Re: Script writing assistance for intervalometer with shut off
« Reply #5 on: 22 / July / 2011, 12:12:39 »
Thanks! I also have a flight next week :)

Unfortunately my camera shuts off when it gets to the shoot_movie_for line, so I might have to do something a little different from what you have...

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Script writing assistance for intervalometer with shut off
« Reply #6 on: 22 / July / 2011, 12:29:33 »
set_record
http://chdk.wikia.com/wiki/Script_commands

(shoot_movie_for stuff is for SDM only)

Re: Script writing assistance for intervalometer with shut off
« Reply #7 on: 22 / July / 2011, 14:26:34 »
I might have to do something a little different from what you have...

You will have to do something a lot different.

First of all you need SDM and then you need my current build which is not yet released.

If you would like to try it, tell me your camera and firmware version and I will upload a build.

You have nothing to lose for a few minutes of your time  :)


Re: Script writing assistance for intervalometer with shut off
« Reply #8 on: 22 / July / 2011, 18:51:29 »
Ok, I guess I can try it :)

My camera is an A490: 1.00f

Thank you!

Re: Script writing assistance for intervalometer with shut off
« Reply #9 on: 22 / July / 2011, 19:05:45 »
It is getting late here so I will post it with instructions in the morning.


 

Related Topics


SimplePortal © 2008-2014, SimplePortal