Author Topic: Selective Intervalometer (days, days of week, hours/min, intervals min/sec)  (Read 3910 times)

Offline bx500ri

  • Newbie
  • *
  • Posts: 1
Hello - newbie here! Using a Canon Ixus 75.
Script works great! Thank you.
We would like to leave it shooting between 6am and 8pm, monday to friday continually with 30second intervals. However, it looks like it will only shoot upto 999 shots. Is that right, or is there a way of capturing more in one go? We ask as the camera will be left up a pole for the week.

Also, is there anyway to turn the display off once its all up and running?

Thanks very much for any suggestions.
« Last Edit: 11 / July / 2011, 02:01:16 by bx500ri »

Offline SkyWalker9

  • Sr. Member
  • ****
  • Posts: 270
  • SX20 IS (fw 1.02b)
...it looks like it will only shoot upto 999 shots. Is that right, or is there a way of capturing more in one go?...
@bx500ri

I re-checked the script and realized I forgot to change a statement I used during testing. The statement was near the top of the script where the input parameters were being checked. The statement is "if a<2 then a=2". It should read "if a<0 then a=2"

Changing this statement allows you to set the "Number of Shots" parameter to zero. When set to zero, the script will shoot as many photos as your memory card can hold (using the other criteria you've set, such as days of week, hours, etc.) I initially designed the script to have this capability, but forgot to change the line of code after testing.

I've updated both of the scripts so you can either re-download the script or just edit the script you have.

Quote
...Using a Canon Ixus 75...is there anyway to turn the display off once its all up and running
Since I don't have this model of camera, I'll have to defer to another CHDK user that has an IXUS 75.

Since I'm doing volunteer work this summer, I probably won't be able to re-check this posting very often. Hope this helps!
« Last Edit: 11 / July / 2011, 22:26:14 by SkyWalker9 »

Offline peterparker

  • Newbie
  • *
  • Posts: 3
Re: Selective Intervalometer (days, days of week, hours/min, intervals min/sec)
« Reply #17 on: 12 / September / 2011, 23:59:14 »
Hi,

is it possible to set different timeperiods depending on the day?

e.g.: take a photo every 15s Tuesdays from 8PM to 11PM and Saturdays from 11AM to 23:59PM.

(I am new to CHDK, haven't used it yet. So please be indulgent towards me, if it's a bad question.)

Greetings from Germany,
pp

Offline SkyWalker9

  • Sr. Member
  • ****
  • Posts: 270
  • SX20 IS (fw 1.02b)
Re: Selective Intervalometer (days, days of week, hours/min, intervals min/sec)
« Reply #18 on: 13 / September / 2011, 06:47:59 »
...is it possible to set different timeperiods depending on the day?

e.g.: take a photo every 15s Tuesdays from 8PM to 11PM and Saturdays from 11AM to 23:59PM...I am new to CHDK, haven't used it yet. So please be indulgent towards me, if it's a bad question...
First off, this is certainly NOT a bad question. Unfortunately, this script (as written) cannot do what you ask. It would require modifying the initial parameter section and involve some careful program changes to make it work as you want -- but I have an idea what needs to be changed.

I don't have a lot of free time right now, but this is DEFINITELY something I'll try when I get a chance - I think it could be very useful.

Offline CNW

  • Newbie
  • *
  • Posts: 3
Re: Selective Intervalometer - DOW On
« Reply #19 on: 09 / October / 2011, 09:15:49 »
Is there a way to alter script to turn all days on by default rather than off for DOW.  This is typically not an issue with how I use the script.  Thank you so much for your work on this script!

Offline SkyWalker9

  • Sr. Member
  • ****
  • Posts: 270
  • SX20 IS (fw 1.02b)
Is there a way to alter script to turn all days on by default rather than off for DOW.  This is typically not an issue with how I use the script.  Thank you so much for your work on this script!
Great idea! I created the following modified script that does exactly what you requested. After starting, the script will display the question  "Every Day of Week?" followed by "Left=No  Right=Yes". If you select the LEFT button then it will go though the full DOW selection process as before. If you select the RIGHT button, then the script will skip the DOW selection process. If you use any other key (other than the shutter button) the script will wait until you press a LEFT or RIGHT button. I prefer this modification over the previous script.

Code: [Select]
rem Author SkyWalker9
@title Selective Intervalometer
@param a Number of Shots
@default a 10
@param e Interval (mins)
@default e 5
@param f Interval (secs)
@default f 0
@param p Starting Hour (24 Hr)
@default p 7
@param q Starting Minute
@default q 0
@param r Ending Hour (24 Hr)
@default r 18
@param s Ending Minute
@default s 0

rem Check input variables for proper values
  if a<0 then a=2
  if e<0 then e=0
  if f<0 then f=0
  if p<0 then p=0
  if p>23 then p=23
  if q<0 then q=0
  if q>59 then q=59
  if r<0 then r=0
  if r>23 then r=23
  if s<0 then s=0
  if s>59 then s=59
  J=0

rem Calculate user specified cycle/interval time in ms
  d=(e*600+f*10)*100
  if d<1 then d=1

rem Next two statements combine "hour" and "minutes" (hour:11 minute:30 = 1130)
rem This reduces the number of "if" statements required in "check_time" subroutine
  P=p*100+q
  R=r*100+s

rem Print Error message if Start Time is after End Time print msg & exit
  if r>=p then goto "ok1"
    print "START Time after END"
    end
:ok1

rem this section selects each day of week (DOW) & packs the DOWs into the single variable L

rem This sets DOW to ALL (every day of the week)

  L=1234*1000+567
  cls
  print "Every Day of Week?"
  print "Left=No  Right=Yes"

:sel_again
  wait_click
  is_key k "left"
  if k=1 then goto "sel_DOW"
  is_key k "right"
  if k=1 then goto "sel_fini"
  goto "sel_again"
 
:sel_DOW
  L=0
  for i = 1 to 7
    cls
    print "Left=No  Right=Yes"
    print "Set when done"
    select i
      case 1; print "Sun: No"
      case 2; print "Mon: No"
      case 3; print "Tue: No"
      case 4; print "Wed: No"
      case 5; print "Thu: No"
      case 6; print "Fri: No"
      case 7; print "Sat: No"
    end_select
    print " "
    K=0
    gosub "sel_choose"
    if K=0 then goto "sel_off"
      L=L*10+i
:sel_off
  next i
  goto "sel_fini"

rem This subroutine lets user decide which Days of the week to use in script
rem option K  0=No 1=Yes

:sel_choose
  wait_click
  is_key k "left"
  if k=1 then let K=0
  is_key k "right"
  if k=1 then let K=1
  is_key k "set"
  if k=1 then goto "sel_exit"
  cls
  print "Left=No  Right=Yes"
  print "Set when done"
  if K<>0 then goto "sel_opt_on"
  select i
    case 1; print "Sun: No"
    case 2; print "Mon: No"
    case 3; print "Tue: No"
    case 4; print "Wed: No"
    case 5; print "Thu: No"
    case 6; print "Fri: No"
    case 7; print "Sat: No"
  end_select
  goto "sel_redo"
:sel_opt_on
  select i
    case 1; print "Sun: Yes"
    case 2; print "Mon: Yes"
    case 3; print "Tue: Yes"
    case 4; print "Wed: Yes"
    case 5; print "Thu: Yes"
    case 6; print "Fri: Yes"
    case 7; print "Sat: Yes"
  end_select
:sel_redo
  print " "
  goto "sel_choose"
:sel_exit
  return

:sel_fini

if a<>0 then goto "bypass1"
:v2_exit
  cls
  print "Left(-)  Right(+)"
  print "Set when done"
  print "Number of days: "J
  print " "
  wait_click
  is_key k "left"
  if k=1 then let J=J-1
  is_key k "right"
  if k=1 then let J=J+1
  is_key k "set"
  if k=1 then goto "bypass1"
  if J<0 then let J=0
  goto "v2_exit"
:bypass1
  cls

rem Print a Caution message if Image Stabilization (IS) is enabled
  x=get_IS_mode
  if x<>3 then print "Caution: IS enabled"

rem Displays the disk space/free disk space in MB & percent
  x=get_disk_size
  x=x/1000
  y=get_free_disk_space
  y=y/1000
  z=(y*100)/x
  print "Free Space "y"MB ("z"%)"
  print " "
 
rem Built in delay of 1000 ms to allow camera vibrations to stop plus 1000 ms
rem to temporaily display the Caution msg if needed.
  sleep 2000

rem Calculate length of total time period (1 min=60K "ticks"). This is done to
rem allow use of "tick_count" instead of "sleep" statements. This results in more
rem consistent/dependable/accurate interval cycles.
  N=((r*60+s)-(p*60+q))*60000

rem This calculation corrects the length of time period above if the user starts
rem the script during the DOWs & Start/End range they have selected
  O=N
  x=L
  gosub "dayofweek"
:test_DOW1
   K=(x%10)-1
   if w=K then goto "change"
   x=x/10
   if x<1 then goto "ok3"
   goto "test_DOW1"
:change
  F=get_time 2
  Q=get_time 1
  x=F*100+Q
  if x>=P and x<R then O=((r*60+s)-(F*60+Q))*60000
:ok3

rem Initializes shot counter; script shutdown camera when n=a in the "take_shots" section
  n=1

rem if Number of Days J<>0 then use Number of Days method; V counts up to J
  if J=0 then goto "bypass"
   gosub "dayofweek" 
   Y=get_time 5
   I=Y-2000
   H=D
   G=M
   v=w
   V=1
:bypass

rem -- Do not add comments after this point ---
  cls
  if J=0 then print a" Shots at "e"m "f"s" else print G"/"H"/"I" +"J-1" days "e"m "f"s"
  print "S M T W T F S"
  print "1 2 3 4 5 6 7: "L
  print "Hours "p":"q"-"r":"s
  print "Waiting..."
 
:check_day
  gosub "dayofweek"
  x=L
  if J=0 then goto "test_DOW2"
  if w=v then goto "test_DOW2"
   V=V+1
   if V>J then shut_down
   v=w
 
:test_DOW2
  K=(x%10)-1
  if w=K then goto "check_time"
  x=x/10
  if x<1 then goto "check_day"
  goto "test_DOW2"

:check_time
  F=get_time 2
  Q=get_time 1
  F=F*100+Q
  if F>=P and F<R then goto "take_shots"
  goto "check_day"

:take_shots
    i=get_tick_count
    i=i+O
:more
    b=get_tick_count
    x=get_time 2
    y=get_time 1
    z=get_time 0
    shoot
    sleep 600
    W=w
    gosub "info"
    if n=a and J=0 then shut_down
    n=n+1
    S=b+d
:wait_loop
    b=get_tick_count
    if b<S then goto "wait_loop"
    if b<i then goto "more"
    O=N
    if V=J then v=W+1
    goto "check_day"

:dayofweek
  D=get_time 3
  M=get_time 4
  Y=get_time 5
  A = (14-M)/12
  Y = Y-A
  M = M+12*A-2
  w = (D+Y+(Y/4)-(Y/100)+(Y/400)+(31*M/12))%7
  return

:info
  cls
  if J=0 then print a" Shots at "e"m "f"s" else print G"/"H"/"I" +"J-1" days "e"m "f"s"
  print "S M T W T F S"
  print "1 2 3 4 5 6 7: "L
  print "Hours "p":"q"-"r":"s
  select W
      case 0; print "Last:"n" Sun "x":"y":"z
      case 1; print "Last:"n" Mon "x":"y":"z
      case 2; print "Last:"n" Tue "x":"y":"z
      case 3; print "Last:"n" Wed "x":"y":"z
      case 4; print "Last:"n" Thu "x":"y":"z
      case 5; print "Last:"n" Fri "x":"y":"z
      case 6; print "Last:"n" Sat "x":"y":"z
  end_select
  return
 
end
« Last Edit: 10 / October / 2011, 00:22:37 by SkyWalker9 »

Offline SkyWalker9

  • Sr. Member
  • ****
  • Posts: 270
  • SX20 IS (fw 1.02b)
Here is a modification to the script that includes the "all days on by default" option for the DOW (previous posting) and that eliminates excessive key presses. I decided I didn't want to verify the DOW selection each time during the longer DOW selection process. In this modified version you just press the LEFT or RIGHT button to proceed to the next day of the week. This can save key presses and time.

Code: [Select]
rem Author SkyWalker9
@title Selective Intervalometer
@param a Number of Shots
@default a 10
@param e Interval (mins)
@default e 5
@param f Interval (secs)
@default f 0
@param p Starting Hour (24 Hr)
@default p 7
@param q Starting Minute
@default q 0
@param r Ending Hour (24 Hr)
@default r 18
@param s Ending Minute
@default s 0

rem Check input variables for proper values
  if a<0 then a=2
  if e<0 then e=0
  if f<0 then f=0
  if p<0 then p=0
  if p>23 then p=23
  if q<0 then q=0
  if q>59 then q=59
  if r<0 then r=0
  if r>23 then r=23
  if s<0 then s=0
  if s>59 then s=59
  J=0

rem Calculate user specified cycle/interval time in ms
  d=(e*600+f*10)*100
  if d<1 then d=1

rem Next two statements combine "hour" and "minutes" (hour:11 minute:30 = 1130)
rem This reduces the number of "if" statements required in "check_time" subroutine
  P=p*100+q
  R=r*100+s

rem Print Error message if Start Time is after End Time print msg & exit
  if r>=p then goto "ok1"
    print "START Time after END"
    end
:ok1

rem this section selects each day of week (DOW) & packs the DOWs into the single variable L

rem This sets DOW to ALL (every day of the week)

  L=1234*1000+567
  cls
  print "Every Day of Week?"
  print "Left=No  Right=Yes"

:sel_again
  wait_click
  is_key k "left"
  if k=1 then goto "sel_DOW"
  is_key k "right"
  if k=1 then goto "sel_fini"
  goto "sel_again"

:sel_DOW
  L=0
  for i = 1 to 7
    cls
    print "Left=No  Right=Yes"
    select i
      case 1; print "Sunday?"
      case 2; print "Monday?"
      case 3; print "Tueday?"
      case 4; print "Wednesday?"
      case 5; print "Thusday?"
      case 6; print "Friday?"
      case 7; print "Saturday?"
    end_select
    print " "
    K=9
:sel_choose
  wait_click
  is_key k "left"
  if k=1 then let K=0
  is_key k "right"
  if k=1 then let K=1
  if K=9 then goto "sel_choose"
  if K=0 then goto "sel_off"
    L=L*10+i
:sel_off
  next i

:sel_fini

if a<>0 then goto "bypass1"
:v2_exit
  cls
  print "Left(-)  Right(+)"
  print "Set when done"
  print "Number of days: "J
  print " "
  wait_click
  is_key k "left"
  if k=1 then let J=J-1
  is_key k "right"
  if k=1 then let J=J+1
  is_key k "set"
  if k=1 then goto "bypass1"
  if J<0 then let J=0
  goto "v2_exit"
:bypass1
  cls

rem Print a Caution message if Image Stabilization (IS) is enabled
  x=get_IS_mode
  if x<>3 then print "Caution: IS enabled"

rem Displays the disk space/free disk space in MB & percent
  x=get_disk_size
  x=x/1000
  y=get_free_disk_space
  y=y/1000
  z=(y*100)/x
  print "Free Space "y"MB ("z"%)"
  print " "
 
rem Built in delay of 1000 ms to allow camera vibrations to stop plus 1000 ms
rem to temporaily display the Caution msg if needed.
  sleep 2000

rem Calculate length of total time period (1 min=60K "ticks"). This is done to
rem allow use of "tick_count" instead of "sleep" statements. This results in more
rem consistent/dependable/accurate interval cycles.
  N=((r*60+s)-(p*60+q))*60000

rem This calculation corrects the length of time period above if the user starts
rem the script during the DOWs & Start/End range they have selected
  O=N
  x=L
  gosub "dayofweek"
:test_DOW1
   K=(x%10)-1
   if w=K then goto "change"
   x=x/10
   if x<1 then goto "ok3"
   goto "test_DOW1"
:change
  F=get_time 2
  Q=get_time 1
  x=F*100+Q
  if x>=P and x<R then O=((r*60+s)-(F*60+Q))*60000
:ok3

rem Initializes shot counter; script shutdown camera when n=a in the "take_shots" section
  n=1

rem if Number of Days J<>0 then use Number of Days method; V counts up to J
  if J=0 then goto "bypass"
   gosub "dayofweek" 
   Y=get_time 5
   I=Y-2000
   H=D
   G=M
   v=w
   V=1
:bypass

rem -- Do not add comments after this point ---
  cls
  if J=0 then print a" Shots at "e"m "f"s" else print G"/"H"/"I" +"J-1" days "e"m "f"s"
  print "S M T W T F S"
  print "1 2 3 4 5 6 7: "L
  print "Hours "p":"q"-"r":"s
  print "Waiting..."
 
:check_day
  gosub "dayofweek"
  x=L
  if J=0 then goto "test_DOW2"
  if w=v then goto "test_DOW2"
   V=V+1
   if V>J then shut_down
   v=w
 
:test_DOW2
  K=(x%10)-1
  if w=K then goto "check_time"
  x=x/10
  if x<1 then goto "check_day"
  goto "test_DOW2"

:check_time
  F=get_time 2
  Q=get_time 1
  F=F*100+Q
  if F>=P and F<R then goto "take_shots"
  goto "check_day"

:take_shots
    i=get_tick_count
    i=i+O
:more
    b=get_tick_count
    x=get_time 2
    y=get_time 1
    z=get_time 0
    shoot
    sleep 600
    W=w
    gosub "info"
    if n=a and J=0 then shut_down
    n=n+1
    S=b+d
:wait_loop
    b=get_tick_count
    if b<S then goto "wait_loop"
    if b<i then goto "more"
    O=N
    if V=J then v=W+1
    goto "check_day"

:dayofweek
  D=get_time 3
  M=get_time 4
  Y=get_time 5
  A = (14-M)/12
  Y = Y-A
  M = M+12*A-2
  w = (D+Y+(Y/4)-(Y/100)+(Y/400)+(31*M/12))%7
  return

:info
  cls
  if J=0 then print a" Shots at "e"m "f"s" else print G"/"H"/"I" +"J-1" days "e"m "f"s"
  print "S M T W T F S"
  print "1 2 3 4 5 6 7: "L
  print "Hours "p":"q"-"r":"s
  select W
      case 0; print "Last:"n" Sun "x":"y":"z
      case 1; print "Last:"n" Mon "x":"y":"z
      case 2; print "Last:"n" Tue "x":"y":"z
      case 3; print "Last:"n" Wed "x":"y":"z
      case 4; print "Last:"n" Thu "x":"y":"z
      case 5; print "Last:"n" Fri "x":"y":"z
      case 6; print "Last:"n" Sat "x":"y":"z
  end_select
  return
 
end
« Last Edit: 10 / October / 2011, 00:23:49 by SkyWalker9 »

Offline peterparker

  • Newbie
  • *
  • Posts: 3
Re: Selective Intervalometer (days, days of week, hours/min, intervals min/sec)
« Reply #22 on: 06 / December / 2011, 20:26:05 »
...is it possible to set different timeperiods depending on the day?

e.g.: take a photo every 15s Tuesdays from 8PM to 11PM and Saturdays from 11AM to 23:59PM...I am new to CHDK, haven't used it yet. So please be indulgent towards me, if it's a bad question...
First off, this is certainly NOT a bad question. Unfortunately, this script (as written) cannot do what you ask. It would require modifying the initial parameter section and involve some careful program changes to make it work as you want -- but I have an idea what needs to be changed.

I don't have a lot of free time right now, but this is DEFINITELY something I'll try when I get a chance - I think it could be very useful.

Hi,

any news? did you try it already?

pp

Offline SkyWalker9

  • Sr. Member
  • ****
  • Posts: 270
  • SX20 IS (fw 1.02b)
Re: Selective Intervalometer (days, days of week, hours/min, intervals min/sec)
« Reply #23 on: 07 / December / 2011, 09:33:40 »
...is it possible to set different timeperiods depending on the day?

e.g.: take a photo every 15s Tuesdays from 8PM to 11PM and Saturdays from 11AM to 23:59PM...I am new to CHDK, haven't used it yet. So please be indulgent towards me, if it's a bad question...
First off, this is certainly NOT a bad question. Unfortunately, this script (as written) cannot do what you ask. It would require modifying the initial parameter section and involve some careful program changes to make it work as you want -- but I have an idea what needs to be changed.

I don't have a lot of free time right now, but this is DEFINITELY something I'll try when I get a chance - I think it could be very useful.
...any news? did you try it already?
I tried a few things but soon found that my initial ideas for changes were more complicated than I first thought. I ran out of time after I tried some coding changes, so I had to put on hold for awhile. I'll set aside some time in the next few days and I see if I can change this script or if it would be better to just design a new script.

CHDK Forum

Re: Selective Intervalometer (days, days of week, hours/min, intervals min/sec)
« Reply #23 on: 07 / December / 2011, 09:33:40 »

Offline SkyWalker9

  • Sr. Member
  • ****
  • Posts: 270
  • SX20 IS (fw 1.02b)
Re: Selective Intervalometer (days, days of week, hours/min, intervals min/sec)
« Reply #24 on: 19 / December / 2011, 20:32:38 »
After looking at the code and what would be needed to make the changes, I believe it would be best to write a script specifically for this option. I remember doing extensive testing when I wrote this script and I suspect there would be just as much testing required for a new script -- so I'll leave the writing of a new script for someone else that has more time.

Offline peterparker

  • Newbie
  • *
  • Posts: 3
Re: Selective Intervalometer (days, days of week, hours/min, intervals min/sec)
« Reply #25 on: 21 / December / 2011, 20:05:23 »
Nevertheless thanks for trying!

I will see if I can get it done on my own. Is it easier if I don't need a selection-option? (I guess I should read how to script first, then I would probably know the answer)

Offline SkyWalker9

  • Sr. Member
  • ****
  • Posts: 270
  • SX20 IS (fw 1.02b)
Re: Selective Intervalometer (days, days of week, hours/min, intervals min/sec)
« Reply #26 on: 21 / December / 2011, 23:58:51 »
Is it easier if I don't need a selection-option?
Definitely a lot easier and streamlined if you plan on using different times for different days of the week. If the times won't change very much, you could "hard code" the times rather than getting the inputs from param statements or inputting them at runtime.

If the times needed changing later, you could (1) "tweak" the code and re-save to the camera, or (2) use the Text Editor written by outslider (http://chdk.setepontos.com/index.php?topic=6465.msg68653#msg68653) and tweak the times while in-the-field.

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal