when shall i sleep()? - LUA Scripting - CHDK Forum

when shall i sleep()?

  • 2 Replies
when shall i sleep()?
« on: 14 / February / 2009, 21:21:26 »
i'm working away on sunsetF16 and i think i've figured out what is causing some of the crashes. these crashes - if they can rightfully be call that - consist of the script exiting with the statement "PRESS SHUTTER TO CLOSE" when the script was in an infinite loop. (the purposeful kind) i see less of these statements if i insert a sleep() statement. does that make sense? if so, is there any sort of method for the placement of sleep statements? is sleep(100) better than sleep(1)?


Offline reyalp

  • ******
  • 14084
Re: when shall i sleep()?
« Reply #1 on: 14 / February / 2009, 22:02:32 »
Starving the rest of the camera of CPU would make the camera shut down, not quit with a script error, so it's not clear why the sleeps would help.

If you can make a minimal example that reproduces the problem, that would be helpful. If that's not possible, attach the entire script and clearly describe the circumstances where the problem happens.

there should be an error message immediately preceding the the "PRESS SHUTTER TO CLOSE" message. This is generated in kbd.c wait_and_end() which should be called if lua_resume() returns an error.
« Last Edit: 14 / February / 2009, 22:06:08 by reyalp »
Don't forget what the H stands for.

Re: when shall i sleep()?
« Reply #2 on: 14 / February / 2009, 22:57:17 »
I hink it may be giving an error - 419. no text.

i previously thought it was some odd debugging info.


Related Topics