CHDK Wiki
mNo edit summary
Line 53: Line 53:
   
 
==Dependencies==
 
==Dependencies==
* Requires modules [[LUA/Scripts:Standard/Lualib/Gen/Modelist|GEN/modelist]] [[LUA/Scripts:Standard/Lualib/Propcase|propcase]]
+
* Requires modules [[Lua/Scripts:Standard/Lualib/Gen/Modelist|GEN/modelist]] [[Lua/Scripts:Standard/Lualib/Propcase|propcase]]
 
* Supported only in CHDK Version 0.9.9 build 847 and later.
 
* Supported only in CHDK Version 0.9.9 build 847 and later.
   

Revision as of 11:18, 10 February 2012

CHDK/LUALIB/capmode.lua

This is a standard lua module included in the full CHDK distribution. It provides convenient access to the capture mode control functions, as well as the ability to specify capture modes by their names.

Modes names may be found in CHDK/LUALIB/GEN/modelist.lua. These are the same as the enum values in include/modelist.h, minus the MODE_ prefix

WARNING This feature is still under development. The available mode numbers, their mapping to canon modes, and their symbolic names may change in the next several CHDK revisions. This notice will be removed when they are finalized.

Using the module

This module does not set any global variables. Instead, you must assign the return value of require to the variable through which you will access the modules interface.

myvar=require("capmode")

capmode public members

mode_to_name

Table mapping CHDK mode numbers to names.

name_to_mode

Table mapping names to CHDK mode numbers.

get()

Get the current CHDK mode.

return CHDK mode number, or 0 if in play or the current mode is not in the modemap

get_name()

Get the string name of the current CHDK mode.

return string name of the current CHDK mode, "UNKNOWN" if the mode isn't in the mode map, or "PLAY"

get_canon()

Get the current canon shooting mode value.

return SHOOTING_MODE prop value of the current mode, corrected to an unsigned value.

set(modeid)

Set the current capture mode

modeid is a mode number or name

return true if the mode is in the cameras modemap and the camera is in rec mode, otherwise false

valid(modeid)

Check if modeid is in the cameras modemap

modeid mode number or name

return true if mode is in the cameras modemap, otherwise false

example

capmode=require("capmode")
print("mode#",capmode.get(),"name",capmode.get_name(),"prop",capmode.get_canon())
if capmode.valid("M") then
    capmode.set("M")
end

Dependencies

  • Requires modules GEN/modelist propcase
  • Supported only in CHDK Version 0.9.9 build 847 and later.

Camera notes

Verified on

Broken on