command work in CHKPTP cli but not in CHKPTP script (multicam.lua) - Script Writing - CHDK Forum supplierdeeply

command work in CHKPTP cli but not in CHKPTP script (multicam.lua)

  • 2 Replies
  • 3838 Views
*

Offline mrred

  • *
  • 13
command work in CHKPTP cli but not in CHKPTP script (multicam.lua)
« on: 01 / September / 2016, 15:43:10 »
Advertisements
Hi everyone, I have a noob pb with chkptp, I try to setup resolution of all of my camera rig, with a chkptp script:



!mc=require('multicam')
!mc:connect()
!mc:start()
!mc:cmd('set_prop(require("propcase").RESOLUTION, 3)')
!mc:cmd('exit')


and I execute the script with chkptp.exe -rscript.sh


I have no error message but it doesn't change the resolution, if I manualy enter the commands by chkptp cli it work.


any idea?


thx alot.




*

Offline mrred

  • *
  • 13
Re: command work in CHKPTP cli but not in CHKPTP script (multicam.lua)
« Reply #1 on: 01 / September / 2016, 15:58:44 »
I found the solution :)


:


!mc:cmd('call set_prop(require("propcase").RESOLUTION, 0)')

*

Offline reyalp

  • ******
  • 14082
Re: command work in CHKPTP cli but not in CHKPTP script (multicam.lua)
« Reply #2 on: 01 / September / 2016, 16:05:12 »
To execute code in multicam, you have to use the "call" or "pcall" commands, like

!mc:cmd('call set_prop(require("propcase").RESOLUTION, 3)')

Quote
I have no error message but it doesn't change the resolution, if I manualy enter the commands by chkptp cli it work.
You didn't see any error messages because you didn't wait for or check the status. If you used
Code: [Select]
!return mc:cmdwait('set_prop(require("propcase").RESOLUTION, 3)')
You would see something like
Code: [Select]
=true,{
 [1]={
  failed=false,
  done=true,
  status={
   cmd="set_prop",
   msg="unknown",
   status=false,
  },
 },
}
You can also use the mc:print_cmd_status or print_cmd_status_short functions, like
Code: [Select]
!mc:print_cmd_status_short(mc:cmdwait('call set_prop(require("propcase").RESOLUTION, 3)'))

Edit:
The status values are an array, with one entry per camera. The outer "failed" and "done" field refer to communication with the camera. The inner status is the status of from the command on the camera.

Edit #2:
mc:cmd does not return status, because it returns as soon as the commands have been sent to all the cameras.
« Last Edit: 01 / September / 2016, 16:12:02 by reyalp »
Don't forget what the H stands for.

 

Related Topics