This is inspired by lapsers continuous mode intervalometer stuff from
http://chdk.setepontos.com/index.php?topic=8997.0The basic idea is to let script pause the shooting process at various points, do something, and then tell shooting it can resume. So to shoot a fixed interval in continuous mode, you pause somewhere right before the exposure starts. To analyze the raw buffer, you pause in the raw hook.
The attached patch is a preliminary implementation of this. Unless there are major objections, I will check it into the trunk. The interface will still be subject to change, and I haven't tested it thoroughly yet.
There are currently 3 hooks defined (in order of execution)
'hook_override' - executes in shooting_expo_param_override, before overrides are applied. Can be used to adjust exposure settings after the camera has calculated it's own values.
'hook_remote' - executes in wait_until_remote_button_is_released. Can used to control the start of the exposure.
'hook_raw' - executes in raw_process, just after shot_histogram. It could be used to analyze or modify the raw buffer.
Each of the hooks provides a standard interface:
hook.set(timeout)
Enables the hook, so it will block the shooting process for up to timeout milliseconds. 0 disables the hook.
hook.is_ready()
returns true when the shooting process is in the hook
hook.continue()
allows the shooting process to exit the hook
hook.count()
tells you how many times the hook has been reached for this script. This allows you to tell if a particular point has been reached without actually blocking the process.
The attached script is a very simple continuous mode intervalometer using the remote hook to enforce the interval and the raw hook to adjust exposure. The exposure calculation is purely as an example. Lapsers code has much more sophisticated metering, which is something that can and should be added separately. Another thing that should be added is functions to read and write the raw buffer in the raw hook.
some issues and questions
A few ports may call shooting_expo_param_override more than once. The current code will just call the hook multiple times. Affected cameras include A1000 (but I'm not sure if it's in the same code path) and ixus1000 which does it for two subs out of four
I vaguely remember there being some cameras without the remote hook too.
The names are confusing, especially remote. I'm open to suggestions.
Would it be desirable to have a post-raw save hook?
I originally intended to have a hook.wait_ready() which would do the equivalent of
while not hook.is_ready() do sleep(10) end
in the action stack.
Should there be a way to detect timeouts?