I'm stumped.
I know what you mean gchaprnka. For a long time so was I - still am with a lot of the code and logic.
I haven't done any practical experimentation with multicam.lua yet but have found reyalp's post here
http://chdk.setepontos.com/index.php?topic=11817.msg115652#msg115652 very helpful.
I hope the following, very brief, description is useful (i'm sure reyalp will comment if my description is wrong/misleading).
Once you are connected to your favourite list of cams, then
mc:start()
transmits (and starts) a script on the cameras, containing the code at the end of multicam.lua starting @:
mc={
mode_sw_timeout=1000,
...ending @
until mc.done
end
(along with some other code from source file "util.lua")
How? for each camera via:
function mc:start_single(lcon,opts)
...
lcon:exec('mc.run('..util.serialize(opts)..')',{libs='multicam'})
[for detail of exec, please see source file file chdku.lua, function con_methods:exec(code,opts_in)]
Now that this script is running on the camera(s), the camera script function:
function mc.run(opts)
extend_table(mc,opts)
set_yield(-1,-1)
repeat
local msg=read_usb_msg(mc.msg_timeout)
if msg then
mc.cmd,mc.args=string.match(msg,'^([%w_]+)%s*(.*)')
if type(cmds[mc.cmd]) == 'function' then
cmds[mc.cmd]()
else
write_status(false,'unknown')
end
else
mc.idle()
end
until mc.done
is looking (via msg=read_usb_msg(mc.msg_timeout ), in a loop (until "exit"), for messages sent from "multicam.lua":
function mc:cmd(cmd,opts) => lcon:write_msg_pcall(sendcmd)
to decide which of the functions of the camera script to run e.g shoot, getlastimg [by cmds[mc.cmd]()].
As reyalp said, the upload funnction is not yet in the camera script file yet (i.e, the text at the end of multicam.lua).
Thanks for posting your mod.
Apologies for a non-programers description