Overlay off, set_yield(-1,50). I figured if sleep made it go away, yielding less would make it happen more often. Nope. No failures in >6800 shots.
I did a further test with set_yield(-1,-1): >7100 shots with no failures.
At this point I'm fairly confident that it's a timing issue related to the script rather than a hardware failure. The exact scenario isn't very clear though. The normal shooting cycle goes like
- wait_click 10 to check for key presses
- press shoot full
- sleep until remote hook is hit
- sleep for as long as needed to achieve desired interval, typically a few hundred ms in my tests
- continue from remote hook
- release shoot full
- sleep until raw hook is reached
- do some intensive processing: meter, exposure calculation, debug drawing
* meter and drawing can take 10s of ms, so will likely result in a yield under default settings.
* there is also a lot of code, so the count hook might also trigger one or more yields
- continue from raw hook
- write log line
- do lua garbage collection step
- goto 1
The above works without issue if debug drawing is enabled. This typically adds 10-20 ms on d10, so would normally cause one extra yield inside the raw hook.
Metering takes a similar amount of time, so with metering alone, there is probably at least one in the raw hook. In the cases that failed, the meter time is shown as 10 on both failed and successful shot.
Both meter and drawing will tie up the CPU pretty solidly when they are actually running, although the dryos scheduler might preempt them.
capt_seq is blocked for the duration of the hook.
The two "fixes" I have found are
1) adding an extra yield inside the raw hook, with sleep(10)
2) preventing any yield with set_yield.
![Huh? ???](https://chdk.setepontos.com/Smileys/smile/huh.gif)
The script yields almost immediately after the raw hook as been released, so it's not clear why 10ms inside the hook should make a difference. The obvious difference is that capt_seq has been allowed to continue, which will keep the cpu busying for a while creating the jpeg and may also interact with other tasks.
If there was a way to figure out when the shutter normally opens, that could provide some clues.