Here's the new version that implements the method described in my last post. It modifies shoot() so it always shoots, and hopefully never hangs. It works on my camera, with or without flash, and without missing shots, so hopefully it will work for you too. If not, I have one more thing I can try.
This version of shoot() first checks to see if the shutter is half_pressed already. If so, it will leave it half pressed after it shoots. This allows more rapid shooting using the exposure and focus setting of the first shot. The attached Lua script tests and times both methods.
shoot1.lua first tests the normal shoot() method, which meters and focuses each shot. It prints the time between shots, which is about 1900 msec on my camera. Press and hold <set> to go to the next test.
Then shoot1.lua presses "half_shoot" and repeats the same loop. On my camera, the time between shots drops to about 800 msec. This is pretty close to the maximum rate of around 600 msec for my camera in continuous mode. Press and hold <menu> to exit.
So if it works on your camera, we might have a winner.
====
In this version, I added a counter increment right before the shutter opens. After incrementing the counter, I set the sign bit on, so it will test <0 while the shutter is open. When the raw data is ready and the shot histogram is finished, I clear the sign bit (and increment again for cameras without the shutter open hook), so the counter is now >=0.
If you start with the shutter up, shoot() first presses half_shoot and waits for get_shooting(), as before. Then it waits until the counter is >=0. That is, it waits for the shutter to close from the last shot. At this point, it saves the shot counter in a local variable, since it now won't change until the next shutter open. Then, it starts pressing and releasing shoot_full_only at a rate of 5 times per second, until the shot counter changes, signifying the shot has started. Then it releases shoot_full_only. If the shutter was up, it returns. Otherwise it lets the shutter up and waits for get_shooting() to go back to 0 (false).
That's the theory. You're the proof. Thanks again.