Wikia

CHDK Wiki

Script Shooting Hooks

Talk0
571pages on
this wiki
Revision as of 05:54, May 19, 2014 by ReyalP (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

IntroductionEdit

CHDK 1.3 adds "hooks" which allow Lua scripts pause the shooting process when certain point are reached.

CHDK 1.3 is the unstable development branch, so this interface is subject to change. Please use the development thread http://chdk.setepontos.com/index.php?topic=11081.msg108530#msg108530 for feedback and bug reports.

Available hooksEdit

There are currently 3 hooks defined (in order of execution)

hook_preshootEdit

Executes in shooting_expo_param_override, after CHDK overrides are applied. Can be used to adjust exposure settings after the camera has calculated it's own values. This hook only executes once per half press cycle, so if shooting in continuous mode, it will only be reached once before the continuous burst starts.

hook_shutterEdit

Executes very shortly before the shutter would open, in wait_until_remote_button_is_released (prior to the actual remote check). Can used to control the start of the exposure, to synchronize with an external process or to make continuous mode shoot at a specific interval.

Adjusting exposure, focus and zoom parameters here is not recommended. Exposure parameters will generally not take effect for the current shot. Zoom or focus may work, but the camera would not normally expect them to be manipulated at this point.

hook_rawEdit

Executes in raw_process, after shot_histogram has built the raw histogram and DNG exif has been captured, but before any raw or DNG file has been written. It can be used to adjust the exposure for a following shot in continuous mode. In the future, the ability to directly read and write the raw buffer will be added.

Hook functionsEdit

Each of the hook is available in Lua as a table which contains a standard set of functions:

hook.set(timeout)Edit

Enables the hook, so it will block the shooting process for up to timeout milliseconds. 0 disables the hook. Hooks are cleared when a script ends. They are not cleared between shots.

If timeout milliseconds pass without a call from continue, the shooting process will proceed as if continue had been called.

hook.is_ready()Edit

returns true when the shooting process is stopped in the hook.

hook.continue()Edit

Allows the shooting process to continue from the hook point.

hook.count()Edit

Returns a count of 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.

Known issuesEdit

Setting ISO in hook_preshoot may not work correctly on some cameras (those that require shooting_expo_iso_override in the capt_seq code)

A few ports may call shooting_expo_param_override more than once. On these ports, hook_preshoot will also be called more than once per shot.

A few ports may be missing wait_until_remote_button_is_released. On these ports, hook_shutter will not be reached.

There is no simple way to tell if a hook timed out.

Lua code may wait indefinitely for a hook that never becomes ready (for example, if shooting failed to start), unless it implements it's own timeout.

Around Wikia's network

Random Wiki