The attached diff file patches action_stack.c to improve the function of the shooting keys:
"shoot_full", "shoot_full_only", and "shoot_half".
press("shoot_full") and press("shoot_half") now wait for get_shooting() to be true after pressing the key.
press("shoot_full") and press("shoot_full_only") now wait for the shutter to open after pressing the key.
release("shoot_full") and release("shoot_half") now wait for get_shooting() to be false after releasing the key.
click(...) skips the now unnecessary delay between press and release for these 3 keys.
shoot() is now the same as click("shoot_full") but waits for get_flash_ready()
However, on my camera, it appears that when the flash is active, get_shooting() already does this, so the
shoot() command can be replaced by click("shoot_full").
I also think I found the cause of the infamous "shoot bug" that causes a script to stop when calling shoot() repeatedly. The current shoot() contains these statements:
- action_push_release(KEY_SHOOT_FULL);
- action_push_press(KEY_SHOOT_FULL);
This is equivalent to "click" but without the click delay. So on some cameras, the press may not be recognized, and the camera will enter an infinite loop waiting for get_shooting(). If this is the problem, it is fixed with the attached changes. You could also just replace the push/release statements above with:
action_push_click(KEY_SHOOT_FULL);
But the new changes are a major improvement to shooting with a script. They eliminate the need for all the loops that test for get_shooting(). They also work with review mode on. Here's some examples of how to write a script with the changes:
--[[
@title New Click Test
--]]
--this is equivalent to shoot(), but without the flash ready check
--please try it on your camera with the flash on and see if it waits for flash ready
repeat
click("shoot_full")
until false
--This shoots pictures much faster, but without focusing and metering between shots.
--I think this is as fast as the camera can shoot pictures in single shot drive mode.
press("shoot_half")
repeat
click("shoot_full_only")
until false;
--this still works, but without the suspected bug
repeat
shoot()
until false
This shouldn't break any old scripts, although a script that does something in the get_shooting() wait loops, like checking for key presses, or turning the backlight off repeatedly, might not respond as fast.
The attached diff file was made with CHDK shell source tools on trunk 2406 version 1.2. If you patch this trunk and then re-diff it with TortoiseSVN, it will probably work better with other trunks/branches. Try it with any 1.2 trunk, though, and it will probably work. Eventually, I'll get around to instaling TortoiseSVN
Many thanks to philmoz and reyalp for helping me understand action_stack.c
===========
[EDIT2] attached diff file updated to add video mode test to new wait functions
[EDIT3] new diff file adds wait for shutter open after press("shoot_full_only") without modifying any other key functions. Test added so unsupported cameras do fixed wait like before.