supplierdeeply

Script to 'co-operate' with external controller

  • 37 Replies
  • 5858 Views
*

Offline jules

  • **
  • 73
Script to 'co-operate' with external controller
« on: 20 / September / 2016, 08:28:13 »
Advertisements
I have powershot D10s at a remote location, running Ultimate intervalometer (thankyou waterwingz!) with power from external SLA batteries. This works well but I need to increase the time between battery changes. I want to try a microcontroller for power on/off, autostart CHDK, camera power button held down.

For this I need a script to take a single photo after each power-on. LCD screen should turn on for several seconds at the *first* start  (for checking camera alignment) but not on every time the script runs.

My newbie try:

Code: [Select]
-- turn on view screen first time only
-- [how?]

-- check SD card not full, then take photo
-- [how to check card?]

set_record(1)
sleep(1000)
shoot()   
sleep(1000)
set_autostart(2)  -- autostart once for next power-on
sleep(1000)
post_levent_to_ui('PressPowerButton')

I will be very grateful for help with missing bits [indicated] and improving the script.

Re: Script to 'co-operate' with external controller
« Reply #1 on: 20 / September / 2016, 10:31:38 »
Try this (not tested - sorry) :
Code: [Select]

edit :  deleted - see next post in this thread

« Last Edit: 20 / September / 2016, 19:23:21 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Script to 'co-operate' with external controller
« Reply #2 on: 20 / September / 2016, 19:23:03 »
Updated version of my previous script attached.  This one actually works. 

It seems the get_jgp_count() only returns a valid value after the first shot is taken following the camera being powered on. 
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline jules

  • **
  • 73
Re: Script to 'co-operate' with external controller
« Reply #3 on: 20 / September / 2016, 20:59:50 »
Many thanks Waterwingz!

Is there anything in this script that would not work properly with CHDK 1.3? 

Sorry I forgot to mention earlier: I'd like to stick with 1.3 for now. That way I can rely on other scripts that I've tested thoroughly. I will update CHDK later, when I have time for running long duration tests again.



*

Offline jules

  • **
  • 73
Re: Script to 'co-operate' with external controller
« Reply #4 on: 20 / September / 2016, 21:10:21 »
Script does run, as you said :)

However, results seem erratic and it's probably not a script issue. There are many uncertainties in my preliminary setup...  early stage of controller development...  button hold-down still far from perfect.... etc.

It would be a great help for trouble-shooting if I could insert a few text messages in the script to track what's happening during tests.

Would it be feasible to add a basic print text to lcd function, just for testiing?

Re: Script to 'co-operate' with external controller
« Reply #5 on: 20 / September / 2016, 21:12:43 »
I actually did that while testing and deleted before sharing.  I'll post a new version for you later tonight.

And it should work just fine with 1.3
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Script to 'co-operate' with external controller
« Reply #6 on: 20 / September / 2016, 22:17:51 »
New version with lots of print statements and additional options in the Script user menu.

Enable LCD off?      - enables the actual call to turn off the LCD (false = useful for testing)
Log to SD card?     - logs screen messages to A/oneshot.txt file on SD card
Delay (sec)             - set delay between steps in seconds - increase to watch what scrip is doing
Restart on powerup - enables script restart after a powerup. Disabling is nice during debugging.
Power off after shot?  - enables camera shut down after each shot.  Disable this for debugging.


Note that for testing purposes, the debug messages appear when restarting the camera or turning off the display even if you have disabled those options.
« Last Edit: 20 / September / 2016, 22:22:08 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline jules

  • **
  • 73
Re: Script to 'co-operate' with external controller
« Reply #7 on: 20 / September / 2016, 23:00:21 »
BIG thank you, waterwingz!

I will report back after some more testing.


*

Offline jules

  • **
  • 73
Re: Script to 'co-operate' with external controller
« Reply #8 on: 21 / September / 2016, 09:57:10 »
Stumbling along a rocky path...  first an error message about variables - maybe they have to be done differently for v 1.3 ? I set fixed values instead.

Then other issues that I could not identify properly. Possibly something went wrong with testing card space? Possibly lcd disable/enable behaves differently on D10? Finally got it working after removing parts I could not sort out - as attached. If you might have time to add back the card space check, that would be really great.

Also wondering whether there's any way to have a button-press to turn off autostart while the script is running?  Might need this in order to get view screen to stay on long enough for another check. I will be unable to delete the config file after the camera is in position in its mounting box.

Perhaps something like 'menu' press that will safely stop Ultimate Intervalometer - I'm thinking maybe it could disable autostart before safely stopping - could that be feasible?
« Last Edit: 21 / September / 2016, 09:58:56 by jules »

Re: Script to 'co-operate' with external controller
« Reply #9 on: 21 / September / 2016, 10:03:07 »
Sorry.  I used the 1.4 convention for declaring user variables. Easy enough to fix.
 
It would be easy to add maybe a 10 second delay after the shot during which pressing the menu key would disable autostart and the power off action.

Incidentally, what shot time interval do you anticipate using in your final application?
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics