Canon Basic/Reference
Talk0this wiki
< Canon Basic
Contents |
Canon Basic Reference
|
Canon Basic Functions are basicly Event Procedure with slightly different syntax. |
Canons firmware includes a scripting language, which appears to be a flavor of basic. Thanks to recent work by Alfredo Ortega and Oren Isacson of core labs, it is now known how to execute scripts in this language. They have made available their defcon presentation and some preliminary documentation, read more in this →forum thread.
SystemEventInit
Newest cams (DryOS rel 43 and later) only have System.Create(), on older dryos cams SystemEventInit() is an alias for System.Create(). Old cameras (mostly VxWorks) have only SystemEventInit. The following should work on all known cameras
if System.Create() = -1 then SystemEventInit() end if
LCDMsg
The LCDMsg system is not available on older cameras.
Call UI.CreatePublic() first to register LCDMsg_* functions:
UI.CreatePublic()
LCDMsg_Create
Create "handle" for your LCD Message:
a=LCDMsg_Create()
When a message is first created and no text has been set, the string "FAILED" is displayed. This may also be displayed when an invalid argument is given to an LCDMsg function.
LCDMsg_SetStr
LCDMsg_SetStr(a,"Hello World")
LCDMsg_SetStr(HANDLE, STRING)
Note: STRING is limited to 32 Characters. If function is called for example with 37 chars it will return:
warning: (Length > 32 length = 37) or (>SetStr " strings ")
LCDMsg_SetNum
LCDMsg_SetNum(a,999)
LCDMsg_SetNum(HANDLE, INTEGER)
LCDMsg_ChangeColor
LCDMsg_ChangeColor(a,3)
LCDMsg_ChangeColor(HANDLE, COLOR)
| Number | Color SD4000 / SD940 | Color A720 |
| 0 | Black | n/a |
| 1 | Black | White |
| 2 | Orange | Red |
| 3 | White | Bright Grey |
| 4 | Grey | Dark Grey |
| 5 | Bright Orange | Green |
| 6 | Orange | Yellow |
| 7 | Bright Grey | |
| 8 | Orange | |
| 9 | Bright Blue | |
| 10 | Blue | |
| 11 | Bright Grey | |
| 12 | Dark Blue | |
| 13 | Dark Grey | |
| 14 | Bright Grey | |
| 15 | Black |
Color depends on Canon Firmware Palette.
Cameras have different Color Palettes defines as CAM_BITMAP_PALETTE in camera.h used by CHDK GUI.
LCDMsg_Move
LCDMsg_Move(a, 10, 10)
LCDMsg_Move(HANDLE, LEFT, TOP)
Wait
Call System.Create() to register Wait() function:
if System.Create() = -1 then
SystemEventInit()
end if
Wait(5000)
Wait(DELAY_IN_MS)
Printf
Output string to Camera Console (UART).
Printf("Script Foo started")
Console redirection StartRedirectUART/StopRedirectUART
On DryOS cameras, the camera console output can be redirected to a file. See Debugging#UART_redirection_.28DryOS.29