Continuous-Mode Bracketing with Ev offset, Start Delay, and Menu (Digic II) - Script Writing - CHDK Forum

Continuous-Mode Bracketing with Ev offset, Start Delay, and Menu (Digic II)

  • 1 Replies
This is my first script, though it's basically a mish-mash of different scripts with a few personal touches thrown in.
Some of the features here are irrelevant on most cameras (those with custom auto-timers), but they're necessary for my (6 year old) SD300.
It uses get_prop commands, so I suspect it's only for Digic II.  If there are analogous commands, then I'm keen to hear them.
I'm not posting this in completed scripts for a couple of reasons.  First, I can't be certain it's completed without feedback.  Second, since most CHDK cameras have the built-in custom auto-timer, this script is probably of limited utility.

Credit to:
Nicolas Bertolissio for his Bracketing and EV correction script
This served as the basis for my script, especially the nifty menu system for on-the-fly adjustment of script parameters.
Primary modification: Since I'm assuming use of CHDK's built-in Continuous Mode Bracketing, I'm using a half-press followed by holding down full-press instead of individual "shoot_full" commands.  I've replaced his now-semi-redundant Ev bracketing with a start delay (to minimize camera shake for those of us without a remote).

vine for his Bracketing series and rawhead for his modifications to it (use of get_exp_count).
This was necessary since a half-press apparently initiates propcase 205, so I couldn't use get_prop 205 to determine when an exposure had completed.  get_exp_count is more accurate than get_jpg_count or get_raw_count.
Primary modification: As rawhead noticed, occasionally get_exp_count will lurch unexpectedly putting the camera into an infinite loop.  I simply put an error condition in for when this happens.   I haven't actually seen it happen when the script was working properly, but when OTHER parts of the script were malfunctioning and it took multiple sets the error condition was occasionally activated.  (I've just seen a single reference to propcase 118 - or 218, I think there's a typo in the post - that's described as "number of shots in continuous mode", which might be useful.)

Alain, Divalent for use of get_prop 67 for verifying successful focus
I like this method better than a generic "sleep" delay, as it verifies the camera actually focused on something before taking the set, moves on immediately after focus is obtained, and it allows for automatic refocus attempts when focusing fails.
Primary modification: First, I modified the logic to shrink it down a tad.  Second, propcase 67 didn't give me the same values as it did Alain and Divalent.  (Their observation was 0 when there was no focus, and 1 when focus was successfully obtained.)  On my SD300, get_prop 67 gave me 0 when there was no focus, but higher numbers (in the 30s, 60s, and 100s, IIRC) when focus was obtained.  I suspect this may because my camera has no manual focus mode.  While I'm not sure, I think the numbers were higher the more AiAF brackets were locked.  That said, all that was necessary was to test for get_prop 67 being greater than 0 rather than equal to 1.

So what does it do?
  • Takes a user-defined number of photos using CHDK's Continuous Mode Bracketing
  • Allows a user-defined Ev offset (basically, defines the "center" exposure)
  • Allows a user-defined start delay to minimize button-press camera shake
  • Warns (and refuses to run) if Continuous Mode is Off or if the Flash is On
  • Provides a convenient runtime menu for on-the-fly adjustment of Ev offset, # of shots, and start delay

  • Through the CHDK menu, configure "Bracketing in Continuous Mode" as desired
  • Set the Flash to "Off" and shooting mode to "Continuous"
  • Start the script, which will bring up the runtime menu
  • Click Up and Down to select a value to change, then Right and Left to modify it
  • When ready, press SET to start
  • The script will delay by the specified number of seconds and then attempt to focus.
  • Once focus is achieved, the script will take the specified number of shots and return to the menu
  • When finished, interrupt the script with the shutter, or press Disp to exit.

Ok, so where is it?
Oh, right...the script...
Code: [Select]
@title AutoBracketing
@param a Number of shots
@default a 5
@param c Ev Offset (1/3 EV) -12..12
@default c 0
@param b Delay (s)
@default b 1

get_prop 6 q
get_prop 16 r
if q<>1 or r<>2 then goto "wrongmode"
get_prop 25 w
get_prop 26 x

let y=1
  let z=0

    if a<1   then let a=1
    if b<0   then let b=0
    if c<-12 then let c=-12
    if c>12  then let c=12
    if y<1   then y=3
    if y>3   then y=1

    print "!!Verify Bracketing!!"
    if y=1 then print " Shots: <",a,">"          else print " Shots:  ",a
    if y=2 then print "Offset: <",c/3,c%3;"/3 >" else print "Offset:  ",c/3,c%3;"/3"
    if y=3 then print " Delay: <",b,"sec >"      else print " Delay:  ",b,"sec"
    print "[Set]=Shoot [Disp]=exit"

    if is_key "up"   then let y=y-1
    if is_key "down" then let y=y+1
    if y=1 and is_key "left"  then let a=a-1
    if y=2 and is_key "left"  then let c=c-1
    if y=3 and is_key "left"  then let b=b-1
    if y=1 and is_key "right" then let a=a+1
    if y=2 and is_key "right" then let c=c+1
    if y=3 and is_key "right" then let b=b+1
    if is_key "set"     then z=1
    if is_key "display" then z=2
  until z>0
  if z=2 then goto "exit1"

  set_prop 25 c*32
  set_prop 26 c*32

  if b>0 then print b,"sec delay"
  sleep b*1000
  print "Shooting"
   press "shoot_half"
    for p=1 to 100
      get_prop 67 j
      if j>0 then goto "shoot"
    next p
   release "shoot_half"
   print "Attempting refocus"
  goto "focusloop"
  press "shoot_full"
     if e>d then gosub "ExpOver"
  until e=d
  release "shoot_full"
  release "shoot_half"
until z=2

set_prop 25 w
set_prop 26 x

release "shoot_full"
release "shoot_half"
print "Exposure count asplode!"
goto "exit1"

if q<>1 then print "Continuous Mode Off"
if r<>2 then print "Flash On"
« Last Edit: 08 / August / 2009, 16:38:50 by ReverendTed »

Well, I got too wordy and exceeded the maximum post length, so here's the rest:

Known Issues:
  • While get_prop 16 was "2" when, and only when, my flash was off, set_prop 16 2 didn't seem to work, so it only checks if the flash is on and warns the user about it
  • I couldn't figure out how to check whether CHDK's continuous mode bracketing was active, so there's just a gentle reminder on the runtime menu to verify that you've got it turned on
  • It's a big script at 2,021 bytes.  I thought I read that scripts can't be larger than 2K, so I'm guessing that's 2048 bytes, since I can verify the final functions in the script work correctly.
  • It uses get_prop and set_prop, so I'm guessing it only works with Digic II chips, unless modified
  • If you get in a situation where the camera will be unable to focus, it'll enter an endless loop attempting to refocus until the script is interrupted
  • I'm not sure, but I think the focus loop might occasionally give a false positive, although I was unable to reliably reproduce the issue or identify the reason.  It could be that propcase 67 isn't instantly updated by the camera, so a previous positive focus value could be retrieved before the camera resets it to 0, or something.

On second glance, I'm not so sure the title I gave it is appropriate, as the script itself doesn't actually do any bracketing, though that's the intended usage.
I guess it's really a Custom Auto-timer script with Ev offset more than anything else.


Related Topics

SimplePortal 2.3.6 © 2008-2014, SimplePortal