focus in multilapse.lua (was Re: Setting focus from scripts or menus) - page 3 - General Discussion and Assistance - CHDK Forum

focus in multilapse.lua (was Re: Setting focus from scripts or menus)

  • 26 Replies
  • 16411 Views
*

Offline Sdack

  • ***
  • 195
Re: focus in multilapse.lua (was Re: Setting focus from scripts or menus)
« Reply #20 on: 14 / August / 2018, 22:20:26 »
Advertisements
Ok it works.. thanks again.

Of course I had to turn on the relay power, which is normally wrapped in the Multilapse scripts..
and it gave me an image named IMG_1374.jpg, instead of a neatly formatted and time stamped multilapse version like this
mycamera-2018-08-14-19.04.39.jpg

and there's no retrying the camera if the power fails first time, or error messaging, or temperature readings, or logging.. all the things I love about Multilapse.

So, thanks to you I feel I understand more about what's going on so I will see if I can apply what I've learned to adapting Multilapse 'properly'

I think if I modify the 'shooting loop' to include the camera init funtion (which includes switching to rec mode) and then a switch to play mode at the end, it just might work..

*

Offline Sdack

  • ***
  • 195
Re: focus in multilapse.lua (was Re: Setting focus from scripts or menus)
« Reply #21 on: 14 / August / 2018, 22:40:56 »
Ok  I wasn't game to relocate the entire camera_init function into the shooting loop , because it does a heap of stuff that only needs to be done once.  However I did add this to code to the start of the shooting loop
Code: [Select]
print('Going into rec mode')
    cli_cmd('rec')
and I added this to the end of the shooting loop, just after the line status = capture_picture()
Code: [Select]
print('Going into play mode')
    cli_cmd('play')
and it works just fine.  I do get an error the shooting loop first runs, and encounters my additional
Code: [Select]
print('Going into rec mode')
    cli_cmd('rec')
because it complains, rightly, that the camera is 'already in rec mode'

I don't know how to aviod this, or if it's likely to cause anything other than the one off error.

I didn't add anything to the other associated scripts.. multilapse-config.lua and multilapse.. guess I'll see what happens if I leave this running for a while

modified script attached

Any suggestions?

Re: focus in multilapse.lua (was Re: Setting focus from scripts or menus)
« Reply #22 on: 14 / August / 2018, 22:46:39 »
because it complains, rightly, that the camera is 'already in rec mode'
Consider it more a warning than an error.  And ignore it.
« Last Edit: 14 / August / 2018, 22:53:21 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline Sdack

  • ***
  • 195
Re: focus in multilapse.lua (was Re: Setting focus from scripts or menus)
« Reply #23 on: 14 / August / 2018, 22:57:14 »
Phew.. I'm feeling elated.  Thanks to your guidance and patience, I've achieved something I didn't think I could do.

I have only two entries in my cron for today, one to start running multilapse and one to finish it tonight at 6:30.

My development image gallery can be found here.. it may amuse you to see me rugged up and coding

http://motioncircus.com/econic/

password econic

*

Offline reyalp

  • ******
  • 14126
Re: focus in multilapse.lua (was Re: Setting focus from scripts or menus)
« Reply #24 on: 15 / August / 2018, 00:31:07 »
And I also added a line to switch the camera back into playback.  Don't forget to go into the Canon menu and set the lens retract delay to 0 sec.
FWIW, I'd suggest running all the commands in one invocation of chdkptp. Sometimes you may run into errors if you try to connect too quickly after disconnecting. You might also want some between the shooting and the rec play switches.

It could be done it like this
chdkptp -e"source ptpshoot.txt"
where ptpshoot.txt contains something like
Code: [Select]
connect
rec
exec sys.sleep(500)
rs mycam-${ldate,%Y-%m-%d-%H.%M.%S}${ext}
exec sys.sleep(500)
play

@Sdack
If you are happy with what you are getting using multilapse, you can ignore all this, I'm only posting in case you (or some future reader) might find it useful ;)

You can format the filename with chdkptp substitution strings. The example above should give you something like multilapse. You can add a directory path in front if you want. The stuff after ldate is strftime format codes http://pubs.opengroup.org/onlinepubs/009695399/functions/strftime.html

Some cameras crash when you switch to play after using remoteshoot. If yours suffers from this, you can work around it using the -jpgdummy option to remoteshoot, and the imrm command to remove the dummy files after switching to play, like
Code: [Select]
connect
rec
exec sys.sleep(500)
rs -jpgdummy mycam-${ldate,%Y-%m-%d-%H.%M.%S}${ext}
exec sys.sleep(500)
play
exec sys.sleep(500)
imrm
Don't forget what the H stands for.

*

Offline Sdack

  • ***
  • 195
Re: focus in multilapse.lua (was Re: Setting focus from scripts or menus)
« Reply #25 on: 15 / August / 2018, 20:33:15 »
My rig is ticking away nicely now..
Thanks again WW and Reyalp for your guidance.


Re: focus in multilapse.lua (was Re: Setting focus from scripts or menus)
« Reply #26 on: 16 / August / 2018, 13:43:25 »
It took me a while to figure it out, then i found the script autorun ONCE setting which meant I could proceed a lot quicker.  Previously I'd been setting autorun to 'on' then having to pull the SD card out, set it to writeable, pop it into my PC then rename the script, to prevent it from running every time I powered the camera on.  It was like wading through mud.
Incidentally, when CHDK is running a script, by default pressing the shutter button will halt that script.

So you can kill the one_shot.lua script by pressing the power button while it's running.  If the start and stop delay values are small this can be tricky so when testing just make the stop value something like five seconds?
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal © 2008-2014, SimplePortal