Selective Intervalometer (days, days of week, hours/min, intervals min/sec) - page 3 - Completed and Working Scripts - CHDK Forum supplierdeeply

Selective Intervalometer (days, days of week, hours/min, intervals min/sec)

  • 88 Replies
  • 36732 Views
*

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Advertisements
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: 09 / October / 2011, 15:22:37 by SkyWalker9 »

*

Offline SkyWalker9

  • ****
  • 301
  • 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: 09 / October / 2011, 15:23:49 by SkyWalker9 »

Re: Selective Intervalometer (days, days of week, hours/min, intervals min/sec)
« Reply #22 on: 06 / December / 2011, 10: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

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Re: Selective Intervalometer (days, days of week, hours/min, intervals min/sec)
« Reply #23 on: 06 / December / 2011, 23: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.


*

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Re: Selective Intervalometer (days, days of week, hours/min, intervals min/sec)
« Reply #24 on: 19 / December / 2011, 10: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.

Re: Selective Intervalometer (days, days of week, hours/min, intervals min/sec)
« Reply #25 on: 21 / December / 2011, 10: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

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Re: Selective Intervalometer (days, days of week, hours/min, intervals min/sec)
« Reply #26 on: 21 / December / 2011, 13: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.

Hi all.

Im trying to take a serie of photos every days of week between 10pm to 7 am.

My problem is: when the intervalometer is running, the camera turns of after some minutes.
The camera have a power supply.

I try to change the LCD off to secript, never, etc... but always turn off.
The camera is a Sx 130 IS


*

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
"...when the intervalometer is running, the camera turns of after some minutes. The camera have a power supply. I try to change the LCD off to secript, never, etc... but always turn off. The camera is a Sx 130 IS
The reason the camera keeps turning off is due to the power saving function of the SX130; the LCD screen shut-off time can also be changed on your SX130. Both settings are normally desirable to conserve battery power. However, since you are using a power supply these settings should be changed when using intervalometer scripts since you don't want the camera to shut off while the script is running.

According to the SX130 User's Guide, the Power Saving Function can be changed using the instructions on page 143, "Turning off the Power Saving Function"; the LCD screen shut-off time can be changed using the instructions on page 144, "Setting the Screen Shut-off time". Good luck!
« Last Edit: 16 / March / 2012, 12:41:22 by SkyWalker9 »

I am new to CHDK. I am having some issues and not sure if it is me, the camera, or the script.

I wanted to do some time lapse. The plan is to take a picture every day until late fall of my garden growing. I decided instead of just one picture a day I would take a picture every 15 min during daylight hours. That way during playback each day would last about a second.

I got a Canon A800 second hand (software still in Beta). This is day three in my experiment.

I am currently using batteries. And going through them more quickly than expected. I am not even getting 30 pictures from my NiMH.

I have the LCD set to turn off after 10 seconds. I have the override to disable the LCD to never. This is working, the screen comes on to take a picture and turns off.

I have the script set to auto run.

Question 1: When the camera is sitting idle waiting for the next shot is it using lots of power? Although I did have the screen on several times adjusting and testing various settings the batteries are not lasting a whole day. Are there other power saving options that I missed? Or is this a bug with the A800 beta software. With so few pictures being taken I was hoping the batteries would last several days.

Question 2: Can the zoom setting be remembered from when the camera was last on?
When ever the camera is turned back on (like when the batteries need changed), the previous zoom setting is not remembered so I need to interrupt the script, get into regular mode, adjust the zoom, then start the script again. Is there a way to avoid this?

Question 3: Even though I think I set the camera to use a focus distance it is refocusing for each shot. What are the correct steps to ensure the camera does not refocus? Trying to save battery power.

Question 4: If I have the script to start on the hour and take a picture every 15 min I would expect the shot to happen on the 15 min marks regardless of what time the script was restarted.

Jim

 

Related Topics