Wikia

CHDK Wiki

CHDK Scripting Cross Reference Page

Talk0
570pages on
this wiki
Revision as of 03:06, August 1, 2013 by Waterwingz (Talk | contribs)

CHDK Scripting Links

CHDK Scripts CHDK Scripting
Script Commands Script Commands Stub
User Written Scripts Property Case Values

uBASIC Links

uBASIC uBASIC Syntax
uBASIC Tutorial Scratchpad

Lua Links

Lua Lua Syntax
Lua Reference Lua PTP Scripting
Lua Draw Functions Native Function Calls
Lua Development Environment Lua 5.1 Reference Manual

Script Header Documentation

The Script Header Tutorial - The Script Header

All Scripting Functions

.

Lens Functions
Function Link Lua uBASIC Description
get_focus YYgets current focus distance in mm
get_focus_mode YYreturns focus mode, 0=auto, 1=MF, 3=inf., 4=macro, 5=supermacro
get_focus_ok YYreturns 0=focus not ok, 1=ok if get_focus_state<>0 and get_shooting=1
get_focus_state YYreturns focus status, > 0 focus successful, =0 not successful, < 0 MF
get_IS_mode YYget image stabilization mode
get_zoom YYreturns current zoom position
get_zoom_steps YYreturns the number of zoom steps supported by the camera
set_aflock YYblocks the camera firmware from making focus adjustments
set_focus YYsets current focus distance in mm
set_zoom YYsets the current zoom position
set_zoom_rel YYmoves zoom position a relative amount
set_zoom_speed YYsets zoom speed (only works on some cameras)
Depth of Field
Function Link Lua uBASIC Description
get_dofinfo Y -get DOF table (uBASIC commands below)
get_dof -Yget the depth of sharpness in mm
get_far_limit -Yget the far acceptable sharpness distance
get_near_limit -Yget near acceptable sharpness distance
get_focal_length -Yget current lens focal length
get_hyp_dist -Yget hyperfocal distance
Exposure Functions
Function Link Lua uBASIC Description
get_av NYobsolete - replaced with get_user_av_id
get_av96 YYgets APEX96 aperature value
get_bv96 YYgets APEX96 luminance value
get_ev YYget exposure adjustment amount
get_iso NYobsolete - replaced with get_iso_mode
get_iso_market YYget inflated marketing ISO value
get_iso_mode YYobtain ISO mode
get_iso_real YYget actual ISO value
get_nd_present YYreturns whether camera has an ND filter (and / or diaphragm )
get_sv96 YYgets APEX96 ISO sensitivity setting
get_tv96 YYgets APEX96 exposure time
get_user_av_id YYgets M mode override APEX96 aperature value by index
get_user_av96 YYgets APEX96 aperature value
get_user_tv_id YYgets M mode override APEX96 exposure time by index
get_user_tv96 YYgets M mode override APEX96 exposure value
set_av NYobsolete - replaced with set_user_av_by_id
set_av_rel NYobsolete - replaced with set_user_ac_by_id_rel
set_av96 YYsets the APEX96 aperature value
set_av96_direct YYsets the APEX96 aperature value (bypass validation check)
set_ev YYsets exposure adjustment amount
set_iso NYobsolete - replaced with set_iso_mode
set_iso_mode YYsets propcase PROPCASE_ISO_MODE
set_iso_real YYsets the sv96 override value base on ISO sensitivity value
set_nd_filter YYmoves neutral density filter into or out of the optical path
set_sv96 YYset APEX96 ISO sensitivity value
set_tv NYobsolete - replaced with set_user_tv_by_id
set_tv_rel NYobsolete - replaced with set_user_tv_by_id_rel
set_tv96 YYset APEX96 exposure time
set_tv96_direct YYset APEX96 exposure time (bypass validity checks)
set_user_av_by_id YYset user override APEX96 aperature by index (M mode only)
set_user_av_by_id_rel YYset user override APEX96 aperature by index relative (M mode only)
set_user_av96 YYset user override APEX96 aperature (M mode only)
set_user_tv_by_id YYset user override APEX96 exposure time index (M mode only)
set_user_tv_by_id_rel YYset user override APEX96 exposure time index offset (M mode only)
set_user_tv96 YYset user override APEX96 exposure time (M mode only)
get_live_histo YN Get a histogram of the live viewport
Camera Functions
Function Link Lua uBASIC Description
get_capture_mode NYgets current camera Program mode setting
get_display_mode NYreturns state of LCD display info
get_drive_mode YYreturns shutter drive mode (single, continuous, timer )
get_flash_mode YYreturns flash mode (flash auto, flash on, flash off)
get_flash_params_count YNreturns # of flash memory parameters available in camera
get_flash_ready YYreturns status indicating if flash is ready to fire
get_meminfo YNget camera memory information
get_mode YYreturns whether record mode or playback mode is active
get_movie_status YYgets state of video recording (off,on,paused)
get_orientation_sensor YYget camera rotation sensor value
get_parameter_data YNget data from camera\'s flash memory
get_prop YYget PropertyCase value as short integer
get_prop_str YNget the value of a PropertyCase as a string
get_propset YYget the propset number for this camera
get_quality NYreturns the current capture quality setting in Canon grades
get_resolution NYreturns the current capture resolution setting in Canon grades
get_shooting YYreturn value indicates if shooting is done
get_temperature YYreturns specified temperature sensor value
get_vbatt YYget current battery charge state
get_video_button YYreturns whether on not the camera has a video button
get_video_details YNreturns a struct with viewport configuration info
is_capture_mode_valid YYcheck if CHDK mode number is valid for this camera
play_sound Y*plays the specified sound sequence (uBASIC use playsound)
reboot YYrestart the camera
restore YYspecifies the routine called before a script terminates
set_backlight YYturns the LCD screen backlight on or off
set_capture_mode YYset capture mode by CHDK mode number
set_capture_mode_canon YYset capture mode by PROPCASE_SHOOTING_MODE value
set_led YYturns on or off the selected camera LED
set_movie_status YYallow video recording to pause, unpause and stop
set_prop YYset PropertyCase value as short integer
set_prop_str YNused to set arbitraty sized propcases in Lua
set_quality NYset the quality (in Canon grades),
set_record YYset playback or record mode
set_resolution NYSet the resolution (in Canon grades)
shut_down YYturns the camera off
Keypad & Switches
Function Link Lua uBASIC Description
click YYpress and release a key
is_key YYdetemines if specified key was pressed
is_pressed YYdetermines if specified key is being pressed
press YYactivates the specified camera button
release YYreleases the specified camera button
shoot YYtakes a picture
wait_click YYwaits for any camera button to be pressed
wheel_left YYsimulates moving jog dial wheel to the left
wheel_right YYsimulates moving jog dial wheel to the right
SD Card Functions
Function Link Lua uBASIC Description
get_disk_size YYreturns size of SD card
get_exp_count YY return number of shots in a session
get_image_dir YN get current image directory
get_free_disk_space YYreturn space left on SD card
get_jpg_count YYreturn number of JPG shots left on SD card
get_partitionInfo YYget partition information from the SD card
set_file_attributes YYset file attributes of file on SD card
swap_partitions YYchanges the partition order if SD card has multiple partitions
Script Status Functions
Function Link Lua uBASIC Description
autostarted YYchecks if script was autostarted
end NYterminate uBASIC program execution
file_browser YYactivate SD card file browser on LCD screen
get_autostart YYreads the conf.script_autostart
get_day_seconds YYreturn number of seconds since midnight
get_tick_count YYgets time in tic units since camera startup
get_time YYreturns elements of the camera\'s current date / time setting
set_autostartYYwrite conf.script_autostart (0=off, 1=on, 2=once)
set_yield YYcontrol how much of the Camera CPU time is used by scripting engine
sleep YYhalts program execution for specified number of milliseconds
Firmware Interface
Function Link Lua uBASIC Description
call_event_proc(name,...) YNcalls a registered event procedure.
call_func_ptr(fptr,...) YNcall ARM or Thumb function in camera RAM or ROM
get_levent_def YNreturns (name, id, param) if index is valid, otherwise nil
get_levent_def_by_index YNreturns (name, id, param) if index is valid, otherwise nil
get_levent_index YNreturns the index of the given event
post_levent_for_npt YNTriggers a LogicalEvent in the Canon firmware.
post_levent_to_ui YNTriggers a LogicalEvent in the canon firmware.
set_levent_active YN<needs a definition>
set_levent_script_mode YN<needs a definition>
Text Console
Function Link Lua uBASIC Description
cls YYclear console screen
console_redraw YYmanually refresh/rewrite the script console
print YYdisplays a line of text on console area of LCD screen
print_screen YYcauses text written to screen to also be written to file on the SD card
set_console_autoredraw YYenable or disable automatic rewrite/refresh of the console
set_console_layout YYsets the dimensions the LCD message console
LCD Graphics
Function Link Lua uBASIC Description
draw_clear YNclear drawing area on LCD screen
draw_ellipse YNdraws an ellipse on LCD screen
draw_ellipse_filled YNdraws a filled ellipse on LCD screen
draw_line YNdraw a line on LCD screen
draw_pixel YNdraws a single pixel on LCD screen
draw_rect YNdraws a rectangle on LCD screen
draw_rect_filled YNdraws a filled rectangle on LCD screen
draw_string YNprints a text string on LCD screen
textbox YNinput text function for Lua scripts
RAW
Function Link Lua uBASIC Description
get_raw YYreturn status of RAW disabled or enabled
get_raw_count YYreturn number of RAW shots that will fit on remaining SD card space
get_raw_nr YYreturn state of RAW noise reduction ( off, on )
raw_merge_add_file YNadds a RAW file to the current merge process
raw_merge_end YNends a RAW merge process on the camera
raw_merge_start YNbegins a RAW merge process on the camera
set_raw YYenables or disables the storage of RAW images
set_raw_develop YNdevelop RAW image on next shot
set_raw_nr YYenables or disable noise reduction in RAW mode
CHDK Functionality
Function Link Lua uBASIC Description
enter_alt YNactivates CHDK mode
exit_alt YYexits CHDK mode
get_buildinfo YNreturn info about CHDK version running on the camera
get_config_value YYget currently selected state of CHDK menu item
get_histo_range YYreturn % if values in given range on histogram
get_platform_idNYget the camera's platform ID value
set_config_value YYsets specified CHDK config value to specified value
shot_histo_enable YYenables creation of histogram data from a shot
Programming
Function Link Lua uBASIC Description
bitand(a, b) YNreturns bitwise logical AND of two variables
bitnot(a) YNreturns bitwise inversion of a variable
bitor(a, b) YNreturns bitwise logical OR of two variables
bitshl(a) YNreturns logical shift left of a variable
bitshri(a) YNreturns logical right of a variable (top bit stays in same state afterwards)
bitshru(a) YNreturns logical right of a variable (top bit = 0 afterwards)
bitxor(a, b) YNreturns logical exclusive or of two variables
peek YNreads from specified camera memory address
poke YNwrites to specified camera memory address
Motion Detection
Function Link Lua uBASIC Description
md_detect_motion YYwaits for a change in specified screen cells caused by motion
md_get_cell_diff YYgets change in motion detect level in specified cell
md_get_cell_val YYgets signal level in specified cell
md_af_on_time YYenable AF led for MD response testing
USB Port Interface
Function Link Lua uBASIC Description
get_usb_power YYget status of USB connector ( voltage present or not present )
read_usb_msg YNread a message from the CHDK ptp usb interface
write_usb_msg YNwrite a message via the CHDK ptp interface
switch_mode_usb YNset playback or record mode while PTP USB connected
Tone Curves
Function Link Lua uBASIC Description
get_curve_file YNLua commands to control tone curves
get_curve_state YNLua commands to control tone curves
set_curve_file YNload a tone curve file
set_curve_state YNenable/disable the use of a tone curve file
imath functions
Function Link Lua uBASIC Description
imath.scale YNconstant = 1000
imath.pi2 YNconstant = 6283
imath.pi YNconstant = 3142
imath.pi_2 YNconstant = 1517
imath.muldiv YNa*b/c
imath.mul YNa*b
imath.div YNa/b
imath.rad YNrad -> deg
imath.deg YNdeg -> rad
imath.sinr YNsin(rad)
imath.cosr YNcos(rad)
imath.tanr YNtan(rad)
imath.asinr YNarcsin(rad)
imath.acosr YNarccos(rad)
imath.atanr YNarctan(rad)
imath.polr YNr, rad_alpha = pol(x, y)
imath.recr YNx, y = rec(r, rad_alpha)
imath.sind YNsin(deg)
imath.cosd YNcos(deg)
imath.tand YNtan(deg)
imath.asind YNarcsin(deg)
imath.acosd YNarccos(deg)
imath.atand YNarctan(deg)
imath.pold YNr, deg_alpha = pol(x, y)
imath.recd YNx, y = rec(r, deg_alpha)
imath.pow YNx^y
imath.log YNlog(x)
imath.log2 YNlog2(x)
imath.log10 YNlog10(x)
imath.sqrt YNsquare root
imath.int YNinteger
imath.frac YN fractal
imath.ceil YN ceil
imath.floor YNfloor
imath.round YNround

Around Wikia's network

Random Wiki