Shut_down problems: 'sleep' needed - Script Writing - CHDK Forum

Shut_down problems: 'sleep' needed

  • 2 Replies
  • 5358 Views
Shut_down problems: 'sleep' needed
« on: 22 / August / 2008, 20:57:56 »
Advertisements
Having notifyied some strange behaviour with 'shut_down',I have made some test in script like this:
(in a loop 'for next')
if ....then shut_down
shoot
print x
next x

At my surprise I needed a 'sleep 1000' on my g7 Allbest#50 after if...shut_down!(to not execute following lines)
If my scipt shoot delay was to 1(.1s) a sleep (1100 at least)was needed before 'print', too.Two or more following instructions
 may be involved.Used in a loop,shut_down followed by other instructions(a=get_usb_power for example) without 'sleep' may put in trouble.

Last edit:
As a 'sleep 1100' is indesirable in a loop,the 'shutdown'has only to be get out of the loop:

for x=...
if ...  then goto "shutdown"
next x
:shutdown
 shut_down
 sleep 1500
 end


« Last Edit: 24 / August / 2008, 20:30:27 by maka45 »

Re: Shut_down problems: 'sleep' needed
« Reply #1 on: 24 / August / 2008, 22:26:58 »
After other tests on my g7 allbest#50(lcd off enabled),it seems that 'shut_down'with

  the standard-single 'if then else'statement needs a 'sleep'.
  the Fingalo-multiple statement doesn't need a 'sleep' ..in some cases?if there is not other commands out of the 'if then else endif' statement but the script (loop)is still running.
Anyway with the multiple statement I can add a 'sleep' without problem,for example:
  if.....then
      shut_down
      sleep 1500
  else
  endif

Very strange but this may explain if some scripts are running correctly and others not.
« Last Edit: 24 / August / 2008, 23:21:25 by maka45 »

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Shut_down problems: 'sleep' needed
« Reply #2 on: 25 / August / 2008, 00:43:06 »
we might be able to fix the ubasic shutdown command, so that fixing scripts isnt needed anymore.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal