!mc=require('multicam')!mc:connect({list=true})!mc:start()!mc:cmdwait('u -nolua settings.lua chdk/scripts/')!mc:cmd('exit')
Code: [Select]!mc=require('multicam')!mc:connect({list=true})!mc:start()!mc:cmdwait('u -nolua settings.lua chdk/scripts/')!mc:cmd('exit') I have all the files in the correct locations, and when I run the upload line ("u -nolua settings.lua chdk/scripts/") in interactive chdkptp it runs just fine.
!for lcon in mc:icams() do con=lcon cli:print_status(cli:execute('u -nolua settings.lua chdk/scripts/')) end
!for i,lcon in ipairs(mc.cams) do con=lcon cli:print_status(cli:execute('u -nolua settings.lua chdk/scripts/')) end
!for i,lcon in ipairs(mc.cams) do con=lcon cli:print_status(cli:execute('reboot')) end
c -s=xxxserialxxxkillscriptu settings.lu" chdk/scripts/reboot -wait=15000dis
I'm stumped.
mc:start()
mc={ mode_sw_timeout=1000,...ending @until mc.doneend
function mc:start_single(lcon,opts)...lcon:exec('mc.run('..util.serialize(opts)..')',{libs='multicam'})
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
function mc:cmd(cmd,opts) => lcon:write_msg_pcall(sendcmd)
Minor modification to your posted code for anyone else finding this, this is what works.
for lcon in mc:icams() ...
A follow-up question. I have all the cameras set to run my setting script on startup (pushing buttons on the camera I found to be very temperamental - especially if you don't know the exact state the camera is in when you start).
Launching the settings script on boot has proven to be very consistent. I'd love for them to reboot after I've uploaded the updated settings script. I've tried Code: [Select]!for i,lcon in ipairs(mc.cams) do con=lcon cli:print_status(cli:execute('reboot')) end but it ends up just crashing the cameras (sometimes I have to pull the battery before they'll turn on again).
!mc:cmd('call reboot()')... wait for camera to reboot ...!mc:connect()
Oops, for mc:icams, it should be Code: [Select]for lcon in mc:icams() ...The reason to use icams is that it respects selecting subsets of cameras, where ipairs(mc.cams) will iterate over all connected cameras. This may not matter for your application.
Yes, button pushing sub-optimal in the best of times. You may be interested in: http://chdk.setepontos.com/index.php?topic=10624.0 as a more reproducible way of setting some cameras settings.
QuoteLaunching the settings script on boot has proven to be very consistent. I'd love for them to reboot after I've uploaded the updated settings script. I've tried Code: [Select]!for i,lcon in ipairs(mc.cams) do con=lcon cli:print_status(cli:execute('reboot')) end but it ends up just crashing the cameras (sometimes I have to pull the battery before they'll turn on again). I'm not entirely sure why it would crash, but by default, the cli reboot command waits for the camera the camera to reboot and then tries to re-connect to the same camera. This may well have problems if you have 14 identical cameras.If you haven't already, you could try -norecon, which should just fire off the reboot request and continue. You would need to reset the multicam connections later. mc:connect();mc:start() might do it, but I'm not completely sure off the top of my head.An alternative would be call reboot() from multicam. With one camera, the following seems to workCode: [Select]!mc:cmd('call reboot()')... wait for camera to reboot ...!mc:connect()note this uses mc:cmd rather than mc:cmdwait, since the status return will never be sent.
!mc:cmd('call reboot()')
!mc=require('multicam')!mc:connect({list=true})!for lcon in mc:icams() do con=lcon cli:print_status(cli:execute('u -nolua settings.lua chdk/scripts/')) end!mc:start()!mc:cmd('call reboot()')
It crashes the cameras. I think it has to do with the fact that it tries to disconnect from them when the script ends - where the interactive console sits there and waits for the next command. Is there a lua "sleep" command I can add to the end of my script that will keep it from trying to disconnect instantly after sending the reboot command?
!mc:cmd('call sleep(10000) reboot()')!for lcon in self:icams() do lcon:disconnect() end
In chdkptp lua (! commands) sys.sleep(n) will wait n milliseconds. There is some documention of the chdkptp APIs at https://www.assembla.com/spaces/chdkptp/wiki/Scripting_Guide but it doesn't include this function. I'm would not be surprised if disconnecting in the middle of rebooting confuses things.An alternate approach might be something like:Code: [Select]!mc:cmd('call sleep(10000) reboot()')!for lcon in self:icams() do lcon:disconnect() endThe idea is to send all the cameras a command to reboot after 10 seconds, and then disconnect all the multicam connections before they do it. I haven't tried it.
!mc:cmd('call sleep(10000) reboot()')
!mc=require('multicam')!mc:connect({list=true})!for lcon in mc:icams() do con=lcon cli:print_status(cli:execute('u -nolua settings.lua chdk/scripts/')) end!mc:start()!mc:cmd('call sleep(10000) reboot()')
Started by polvi Creative Uses of CHDK
Started by DanielF Hello, I'm a NEWBIE - HELP!! (Newbies assistance, User Guides and thank you notes)
Started by 74prof Creative Uses of CHDK
Started by plua_mea General Discussion and Assistance
Started by gauravparalikar91 General Help and Assistance on using CHDK stable releases