Script auto-start troubles - General Help and Assistance on using CHDK stable releases - CHDK Forum

Script auto-start troubles

  • 4 Replies
  • 2556 Views
Script auto-start troubles
« on: 09 / December / 2009, 13:09:56 »
Advertisements
Hi,

I'm working with CHDK (actually, we're using Stereodata Maker) and I'm finding that although I set a script to execute automatically on camera start-up, occasionally it will simply not execute.  I'm finding that the script name is displayed, but after this the camera simply sits idly.  I'm also finding that this happens roughly tenth camera power-up.  Has anyone else observed this kind of behaviour?  Is there any solution to this?  Following is the script that is auto-started:

Code: [Select]
@param a USB TIME
@default a 0
@param d DELAY
@default d 25
@param i DELAY_COUNT
@default i 0
@param r REVIEW_DELAY
@default r 110
@param l LCD_ON
@default l 1

rem 0 - Take Picture; 1 - Take Movie; 2 - Zoom In; 3 - Zoom Out; 4 - Review Images;
@param b STATE
@default b 0

a = 0
i = 0
l = 1
b = 0

set_sync 0 0 0 0

gosub "display_stage"

rem main loop
:main
i = 0
a = 0
do
a = get_usb_power
sleep_for 45
i = i + 1
until ((a > 0) or (i > d))

if (i > d) then
b = (b+1) % 5
gosub "display_stage"
endif
if ((a>0) and (a<15) and (l = 1)) then
gosub "activate_stage"
gosub "display_stage"
endif
if ((a>0) and (a<15) and (l = 0)) then
lcd_on_off
record_mode
l = 1
endif
if ((a>15) and (a<25)) then
gosub "usb_connect"
endif
if ((a>25) and (a<35) and (l = 0)) then
lcd_on_off
l = 1
endif
if ((a>35) and (a<45) and (l = 1)) then
lcd_on_off
l = 0
endif
if ((a>45) and (a<55)) then
shut_down
endif
goto "main"


:display_stage
cls
if (b = 0) then
" TAKE PICTURE"
endif
if (b = 1) then
" TAKE MOVIE"
endif
if (b = 2) then
" ZOOM IN"
endif
if (b = 3) then
" ZOOM OUT"
endif
if (b = 4) then
" REVIEW"
endif
return

:activate_stage
cls
if (b = 0) then
press "shoot_half"
sleep_for 2500
press "shoot_full"
sleep_for 2500
release "shoot_full"
release "shoot_half"
endif
if (b = 1) then
movie_mode
sleep_for 2000
" Press switch to stop record"
press "shoot_full"
sleep_for 100
release "shoot_full"
do
a = get_usb_power
until (a > 0)
press "shoot_full"
sleep_for 100
release "shoot_full"
cls
" Saving movie..."
sleep_for 1000
record_mode
sleep_for 1000
endif
if (b = 2) then
set_zoom_rel +1
endif
if (b = 3) then
set_zoom_rel -1
endif
if (b = 4) then
playback_mode
:activate_stage_pb
i = 0
a = 0
do
a = get_usb_power
sleep_for 45
i = i + 1
until ((a > 0) or (i > r))
if ((a>0) and (a<10)) then
click "right"
sleep_for 100
goto "activate_stage_pb"
endif
if ((a>10) and (a<25)) then
gosub "usb_connect"
playback_mode
goto "activate_stage_pb"
endif
a = 0
record_mode
sleep_for 1000
endif
return

:usb_connect
cls
if (l = 0) then
lcd_on_off
l = 1
endif
sleep_for 5000
make_usb_connection
do
a = get_usb_power
sleep_for 250
until ((a>100) and (a<300))
break_usb_connection
sleep_for 5000
return

end

Thanks,

Peter

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Script auto-start troubles
« Reply #1 on: 09 / December / 2009, 13:36:46 »
I don't use autostart much so can't comment on its reliability, but this doesn't sound like correct behavior.

Have you tried replicating the problem with other scripts? Adding a delay (such as "sleep 5000") to the start of your script could help in case your script is calling something that is not safe to call until the cam and CHDK have finished booting properly.

Re: Script auto-start troubles
« Reply #2 on: 09 / December / 2009, 15:18:51 »
Is there any solution to this? 


Well, I have just booted my A620 ten times and the script ran every time.

Maybe it is a problem with your memory card.

Try formatting it in the camera and then make bootable with sdminst.exe.

Let us know how you get on.

SDM 1.82 will be released in a few days but can always send you a copy immediately.

I do not think that will solve the 'problem' though.



David

Re: Script auto-start troubles
« Reply #3 on: 09 / December / 2009, 15:29:52 »
Try to troubleshoot where it is actually getting hung up in the script.  As micro says, perhaps its trying to do something the camera isn't ready for yet.

Add some variable watches into the script perhaps.  Display the current i in the first loop to the screen to see how it is looping.


Re: Script auto-start troubles
« Reply #4 on: 09 / December / 2009, 16:41:23 »
I forgot to ask ... are you using WIA-Loader to upload the images to the PC for review ?

What camera are you using ?


David

 

Related Topics