Announce: non-intervalometer timelapse script, uses clock time, repeats daily - page 3 - Completed and Working Scripts - CHDK Forum

Announce: non-intervalometer timelapse script, uses clock time, repeats daily

  • 29 Replies
  • 20100 Views
Advertisements
Hi I was interested in exploring this script, but found that the links to the script were cold.   So I went searching in the internet archive (wayback machine)  and found the version below from april 2010 - I have not tried it yet.

Quote
@title daylapse
rem Web Site: http://bugsplatter.id.au/chdk/ - daylapse-2009-06-25a
rem Copyright (C) 2009 Grant Coady email@bugsplatter.id.au -- GPLv2

@param a Run Daily       -      0-1
@param b Start        hour     0-23
@param c Start      minute     0-59
@param d Stop         hour     0-23
@param e Stop       minute     0-59
@param f Frames          -  0-99999
@param i Interval   second  0-99999
@param j Low Battery    mV    >2000
@param m MF Distance    mm 10-65535
@param o Options         &    0-255
@param g Debug Info      &    0-255

@default b -1
@default d -1
@default f 3
@default i 6
@default j 2150
@default m 65535

if b > 23 then b = 23
if c > 59 then c = 59
if d > 23 then d = 23
if e > 59 then e = 59
if i < 5 then i = 5
if j < 2000 then j = 2000
if m < 0 or (m > 1 and m < 10 and m <> 5) then m = 0
if m > 65535 then m = 65535
if g < 0 or g > 255 then g = 0
if o < 0 or o > 255 then o = 0

rem timing ms
rem Awake
A = 400
rem Click
C = 300
rem Display
D = 250
rem General
G = 100

rem waitprep sleep ms
rem AF lock, MF no idle
I = 3000
rem AF first, refocus
J = 6500
rem MF first
K = 6000
rem MF after idle
L = 5500
rem max cam Ready, focus
R = 2500
rem min Begin delay s
B = 11
P = get_propset

if get_mode < 1 then goto "main"
print "Try Record Mode!"
sleep K
end

:sts_fmode
gosub "sts_MF"
if w = 0 then goto "sts_macro"
w = 4
return
:sts_MF
if P = 1 then p = 12 else p = 133
goto "ret_prop"
:sts_macro
if P = 1 then p = 11 else p = 6
goto "ret_prop"
:sts_ready
if P = 1 then p = 67 else p = 115
:ret_prop
w = get_prop p
return

:flashcon
rem option 00110000 -> 0,1,2,3 - no touch, on, off, auto
x = (o / 16) & 3
if x = 0 then return
if x = 3 then x = 0
y = get_flash_mode
if x = y then return
rem sequence for a590, no auto in Av mode
if o & 4 then click "down" else click "up"
sleep C
z = 3
while x <> y and z > 0
  click "up"
  sleep C
  y = get_flash_mode
  z = z - 1
wend
click "set"
sleep C
if x = y then return
print "fail set flash mode", x
sleep D
return

:selfocus
if not (x = 0 or x = 1 or x = 4 or x = 5) then x = 0
gosub "sts_fmode"
if x = w then return
s = 1
if o & 4 then click "up" else click "down"
sleep C
z = 6
while x <> w and z > 0
  click "down"
  sleep C
  gosub "sts_fmode"
  z = z - 1
wend
click "set"
sleep C
if x = w then return
print "fail set focus mode", x
sleep D
return

:chkready
gosub "sts_ready"
t = get_tick_count - 50
z = 0
while w <> 1 and z < R
  sleep 50
  gosub "sts_ready"
  z = get_tick_count - t
wend
if z < R then return
print "wait ready timeout"
sleep D
return

:wakecam
if m > 9 then gosub "sts_MF"
rem no wake for MF mode, repeat, cam awake
if m > 9 and F > 0 and w = 1 then return
rem no propset AF mode sleep/wake status? [2009-06-21]
click "shoot_half"
sleep A
return

:prefocus
gosub "wakecam"
s = 0
if m > 9 then goto "manfocus"
:atofocus
x = m
if not (o & 2) then gosub "selfocus"
if F > 0 and s = 0 and (not (o & 1)) then return
set_aflock 0
sleep G
press "shoot_half"
sleep A
gosub "chkready"
set_aflock 1
sleep G
release "shoot_half"
sleep G
if g & 1 then print "AF Focus", get_focus; "mm", (z + 350); "ms"
if g & 1 then sleep D
return

:manfocus
x = 4
if not (o & 2) then gosub "selfocus"
if F > 0 and s = 0 then return
set_focus m
gosub "chkready"
if g & 1 then print "MF Focus", get_focus; "mm", (z + 350); "ms"
if g & 1 then sleep D
return

:chk_begin
N = get_day_seconds
B = B + N
if b < 0 or c < 0 then return
B = (b * 3600) + (c * 60)
if B < N then B = B + 86400
return

:chk_end
E = B + 10
if d < 0 or e < 0 or f < 0 then return
E = (d * 3600) + (e * 60)
while E < B
  E = E + 86400
wend
t = (1 + E - B) / i
if t > f then f = t
return

:chk_begin_end
gosub "chk_begin"
gosub "chk_end"
T = ((B - N) * 1000) + get_tick_count
w = B / 3600
x = (B % 3600) / 60
y = E / 3600
z = (E % 3600) / 60
print "BeginEnd", w, x, "-", y, z
sleep D
return

:tiktok
s = T - get_tick_count
if s > 9999 then goto "tiktok2"
print "NextShot", s; "ms,", i; "s"
sleep D
return
:tiktok2
s = (s + 500) / 1000
print "NextShot", s; "s,", i; "s"
sleep D
return

:waitprep
if (T - get_tick_count) < 1000 then return
gosub "tiktok"
z = I
rem AF first, refocus
if m < 10 and (F < 1 or o & 1) then z = J
rem MF first
if m > 9 and F < 1 then z = K
t = T - get_tick_count
while t > (z + 11000)
  wait_click 9500
  is_key k "set"
  if k > 0 then click "shoot_half"
  if k > 0 then sleep A
  gosub "tiktok"
  t = T - get_tick_count
wend
rem MF wakeup
if m > 9 then gosub "sts_MF"
if m > 9 and w = 0 then z = L
if t < (z + 40) then return
sleep (t - (z + 30))
return

:waitshot
t = T - get_tick_count
if t < 40 then return
sleep (t - 30)
return

:frames
if f > 0 then print "Frame   ", F, "of", f else print "Frame   ", F
sleep D
return

:margin
print "Margin  ", t; "ms", u; "ms"
sleep D
return

:main
while 1
  gosub "flashcon"
  gosub "chk_begin_end"
  F = 0
  while f < 1 or F < f
    gosub "waitprep"
    gosub "prefocus"
    F = F + 1
    gosub "waitshot"
    u = get_tick_count

    shoot

    v = get_vbatt
    u = get_tick_count - u
    gosub "frames"
    if v < j then goto "lobatt"
    if g & 1 then gosub "margin"
    T = T + (i * 1000)
  wend
  if a < 1 or b < 0 or c < 0 then goto "done"
  print "Run Daily..."
  sleep D
wend

:restore
rem 'shoot_full' trap
o = 0
:done
set_aflock 0
sleep G
click "shoot_half"
sleep A
if o & 4 then goto "shutdown"
print "'half shoot' to exit..."
wait_click J
is_key k "shoot_half"
if k > 0 then end
goto "shutdown"
:lobatt
print v; "mV, LoBatt exit"
sleep I
:shutdown
shut_down
sleep I
end

Hi I was interested in exploring this script, but found that the links to the script were cold.   So I went searching in the internet archive (wayback machine)  and found the version below from april 2010 - I have not tried it yet.

Code: [Select]
@title daylapse
rem Web Site: [url=http://bugsplatter.id.au/chdk/]http://bugsplatter.id.au/chdk/[/url] - daylapse-2009-06-25a
rem Copyright (C) 2009 Grant Coady email@bugsplatter.id.au -- GPLv2

@param a Run Daily       -      0-1
@param b Start        hour     0-23
@param c Start      minute     0-59
@param d Stop         hour     0-23
@param e Stop       minute     0-59
@param f Frames          -  0-99999
@param i Interval   second  0-99999
@param j Low Battery    mV    >2000
@param m MF Distance    mm 10-65535
@param o Options         &    0-255
@param g Debug Info      &    0-255

@default b -1
@default d -1
@default f 3
@default i 6
@default j 2150
@default m 65535

if b > 23 then b = 23
if c > 59 then c = 59
if d > 23 then d = 23
if e > 59 then e = 59
if i < 5 then i = 5
if j < 2000 then j = 2000
if m < 0 or (m > 1 and m < 10 and m <> 5) then m = 0
if m > 65535 then m = 65535
if g < 0 or g > 255 then g = 0
if o < 0 or o > 255 then o = 0

rem timing ms
rem Awake
A = 400
rem Click
C = 300
rem Display
D = 250
rem General
G = 100

rem waitprep sleep ms
rem AF lock, MF no idle
I = 3000
rem AF first, refocus
J = 6500
rem MF first
K = 6000
rem MF after idle
L = 5500
rem max cam Ready, focus
R = 2500
rem min Begin delay s
B = 11
P = get_propset

if get_mode < 1 then goto "main"
print "Try Record Mode!"
sleep K
end

:sts_fmode
gosub "sts_MF"
if w = 0 then goto "sts_macro"
w = 4
return
:sts_MF
if P = 1 then p = 12 else p = 133
goto "ret_prop"
:sts_macro
if P = 1 then p = 11 else p = 6
goto "ret_prop"
:sts_ready
if P = 1 then p = 67 else p = 115
:ret_prop
w = get_prop p
return

:flashcon
rem option 00110000 -> 0,1,2,3 - no touch, on, off, auto
x = (o / 16) & 3
if x = 0 then return
if x = 3 then x = 0
y = get_flash_mode
if x = y then return
rem sequence for a590, no auto in Av mode
if o & 4 then click "down" else click "up"
sleep C
z = 3
while x <> y and z > 0
  click "up"
  sleep C
  y = get_flash_mode
  z = z - 1
wend
click "set"
sleep C
if x = y then return
print "fail set flash mode", x
sleep D
return

:selfocus
if not (x = 0 or x = 1 or x = 4 or x = 5) then x = 0
gosub "sts_fmode"
if x = w then return
s = 1
if o & 4 then click "up" else click "down"
sleep C
z = 6
while x <> w and z > 0
  click "down"
  sleep C
  gosub "sts_fmode"
  z = z - 1
wend
click "set"
sleep C
if x = w then return
print "fail set focus mode", x
sleep D
return

:chkready
gosub "sts_ready"
t = get_tick_count - 50
z = 0
while w <> 1 and z < R
  sleep 50
  gosub "sts_ready"
  z = get_tick_count - t
wend
if z < R then return
print "wait ready timeout"
sleep D
return

:wakecam
if m > 9 then gosub "sts_MF"
rem no wake for MF mode, repeat, cam awake
if m > 9 and F > 0 and w = 1 then return
rem no propset AF mode sleep/wake status? [2009-06-21]
click "shoot_half"
sleep A
return

:prefocus
gosub "wakecam"
s = 0
if m > 9 then goto "manfocus"
:atofocus
x = m
if not (o & 2) then gosub "selfocus"
if F > 0 and s = 0 and (not (o & 1)) then return
set_aflock 0
sleep G
press "shoot_half"
sleep A
gosub "chkready"
set_aflock 1
sleep G
release "shoot_half"
sleep G
if g & 1 then print "AF Focus", get_focus; "mm", (z + 350); "ms"
if g & 1 then sleep D
return

:manfocus
x = 4
if not (o & 2) then gosub "selfocus"
if F > 0 and s = 0 then return
set_focus m
gosub "chkready"
if g & 1 then print "MF Focus", get_focus; "mm", (z + 350); "ms"
if g & 1 then sleep D
return

:chk_begin
N = get_day_seconds
B = B + N
if b < 0 or c < 0 then return
B = (b * 3600) + (c * 60)
if B < N then B = B + 86400
return

:chk_end
E = B + 10
if d < 0 or e < 0 or f < 0 then return
E = (d * 3600) + (e * 60)
while E < B
  E = E + 86400
wend
t = (1 + E - B) / i
if t > f then f = t
return

:chk_begin_end
gosub "chk_begin"
gosub "chk_end"
T = ((B - N) * 1000) + get_tick_count
w = B / 3600
x = (B % 3600) / 60
y = E / 3600
z = (E % 3600) / 60
print "BeginEnd", w, x, "-", y, z
sleep D
return

:tiktok
s = T - get_tick_count
if s > 9999 then goto "tiktok2"
print "NextShot", s; "ms,", i; "s"
sleep D
return
:tiktok2
s = (s + 500) / 1000
print "NextShot", s; "s,", i; "s"
sleep D
return

:waitprep
if (T - get_tick_count) < 1000 then return
gosub "tiktok"
z = I
rem AF first, refocus
if m < 10 and (F < 1 or o & 1) then z = J
rem MF first
if m > 9 and F < 1 then z = K
t = T - get_tick_count
while t > (z + 11000)
  wait_click 9500
  is_key k "set"
  if k > 0 then click "shoot_half"
  if k > 0 then sleep A
  gosub "tiktok"
  t = T - get_tick_count
wend
rem MF wakeup
if m > 9 then gosub "sts_MF"
if m > 9 and w = 0 then z = L
if t < (z + 40) then return
sleep (t - (z + 30))
return

:waitshot
t = T - get_tick_count
if t < 40 then return
sleep (t - 30)
return

:frames
if f > 0 then print "Frame   ", F, "of", f else print "Frame   ", F
sleep D
return

:margin
print "Margin  ", t; "ms", u; "ms"
sleep D
return

:main
while 1
  gosub "flashcon"
  gosub "chk_begin_end"
  F = 0
  while f < 1 or F < f
    gosub "waitprep"
    gosub "prefocus"
    F = F + 1
    gosub "waitshot"
    u = get_tick_count

    shoot

    v = get_vbatt
    u = get_tick_count - u
    gosub "frames"
    if v < j then goto "lobatt"
    if g & 1 then gosub "margin"
    T = T + (i * 1000)
  wend
  if a < 1 or b < 0 or c < 0 then goto "done"
  print "Run Daily..."
  sleep D
wend

:restore
rem 'shoot_full' trap
o = 0
:done
set_aflock 0
sleep G
click "shoot_half"
sleep A
if o & 4 then goto "shutdown"
print "'half shoot' to exit..."
wait_click J
is_key k "shoot_half"
if k > 0 then end
goto "shutdown"
:lobatt
print v; "mV, LoBatt exit"
sleep I
:shutdown
shut_down
sleep I
end
Old code - has camera specific key sequences and may have other issues related to the use of old functions / propsets etc.     Will take some careful work to clean it up - how important is using this particular script?
Ported :   A1200    SD940   G10    Powershot N    G16

Waterwings thanks for quick response.   

This specific script is NOT essential.  But the reason I am interested...    I need to build an installation for a several month long time lapse.  I have been running tests with current proven intervalometers, such as "Selective Intervalometer" and the basic Intervalometers in the current chdk load.   They are working OK,

BUT, I am concerned about burning out the cmos sensor by having it being live (powered on) for several months.   (Its fine if the camera runs out its life on this project, I actually expect that,  but I just dont want the camera to die three weeks into a 5 month job.)  - (Another concern is that because the cmos is constantly powered, that might cause camera to go into shut-down, if the temp exceeds a safety threshold.  In testing today, the cmos sensor seemed to stay constant at 105 degrees F. ) 

So,  I was investigating wether there are any scripting routines out there, which dont keep the cmos sensor fired up continuously....  thats is that the script shifts the camera into some status in which the script is still running but the sensor is not powered,  then comes alive to shoot for awhile, then back to waiting. ( I wonder if the sensor is not powered while the camera is in play mode?)

Any ideas or suggestions you have much appreciated.  (I have rudimentary programming skills, but pretty new to chdk)

mk



 

So,  I was investigating wether there are any scripting routines out there, which dont keep the cmos sensor fired up continuously....  thats is that the script shifts the camera into some status in which the script is still running but the sensor is not powered,  then comes alive to shoot for awhile, then back to waiting. ( I wonder if the sensor is not powered while the camera is in play mode?)
Ummmm ... how about this :  http://chdk.wikia.com/wiki/Battery_Intervalometer ?   It has many mode but there is one mode that lets you go into "playback" mode when you are not actively shooting.  That should lower the duty cycle on your sensor.  But frankly I suspect your sensor will not be the first thing that fails on your camera.

BTW - several months without a camera reset is probably not a good idea.  The Canon tic timer will wrap before that.


 

Ported :   A1200    SD940   G10    Powershot N    G16


wwngz,  thanks for the script reference, I will check it out.

I do plan to check in on the installation regularly (maybe every week or two)  so I will copy files off and reload the script - power cycle the camera.

When you say  "The Canon tic timer will wrap before that."   Do you have any idea (or even guess) when that might happen?  I suspect there is probably a limit to the number of digits that the tic timer holds?   Thanks again for being tuned in and on the board tonight!  Really helps my productivity.

Thanks again for the tip on your battery intervalometer script.  I have just loaded it up and taken it on a short test run - It looks very promising for trying to give the camera displays and sensor a rest between intervals.  I will do a full test tomorrow.

*

Offline reyalp

  • ******
  • 14117
When you say  "The Canon tic timer will wrap before that."   Do you have any idea (or even guess) when that might happen?  I suspect there is probably a limit to the number of digits that the tic timer holds?   Thanks again for being tuned in and on the board tonight!  Really helps my productivity.
2^31 or 2^32 ms, roughly 25 or 49 days.

However you shouldn't assume that is the only issue you could run into with long run times. The Canon designers would probably only expect the camera to run for as long as a battery lasts in most cases, or perhaps a day or so on an external power power supply. It should work longer than that, but if reliability is really important to you, testing is a good idea.
Don't forget what the H stands for.

Yes...  good points,  Thanks. 

first rule, never assume!   right?

I will report back on the results of this project, it should prove a good very long run test of the potential of chdk and a canon p&s.  In this case a sx40hs.   

(meanwhile,  I will be running a back-up system as safety {a Brinno timelapse camera}  But expect superior results from the canon camera with chdk, for whatever length of time it performs.)


This specific script is NOT essential.  But the reason I am interested...    I need to build an installation for a several month long time lapse.  I have been running tests with current proven intervalometers, such as "Selective Intervalometer" and the basic Intervalometers in the current chdk load.   They are working OK,
...
Any ideas or suggestions you have much appreciated.  (I have rudimentary programming skills, but pretty new to chdk)
http://chdk.setepontos.com/index.php?topic=9969.0
Ported :   A1200    SD940   G10    Powershot N    G16

<< dup >>
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal