CHDK Script for controlling SX120IS in Skywalker X8 Flying Wing - page 2 - Script Writing - CHDK Forum

CHDK Script for controlling SX120IS in Skywalker X8 Flying Wing

  • 12 Replies
  • 6731 Views
Re: CHDK Script for controlling SX120IS in Skywalker X8 Flying Wing
« Reply #10 on: 09 / August / 2015, 10:04:19 »
Advertisements
I have changed the Arduino code to give pulses of 40, 80 and 120 mSec as you suggested.  I have tried running the code that you submitted again and I get a 'uBASIC:6 Unk stmt' error. 
Hmmm .. this points to something I should have asked right away.  What version & revision of CHDK are you using?  Go to the CHDK Miscellaneous Stuff menu and select Show Build Info.   Tell me what it says for  CHDK Ver:  and  Revision  ?  It's always worth an using the most recent update if you are having strange problems.

Meanwhile,  it appears that @chdk_version is not backwards compatible to CHDK 1.3.0 uBASIC programs.  It was supposed to be and it is in Lua.   As zeno suggests, just delete that line.

Note : if you change the Arduino pulse widths you will need to update the code in the script of course.

Quote
I have checked in the CHDK settings that [Disable LCD Off] is set to 'Always' but the camera still turns off after a few seconds in review mode.  If you think the camera is the reason that it shuts down in play mode then I will give up but if you think there is something that can be changed in the code then I will persevere.
Does the camera turn off using my version of the script?  And does it actually turn off or does the display go just go blank?   

UPDATE :  test script attached.  It will create a file called LOG_0001.TXT  located in the CHDK/LOGS folder on your SD card. Please run the test and post the result?
« Last Edit: 09 / August / 2015, 11:06:12 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: CHDK Script for controlling SX120IS in Skywalker X8 Flying Wing
« Reply #11 on: 09 / August / 2015, 15:15:08 »
Hi waterwingz and zeno,

I removed line 6 from the the script and adjusted the code to allow for the different voltage pulses and the script works exactly as I hoped it would! 

When the camera enters 'Stowed' mode it remains there and keeps looping through the 'Pulse detected 4' and 'Stowed 4' lines indefinitely but I can wake it up by changing the voltage pulse.  I have  been using a 2NZD servo tester to change the PWM signal reaching the Arduino.

I have attached the Arduino file and final Basic script if anyone else is interested in trying this.  I will also put it on my web page to help people find it.

waterwingz, i have added your name to the list of authors but not sure what your real name is!  Really appreciate your help thank you, it would have taken me days to write what you did.

Tom

Re: CHDK Script for controlling SX120IS in Skywalker X8 Flying Wing
« Reply #12 on: 09 / August / 2015, 16:04:34 »
I removed line 6 from the the script and adjusted the code to allow for the different voltage pulses and the script works exactly as I hoped it would! 
I'd suggest one small refinement as there are "holes" in your pulse width detection logic  :

Code: [Select]
while 1
   do
      sleep(20)
      k = get_usb_power
   until k > 0
   print "Pulse Detected",k
   if k < 7 then gosub "ch1up"
   if k > 6 and k < 11 then gosub "ch1mid"
   if k > 10 and k < 14 then gosub "ch1down"
   if k > 13 then print "error",k
wend
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal © 2008-2014, SimplePortal