Multi cam script help for deferred start - page 2 - Script Writing - CHDK Forum

Multi cam script help for deferred start

  • 11 Replies
  • 6424 Views
Re: Multi cam script help for deferred start
« Reply #10 on: 02 / December / 2017, 13:25:35 »
Advertisements
Looks excellent - i'll hopefully test the manual part out next week sometime.

I'm embarrassed to say, even after all this time, I hadn't realised it was ok to reconnect (so long as script was stopped) if a connection already existed  :-[ (hence my erroneous original "programmatically disconnect all currently connected cameras" comment).

The mc.cam_powercycle_cmd is also a very nice idea but i'm not yet set up with a microcontroller to physically do that (until now i'd only ever contemplated redirecting status to text file and having AutoIt/PuTTy interface to serial).

Anyway - even if this is not eventually automated the manual part should save a lot of development debug time.

Good stuff - thanks.




FMI:
https://en.wikipedia.org/wiki/GNU_Readline

Hello:
     Is that possible to use CHDKPTP to control an arduino ? or just sending a signal to an arduino.
If you just want to send a signal to the arduino from a Lua script in chdkptp over a serial port or something like that, you can execute external commands form chdkptp using os.execute. You can also use popen and lua IO functions to send output to a running process.



Hello, thanks for the speedy and helpful replies.  (I was away for a few days, so have only just been able to implement the suggestions).

The important clue I had missed was to use cli:execute() within the local Lua script.
I now have this in a file which I manually 'require' after starting chdkptp, as in:

function take_n(n)
   for k = 1,n*2,2 do
      print(k,n);
      cli:execute("shoot ")
      os.execute("lua step_400ms.lua")
      print(k+1);
   end
end

I have another Lua script which pulses COM2:'s DTR line, which is used to drive a turntable under my SX130 rostrum camera.  I could not seem to get this bit of Lua code to work within chdkptp, so I used os.execute() to run it separately.  This uses luars232 - I had trouble with this library at first, as the dll version installed by Lua for Windows is old and does not support the set_dtr() method.

So, it is a little bit klunky, but it does what I want.

I am using a simple 'shoot' command, and it seems to take about 6 seconds per loop.  I think I will investigate using manual focus, as this could speed up the process - it that liekly?

Thanks again for your help.

John

Note you can execute the above directly from chdkptp too
con> !return os.execute('imconvert.exe foo.ppm -resize 640x480! foo.pam -resize 640x480! -layers merge foo.jpg')
« Last Edit: 04 / December / 2017, 03:18:55 by andrew.stephens.754365 »

*

Offline reyalp

  • ******
  • 14080
Re: Multi cam script help for deferred start
« Reply #11 on: 02 / December / 2017, 15:21:53 »
I'm embarrassed to say, even after all this time, I hadn't realised it was ok to reconnect (so long as script was stopped) if a connection already existed  :-[ (hence my erroneous original "programmatically disconnect all currently connected cameras" comment).
Yeah, it should be OK, and when looking at it I realized I never wrote an mc:disconnect() :-[

Also, for anyone who comes across this later, the "wait for keyboard" part doesn't currently work from the GUI.
Don't forget what the H stands for.

 

Related Topics