tl;dr> a patch to the set_xv96() commands so that they work correctly before or after a half press.
One quirk of setting exposure values manually from a script using the set_
xv96() commands is that these commands must be issued prior to a half press :
tv=560
set_tv96_direct( tv+96 )
press("shoot_half")
repeat sleep(50) until (get_shooting() == true )
press("shoot_full_only")
sleep(100)
release("shoot_full")
However, if you are trying to set exposures manually, you probably want to know the current exposure setting. But the apex96 values are not set until after a "half-press" is issued. So the above script must be converted to look something like this :
press("shoot_half")
repeat sleep(50) until (get_shooting() == true )
release("shoot_half")
tv=get_tv96()
set_tv96_direct( tv+96 )
press("shoot_half")
repeat sleep(50) until (get_shooting() == true )
press("shoot_full_only")
sleep(100)
release("shoot_full")
Notice that there is a shoot-half , release, shoot-half, shoot-full, release sequence - an extra half-press sequence that adds about 1 second to how long it takes to make a shot. While there is a crude way to overcome this using set_param() after the half-press, it would seem better to have the set_
xv96() commands able to handle this on their own.
To understand this, you need to know that what happens internally, based on SET_NOW & SET_LATER parameters, is that the various set_
xv96() commands are actually buffered internally and not issued until after a "half-press" is issued inside the shoot() command. The half press sets exposure params and the delay is necessary so that the override values are only set after the half-press sequence completes.
In conversation with reyalp on the CHDK IRC channel, he suggested three ways to get around this :
1) Add SET_NOW and SET_LATER parameters to the set_
xv96() commands.
2) Create new versions of set_
xv96() that either set_now or set_later.
3) Modify the Lua & uBASIC code to automatically detect whether a set_now or set_later is needed.
As it turns out, the cleanest way to deal with this issue seems to be the third options. By checking the status of the shooting process using the shooting_in_process() function, the code can decide whether to use SET_NOW or SET_LATER. I've attaches a patch that implements this for both uBASIC & Lua - it almost seems too easy. Lua and uBASIC test scripts attached too.
Note : lapser went much farther with the set_
xv96() function in his continous shooting timelapse patches. I'd really rather not discuss those here - that's a seperate question that is only relevent in continuous mode and will no doubt take much conversation prior any part of it being added to the trunk.