Set A Static Focus Intervolometer - LUA Scripting - CHDK Forum

Set A Static Focus Intervolometer

  • 16 Replies
  • 8375 Views
Set A Static Focus Intervolometer
« on: 06 / April / 2009, 10:11:26 »
Advertisements
I was wondering if anyone would no how to modify the intervolometer script so the the camera does not refocus every time a shot is take. While it was running I had trouble with the auto focus refocusing on something in the background. I experimented a little with the code, but nothing I did really worked. . .

Thanks!

Re: Set A Static Focus Intervolometer
« Reply #1 on: 06 / April / 2009, 11:03:04 »
which specific script were you using?

this should be easy to fix.

Re: Set A Static Focus Intervolometer
« Reply #2 on: 06 / April / 2009, 16:23:00 »
I was using the inval.lua script:

--[[
rem 20080805
@title yet another accurate intervalometer
@param a Duration (min)/-1 disable
@default a -1
@param b Duration (sec)/n of seqs
@default b 5
@param c Delay 1st sequence (min)
@default c 0
@param d Delay 1st sequence (sec)
@default d 3
@param e Trigger every n min
@default e 0
@param f ...every n sec
@default f 3
@param g ...every .n sec
@default g 0
@param h Endless?
@default h 0
@param i Seq dur (m)/-1
@default i -1
@param j Seq dur (s)/n of shots/seq
@default j 1
--]]
 
drivemode_continuous = 1
 
if a < -1 then a = -1 end
if ( a > -1 and b < 0 ) then b = 0 end
if ( a == -1 and b < 1 ) then b = 1 end
if c < 0 then c = 0 end
if d < 0 then d = 0 end
if e < 0 then e = 0 end
if f < 0 then f = 0 end
if g < 0 then g = 0 end
if ( h < 0 or h > 1 ) then h = 0 end
if i < -1 then i = -1 end
if ( i > -1 and j < 0 ) then j = 0 end
if ( i == -1 and j < 1 ) then j = 1 end
if (( i == -1 and j > 1 ) or i > -1 ) then
  if get_drive_mode() ~= drivemode_continuous then
    print( "set drive mode" )
    print( "to continuous" )
    sleep(1500)
    cannot_continue = true
  end
end
 
if a > -1 then duration = a*60000 + b*1000 else duration = b end
delay_first= c*60000 + d*1000
if g < 0 then delay = e*60000 + f*1000 + g*10 else delay = e*60000 + f*1000 + g*100 end
if i > -1 then sequence = i*60000 + j*1000 else sequence = j end
 
 
function shoot_by_numbers( sequence_target )
sequence_current = 0
repeat
  tick_target = get_tick_count() + delay
  sequence_current = sequence_current + 1
  print( "sequence " .. sequence_current .. " of " .. sequence_target )
  if i == -1 then shoot_count( sequence ) else shoot_tick( sequence ) end
  while ( get_tick_count() < tick_target and sequence_current < sequence_target ) do
  end
until sequence_current >= sequence_target
end
 
function shoot_by_duration( duration )
duration_target = get_tick_count() + duration
repeat
  tick_target = get_tick_count() + delay
  if i == -1 then shoot_count( sequence ) else shoot_tick( sequence ) end
  print( (duration_target-get_tick_count())/1000 .. " sec to go" )
  while ( get_tick_count() < tick_target and get_tick_count() < duration_target ) do
  end
until get_tick_count() >= duration_target
end
 
function shoot_forever()
tick_initial = get_tick_count()
sequence_current = 0
repeat
  tick_target = get_tick_count() + delay
  sequence_current = sequence_current + 1
  print( "sequence " .. sequence_current )
  if i == -1 then shoot_count( sequence ) else shoot_tick( sequence ) end
  print ( (get_tick_count()-tick_initial)/1000 .. " sec elapsed")
  while ( get_tick_count() < tick_target ) do
  end
until false
end
 
function shoot_count( count_inc )
count_target = get_exp_count() + count_inc
if count_target > 9999 then count_target = count_target - 9999 end
press( "shoot_half" )
press( "shoot_full" )
repeat
until get_exp_count() == count_target
release( "shoot_full" )
repeat
until get_shooting() == false
end
 
function shoot_tick( tick_duration )
tick_target = get_tick_count() + tick_duration
press( "shoot_half" )
press( "shoot_full" )
while ( get_tick_count() < tick_target ) do
end
release( "shoot_full" )
repeat
until get_shooting() == false
end
 
if not cannot_continue then
  tick_target = get_tick_count() + delay_first
  print( "waiting " .. delay_first/1000 .. " sec" )
  while ( get_tick_count() < tick_target ) do
    tick_current = get_tick_count()
  end
  if h == 1 then shoot_forever() end
  if a > -1 then shoot_by_duration( duration ) else shoot_by_numbers( duration ) end
end

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Set A Static Focus Intervolometer
« Reply #3 on: 06 / April / 2009, 17:17:11 »
Why don't you just put your camera to manual focus before starting the script?


Re: Set A Static Focus Intervolometer
« Reply #4 on: 06 / April / 2009, 19:42:48 »
You can set manual focus before you run the script.  But in autofocus you can also use the BAS command "set_aflock(1)" to lock in what autofocus has arrived at.  I put the following lines at the beginning of my script to get autofocus to do its thing and then lock that down.  It appears to stay locked until you release it with at "set_aflock(0)".

The only thing is - you need to make sure you have something good to focus on during this process so autofocus won't be guessing.  But after that it shouldn't matter.

sleep 2500
press "shoot_half"
sleep 2500
set_aflock(1)
release "shoot_half"

You can use this with the display turned off, which will give you longer batter life.  The only downside I found was that my A590 makes a good bit of mechanical noise on each shot - a good bit more than it does using manual focus, and that kinda bothered me.  Not sure why it does that.

Re: Set A Static Focus Intervolometer
« Reply #5 on: 13 / June / 2009, 21:43:19 »
I was wondering if anyone would no how to modify the intervolometer script so the the camera does not refocus every time a shot is take. While it was running I had trouble with the auto focus refocusing on something in the background. I experimented a little with the code, but nothing I did really worked. . .

For what it's worth I just uploaded a script that can run a pre-focus then switches to manual focus (using the MF button, if any), and can also turn off the display after a few frames. I didn't know about the set_aflock() function - is that in the standard build? If so I'll update my script to use them... more reliable.

Anyway, my script is here:

http://chdk.wikia.com/wiki/LUA/Scripts:_Accurate_Intervalometer_with_power-saving_and_pre-focus

Re: Set A Static Focus Intervolometer
« Reply #6 on: 16 / June / 2009, 01:33:49 »
Why don't you just put your camera to manual focus before starting the script?

What I've seen with the a590 is that I can set manual focus once in the script, and set to infinity (or some @param value) okay.  Trouble is when timelapse interval is greater than the cam's Display Off setting, on wakeup, the cam ignores the set manual focus sequence that worked the first time :(

Now at this point I have no idea if it's the script not setting state somewhere, or just tough luck.

The set_aflock seems not to remember a manual focus setting, but seems fine for autofocus as advertised.  I can tell be listening to the cam, no focusing gives a four click sounds per shot, while autofocus operation gives a buzz with the clicks for the focus motor.

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Set A Static Focus Intervolometer
« Reply #7 on: 17 / June / 2009, 17:10:51 »
What I've seen with the a590 is that I can set manual focus once in the script, and set to infinity (or some @param value) okay.  Trouble is when timelapse interval is greater than the cam's Display Off setting, on wakeup, the cam ignores the set manual focus sequence that worked the first time :(

Have you tried different settings for CHDK's Canon power savings disable? That normally prevents display off, which I believe should prevent exit from manual focus as well.

Input current in idle rec mode manual focus is almost as high as during rec mode half shoot, so it makes sense Canon disables MF whenever a power saving mode is entered. Just shutting down the LCD doesn't help much, CCD and locked focus consume more.


Re: Set A Static Focus Intervolometer
« Reply #8 on: 17 / June / 2009, 19:23:24 »
Have you tried different settings for CHDK's Canon power savings disable? That normally prevents display off, which I believe should prevent exit from manual focus as well.

Yes, I have.  I like the cam to go idle during wait long interval before shot.  Last night my script correctly brought the camera into MF mode after several hours 'asleep' in cam's green LED on idle state.  I've yet to test whether the new MF entry code works after subsequent wakeups, for the case where timelapse interval exceeds cam's 'Display Off' delay.

Input current in idle rec mode manual focus is almost as high as during rec mode half shoot, so it makes sense Canon disables MF whenever a power saving mode is entered. Just shutting down the LCD doesn't help much, CCD and locked focus consume more.

Yes, I took notice of that, you wrote about it elsewhere.  I'm no longer shutting down LCD but more interested in recovering properly from the cam's idle mode into MF mode.  In my use of the script, once the cam wakes up an hour before dawn, it stays on, shooting at 5 or 6 second interval.

But I'd like to cover the long interval case as well for a more general purpose script.  Still working on it.

Re: Set A Static Focus Intervolometer
« Reply #9 on: 05 / July / 2009, 15:50:42 »
For what it's worth I just uploaded a script that can run a pre-focus then switches to manual focus (using the MF button, if any), and can also turn off the display after a few frames. I didn't know about the set_aflock() function - is that in the standard build? If so I'll update my script to use them... more reliable.

Anyway, my script is here:

http://chdk.wikia.com/wiki/LUA/Scripts:_Accurate_Intervalometer_with_power-saving_and_pre-focus

Don't seem to work with Digic II propcases.

 

Related Topics