Setting G9 focus to infinity and locking it there during a timelapse - General Help and Assistance on using CHDK stable releases - CHDK Forum

Setting G9 focus to infinity and locking it there during a timelapse

  • 31 Replies
  • 17869 Views
Advertisements
I've tried several intervalometer scripts on a G9 and can't figure out how to lock the manual focus to infinity with any of them.  Every shot focuses slightly different and makes for a jumpy timelapse.  One of the scripts I've tried has an option in it for setting the focus to infinity, but all the reading I've done on here says the way the scripter wrote it, it shouldn't work.  This one specifically is yass and it's uses set_prop 6, which about mid way down on this page, http://chdk.wikia.com/wiki/UBASIC/propertyCaseUse says property 6 can't be set.  Does this work on other people's cameras? 

I've tried turning on the G9 camera, getting out of "ALT" mode, using Av and setting the MF to infinity.  Then I get back into "ALT" mode, start the script by pressing the shutter button and immediately it refocuses to something less than infinity.  I'm focusing across my basement, so sure it doesnt' need to be infinity down here, but I want it to stay put!  :D 

Any help is appreciated!

Thanks!

*

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Re: Setting G9 focus to infinity and locking it there during a timelapse
« Reply #1 on: 03 / February / 2011, 09:47:11 »
...One of the scripts I've tried has an option in it for setting the focus to infinity, but all the reading I've done on here says the way the scripter wrote it, it shouldn't work.  This one specifically is yass and it's uses set_prop 6, which about mid way down on this page, http://chdk.wikia.com/wiki/UBASIC/propertyCaseUse says property 6 can't be set.  Does this work on other people's cameras?
Property cases are different for Digic II, Digic III and Digic IV cameras: http://chdk.wikia.com/wiki/PropertyCase

For example, under "Digic III & Digic IV" you will see this entry: "6  RW  Focus Mode (0,1,3,4,5 = Normal, Macro, Infinity, Manual, Super Macro [SX10])"  PropCas 6 has read and write capability for these cameras.

Digic IV PropCas values can be different even with similar camera models such as the SX10 and SX20. I discovered that only some of the values for the SX10 worked on my SX20, so I set about to discover what would work on mine. I just happened to post mine yesterday: http://chdk.setepontos.com/index.php?topic=4348.msg60704#msg60704

You may have to "discover" the proper location on your camera - fairly simple process by the way. Good luck!
« Last Edit: 03 / February / 2011, 09:48:47 by SkyWalker9 »

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Setting G9 focus to infinity and locking it there during a timelapse
« Reply #2 on: 03 / February / 2011, 13:45:59 »
I've tried turning on the G9 camera, getting out of "ALT" mode, using Av and setting the MF to infinity.  Then I get back into "ALT" mode, start the script by pressing the shutter button and immediately it refocuses to something less than infinity. 

If you put your camera to MF mode and then start a script that doesn't emulate keypresses to exit MF mode and doesn't call any commands relating to focus (including writing to any propcases relating to focus) and doesn't shut down the LCD or visit PLAY mode, then your focus shouldn't change.

*

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Re: Setting G9 focus to infinity and locking it there during a timelapse
« Reply #3 on: 03 / February / 2011, 16:45:20 »
I've tried turning on the G9 camera, getting out of "ALT" mode, using Av and setting the MF to infinity.  Then I get back into "ALT" mode, start the script by pressing the shutter button and immediately it refocuses to something less than infinity.

If you put your camera to MF mode and then start a script that doesn't emulate keypresses to exit MF mode and doesn't call any commands relating to focus (including writing to any propcases relating to focus) and doesn't shut down the LCD or visit PLAY mode, then your focus shouldn't change.
Scanning a recent YASS download, I noticed that "yass01a.bas" & "yass02.bas" have press "shoot_half" and release "shoot_half" statements which will cause the camera to re-focus while in MF mode. The "shoot_half" portion is equivalent to pressing the shutter button halfway and on page 126 of your G9 Users Manual, it mentions that while in Manual Focus, pressing the shutter halfway will cause your camera to Auto Focus. You might try commenting out those statements if they are in your YASS script.

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Setting G9 focus to infinity and locking it there during a timelapse
« Reply #4 on: 03 / February / 2011, 17:02:12 »
on page 126 of your G9 Users Manual, it mentions that while in Manual Focus, pressing the shutter halfway will cause your camera to Auto Focus.

Wicked...are there more models that do this? Sounds like a feature that makes Canon's MF mode nearly useless (or very annoying) for people who commonly use zebra, histogram, DoF calculator, fast react MD or other CHDK features or scripts that do their magic during half shoot.

Also sounds like something that would be rather hard to disable by CHDK but maybe could somehow be worked around by e.g. making CHDK poll for MF mode and setting CHDK focus override to new focus distances unless it changes during half shoot.

*

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Re: Setting G9 focus to infinity and locking it there during a timelapse
« Reply #5 on: 03 / February / 2011, 19:44:11 »
on page 126 of your G9 Users Manual, it mentions that while in Manual Focus, pressing the shutter halfway will cause your camera to Auto Focus.
Wicked...are there more models that do this? Sounds like a feature that makes Canon's MF mode nearly useless (or very annoying) for people who commonly use zebra, histogram, DoF calculator, fast react MD or other CHDK features or scripts that do their magic during half shoot.

Also sounds like something that would be rather hard to disable by CHDK but maybe could somehow be worked around by e.g. making CHDK poll for MF mode and setting CHDK focus override to new focus distances unless it changes during half shoot.
The same situation is mentioned in my SX20 Users Manual. The auto focus portion of MF can be disabled on both cameras by setting the Safety MF option to OFF.

edit: This led me to search for a SX20 PropCas for the Safety MF. I found it at PropID 281 (0=OFF and 1=ON)
« Last Edit: 03 / February / 2011, 20:07:26 by SkyWalker9 »

Re: Setting G9 focus to infinity and locking it there during a timelapse
« Reply #6 on: 04 / February / 2011, 00:10:48 »
If you put your camera to MF mode and then start a script that doesn't emulate keypresses to exit MF mode and doesn't call any commands relating to focus (including writing to any propcases relating to focus) and doesn't shut down the LCD or visit PLAY mode, then your focus shouldn't change.


This is what I was trying to accomplish, but can't figure out how to keep the camera from changing the focal length.  Technically, I have two problems.  I have an interval timing issue and a manual focus issue. 

I'm trying to combine the functionality of two scripts that I've found.  Program "Intervalometer.bas" has accurate timing on my G9.  If it tell it 10 second intervals, that's what it does.  Program "intervalometer with day and week" is the functionality I need, but has very erratic intervals on my camera.  it jumps all over the place taking pics every 5-7 seconds when set to 10; when set to 4 minutes, it will take two pics within 5-7 seconds every minute.  Both programs will throw the manual focus out the window.  Weird thing is, the focal length meta data when viewed in windows explorer is always 7mm no matter what.  I don't understand why that value doesn't change.

Both scripts use "Shoot" to take the pic.  I tried to tweak the day of week program to use "Shoot_half" to lock down the focus once at the beginning and then not change the focus from there using press shoot_full and then release shoot_full, trying to emulate holding the shutter button halfway all the time after the initial focus, but it hasn't worked.

Skywalker9, I found safety MF to be propcase 277 for digicIII cameras.  Somewhere in all these wiki searches, I could have swore I found that a G9 was a DigicII, but apparently this was wrong.  the listing for that propcase doesn't say whether or not it's a RO or RW, it's blank.  I'm guessing it's not been confirmed if it works?

Also, i'm not using the yass code, it was the one that I found the infinity focus lock on...I'd love to use it, but my testing has shown it doesn't lock the focus on my G9, and I really need the day of the week feature more than a morning or evening script

Here's the two programs I"m trying to combine, please take a look and see how I can add the accuracy of "intervalometer.bas" to the functionality of "intervalometer with day and week" and keep that manual focus solid.

Thank you for your thoughts!!!

Code: [Select]
++++++++++++++++++++++++++++++++++++++++++
intervalometer with day and week
++++++++++++++++++++++++++++++++++++++++++

rem Author - JoeD, based on original script by Keoeeit
rem x-accuracy for delay, j-accuracy for interval
rem Day of week parameters determine what days the camera takes pictures
rem Proper values are from 0-6, with 0 being Sunday and 6 being Saturday
rem Script has not been optimized


x=-1
j=-1755

@title Ultra Intervalometer with Day of Week and Time
@param a Delay 1st Shot (Mins)
@default a 0
@param b Delay 1st Shot (Secs)
@default b 0
@param c Number of Shots (0 inf)
@default c 0
@param d Interval (Minutes)
@default d 0
@param e Interval (Seconds)
@default e 10
@param p Starting Hour (24 Hr time)
@default p 7
@param q Starting Minute
@default q 0
@param r Ending Hour (24 Hr time)
@default r 16
@param s Ending Minute
@default s 0
@param u Day of Week to Start (0 is Sunday, 6 is Saturday)
@default u 1
@param v Day of Week to End (0 is Sunday, 6 is Saturday)
@default v 6
@param

rem sets number of shots already taken to 0
n=0
rem calculates time in ms between each shot
t=(d*600+e*10)*100+j
if c<1 then let c=0
if t<100 then let t=100
rem calculates first shot delay in seconds
g=(a*60)+b+x
if g<=0 then goto "interval"
rem displays seconds left before shooting begins
for m=1 to g
 print "Intvl Begins:", (g-m)/60; "min", (g-m)%60; "sec"
 sleep 930
 next m
goto "interval"

:interval
  l=get_time 3 
  o=get_time 4 
  y=get_time 5 
  rem following lines calculate current day of week in variable w, 0 is sunday
  if o<3 then gosub "change"
  k=(l+(2*o)+(6*(o+1)/10)+y+(y/4)-(y/100)+(y/400)+1)   
  w=k%7
  if w<u or w>v then goto "weekend"
  rem calculate time of day, determine if it's in range
  i=get_day_seconds
  f=(p*3600)+(q*60)
  h=(r*3600)+(s*60)
  if i<f or i>h then gosub "rest"
     
  n=n+1
  if c=0 then print "Shot", n else print "Shot", n, "of", c
  shoot
  if n=c then shut_down
  sleep t
  goto "interval"
 
:change
  o=o+12
  y=y-1
  return
 
:rest
do
sleep 60000
i=get_day_seconds
until i>=f and i<=h
return

:weekend
i=get_day_seconds
z=(86400-i)
goto "interval"



Code: [Select]
++++++++++++++++++++++++++++++++++++++++++++++++++++
intervalometer.bas
++++++++++++++++++++++++++++++++++++++++++++++++++++

rem  author Divalent, based on my "simple intervalometer" script previously posted
rem     (which in turn was based on the ONMI intervalometer of Keoeeit)
rem  Camera: S3, and other Digic II camera's
rem  CHDK version: Fingalo's versions v106 or later
rem    (must have get_tick_count and get/set prop)
rem
rem  Note: this intervalometer only shoots in photo mode (not video or burst)
rem
@title Accurate Intervalometer
@param a Number of Shots
@default a 180
@param e Interval (Mins)
@default e 0
@param f Interval (Secs)
@default f 2
@param g Interval (0.1 Secs)
@default g 0
@param h image size (0,1,2,4,5)
@default h 4

  if e<0 then e=0
  if f<0 then f=0
  if g<0 then g=0

rem  TURN RAW OFF!  (this is my preference. You can delete)
  set_raw 0

rem  Turn NR off.  (I usually have this off, but just in case)
  set_raw_nr 1

rem ensure # of shots more than 1
  if a<2 then a=2

rem d = user specified cycle time (in 0.1 sec units)
  d=e*600+f*10+g
rem now convert d to msecs (same units as get_tick_count uses)
  d=d*100
  if d<1 then d=1

rem  ========  Digic III cameras, remove this section =========
rem, get jpg Image quality (= 0,1,2 from best to worst)
rem   get_prop 23 i
rem explicitly set quality to best
rem  set_prop 23 0

rem, get image size 24 = 0, 1, 2, 4, 8 for L, M1, M2, S, W
rem  get_prop 24 j
rem, check image size variable, force to a valid number
rem  if h<0 then h=0
rem  if h>4 then h=8
rem  if h=3 then h=4
rem  set_prop 24 h
rem  ========  end of Digic II camera-specific section =========

  n=1
rem start with initial pause of 1 sec
  sleep 1000
  t=get_tick_count
  shoot
  sleep 100
  print "Shot", n, "of", a

rem now we've done the first shot.  do the rest

  for n=2 to a
  s=t+d
:wait_loop
  t=get_tick_count
  if t<s then goto "wait_loop"
  shoot
  sleep 100
  print "Shot", n, "of", a
  next n

rem, restore 23 & 24 Image quality and size
  set_prop 23 i
  set_prop 24 j

  end


*

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Re: Setting G9 focus to infinity and locking it there during a timelapse
« Reply #7 on: 04 / February / 2011, 21:14:00 »
...Technically, I have two problems.  I have an interval timing issue and a manual focus issue...I'm trying to combine the functionality of two scripts that I've found...Program "Intervalometer.bas" has accurate timing on my G9...Program "intervalometer with day and week" is the functionality I need, but has very erratic intervals on my camera.

I found safety MF to be propcase 277 for digicIII cameras...the listing for that propcase doesn't say whether or not it's a RO or RW, it's blank.  I'm guessing it's not been confirmed if it works?
The timing issue is peculiar to the second script because it doesn't use the "tick_count" command like the first script. After looking at both of the scripts I decided to create my own version - I still need to finish testing, but should have something for you soon. There will be no PropCas statements, so you should be able to use it on your G9.

The second issue of the auto focus while using MF makes me think that there is one or more camera settings that may need to be changed. I can only offer some things to try (if you haven't already). When using this script, shoot in P, Tv, Av, or M mode, set the Safety MF to OFF, try with setting AF Lock OFF. Hope one (or more) of those help.

Since the PropCas "RW" designation was left blank probably means that someone found the PropID (can read the value) but didn't get around to testing if it can be changed (write).
Good luck!
« Last Edit: 04 / February / 2011, 21:17:20 by SkyWalker9 »

Re: Setting G9 focus to infinity and locking it there during a timelapse
« Reply #8 on: 05 / February / 2011, 11:36:17 »
After looking at both of the scripts I decided to create my own version - I still need to finish testing, but should have something for you soon. There will be no PropCas statements, so you should be able to use it on your G9.

Awesome, I would really appreciate the help!

I am shooting in Av mode and I have tried the safety MF setting...but didn't know what i was doing with the MF setting, just found someone that mentioned it on the wiki somewhere else.  I'll mess with it again and pay more attention.  Right now it's turned "on".

thanks again!   

*

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Re: Setting G9 focus to infinity and locking it there during a timelapse
« Reply #9 on: 05 / February / 2011, 18:24:26 »
@spe672
Here is my version called "Selective Intervalometer". I have tried to test most of the specifics, however I wasn't able to test long power on scenarios because I do not have a power adapter yet. Here are the specifics:

Parameters
- Number of Shots
- Interval (mins)
- Interval (secs)
- Starting Hour (24 Hour time)
- Starting Minute
- Ending Hour (24 Hour time)
- Ending Minute
- Start DOW (0=Sun..6=Sat)
- End DOW (0=Sun..6=Sat)   <==  DOW = Day of Week

1. The script uses "tick_count" statements in order to keep the interval times very accurate.
2. There are two error checks that can terminate the script early on:
- if Start Time is after End Time
- if Start Day of Week is after End Day of Week
3. A caution message will be displayed if the Image Sabilization (IS) is enabled, since this script normally requires a tripod or hard surface.
4. Excluding any error or caution messages, the script will display the following info as a reminder:
.    Today is (current DOW)
.    Start on (the DOW you selected)
.    End on (the DOW you selected)
5. There is a built in 1 second delay to allow camera vibrations to cease.
6. The script will automatically shutdown when the last shot has been taken.
7. No allowance for checking the amount of space remaining on the SD Card has been integrated into the script, so this will be something the individual will need to monitor/allow for in setting the number of shots.

Please test and see if there is anything I may have overlooked. During my testing I noticed that the first shot occurs 19 seconds after the Start time for the day - I'm going to try and determine the cause. Regardless of the outcome, the interval times were exactly to the second on my sequences, so hopefully you will have similar results.

Save the script as a *.BAS file and place in the CHDK/SCRIPTS folder to use.

Code: [Select]
rem Author SkyWalker9
@title Selective Intervalometer
@param a Number of Shots
@default a 180
@param e Interval (mins)
@default e 5
@param f Interval (secs)
@default f 0
@param p Starting Hour (24 Hr time)
@default p 7
@param q Starting Minute
@default q 0
@param r Ending Hour (24 Hr time)
@default r 18
@param s Ending Minute
@default s 0
@param u Start DOW (0=Sun..6=Sat)
@default u 1
@param v End DOW (0=Sun..6=Sat)
@default v 6

rem Check input variables for proper values
  if a<2 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
  if u<0 then u=0
  if u>6 then u=6
  if v<0 then v=0
  if v>6 then v=6

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

rem Calculate number of shots in time period (1 min=60K "ticks")
  N=((r*60+s)-(p*60+q))*60000+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 and exit script
  if r>=p then goto "ok1"
    print "START Time after END"
    end
:ok1

rem Print message if Start Day of Week is after End Day of Week and exit script
  if v>=u then goto "ok2"
    print "START DOW after END"
    end
:ok2

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

  gosub "dayofweek"
  select w
    case 0; print "Today is Sun"
    case 1; print "Today is Mon"
    case 2; print "Today is Tue"
    case 3; print "Today is Wed"
    case 4; print "Today is Thur"
    case 5; print "Today is Fri"
    case 6; print "Today is Sat"
  end_select
  select u
    case 0; print "Start on Sun"
    case 1; print "Start on Mon"
    case 2; print "Start on Tue"
    case 3; print "Start on Wed"
    case 4; print "Start on Thur"
    case 5; print "Start on Fri"
    case 6; print "Start on Sat"
  end_select
  select v
    case 0; print "End on Sun"
    case 1; print "End on Mon"
    case 2; print "End on Tue"
    case 3; print "End on Wed"
    case 4; print "End on Thur"
    case 5; print "End on Fri"
    case 6; print "End on Sat"
  end_select

rem Allows camera vibrations to stop
  sleep 1000

rem Initializes shot counter; script terminate
rem when n=a in the "take_shots" subroutine
  n=1

rem -- Do not add comments after this point ---

:check_day
  gosub "dayofweek"
  if w>=u and w<=v then gosub "check_time"
  goto "check_day"

:check_time
  F=get_time 0
  Q=get_time 1
  F=F*100+Q
  if F<p or F>r then return
  gosub "take_shots"
  goto "check_time"

:take_shots
  for i=1 to N
    b=get_tick_count
    shoot
    sleep 100
    print "Shot", n, "of", a
    if n=a then shut_down
    n=n+1
    s=b+d
:wait_loop
    b=get_tick_count
    if b<s then goto "wait_loop"
  next i
  return

: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
end

 

Related Topics


SimplePortal © 2008-2014, SimplePortal