Problem with setTimeout() and deep sleep mode #4687
Replies: 1 comment
-
Posted at 2015-02-10 by @gfwilliams That sounds strange - how long does it take before the problem happens? Can you reconnect via USB afterwards? And when you do that does blinking resume again? Maybe if you can log in when it happens, you could check I've set one up here with your code, so I'll see if I can get it to happen. Posted at 2015-02-10 by net-tobi Hi Gordon, it is different. I recognized it for the first time after 3 hours. When I reconnected the USB it directly continued blinking. For shorter intervals (less than one hour) it happend faster. I will set the interval a little shorter and try to log in when it happens again. Best, Tobias Posted at 2015-02-10 by @allObjects I noticed - on mistakes (miscoding) - on my part, when interval/timeout things repeat more often or get faster than expected, that I had multiple 'the same' intervals/timeouts running at the same time: my code created the same interval/timeout unintentionally again time skewed. From 'severely' glancing over the code I do not think this should happen in your piece of code, but give it a check... (log the interval id's and timeout id's you get when setting them together with the variable names you stick the interval into (---> i), and also which ones you clear... this may help you detect multiples running or exclude 'my theory' from being a possible cause). (since you use an onboard LED, I exclude the option of an auto reset / brown out on power break down as have been noticed when LED strings - are run from the board's power or board supplying USB power (if not 8, then 9 RGB LEDs on full white will tear down a standard USB). @gfwilliams, could it be that the timeout/s is/are not 'completed' when the deep sleep set's in which the deep sleep 'command' resides? ...or some reentrant issues in timing code... I guess I goe on wild goose chase and fishing in a muddy pond (muddy for me ignorant, crystal clear for you as the creator, @gfwilliams!) Posted at 2015-02-10 by @gfwilliams Actually I'm not really sure what the issue could be - my only guess so far would be that it's using the external real-time clock, and that it's unstable - either stopping, or oscillating wildly causing time to run too quickly. It's just a guess though - it's very hard to know anything without a bit more info. Posted at 2015-02-12 by net-tobi I replaced the blink function by logging the current system time to the SD-Card frequently. First I tried to use a 20sec interval, this worked fine (but I just tested a few minutes). When I tried to use it with an hourly interval I just had two entries after 1 day testing. The clock seems to work in a proper way. After that I did a polyfill for the Espruino related functions and tested my code in Node.js. There I don't have any timing problems, so it must have something to do with deep sleep. Today I am testing the code by using setInterval(). Posted at 2015-02-12 by @gfwilliams Maybe try without deep sleep? I've left mine running and it still seems to be going fine. I can't say I've noticed the blinking but when I plug in via USB everything seems to still be working correctly... Posted at 2015-02-12 by net-tobi This will be the next thing I will try when setInterval() did not succeed. The strange thing is, when it stopped working, all the time when I reconnected the device to USB it continued working for some time. Posted at 2015-02-12 by @gfwilliams Stupid question, but are you using an up to date firmware on the board? I know a while back there were issues where big values for I can actually log into the board I have here and type Posted at 2015-02-12 by net-tobi I am currently using firmware version 1v73. Did you try to power the board just by a battery and disconnect the USB cable as well? It just happens in this particular setup. Posted at 2015-02-12 by @gfwilliams Yes, it's sitting on my desk like that right now - it's been running for the last 2 days without a reset. It's not that there's a bad connection between the board and the battery is it? If the board becomes disconnected for a small amount of time it can 'brown out' and end up in bad states. Posted at 2015-02-12 by net-tobi I used the offical JST connector and soldered it to a 9V clip. I am using that clip with a battery holder for 8 * 1,2 V accumulators. I'll try to use other batteries. As well I will do the tests with another Espruino Board again. Posted at 2015-02-12 by @gfwilliams Thanks! Sorry I can't be more help... If I could reproduce it here I could do something about it. I'm using an old 3.7v LiPo phone battery here. Posted at 2015-02-12 by net-tobi No problem. Thank you for your support so far. If I find out what's happening I'll inform you again. Posted at 2015-02-12 by @allObjects
In other words, it is enabling / disabling deep sleep - and deep sleep is entered when enabled and 'the work/event queue' became empty. Very interesting. #sleep #deepsleep Posted at 2015-02-13 by net-tobi setInterval() didn't work as well Posted at 2015-02-13 by @gfwilliams Did you check that Posted at 2015-02-13 by net-tobi When I plug in getTime is working like a charm. I will test what it shows after one day running. Posted at 2015-05-16 by Hardware_Hacks Did you find the issue with this in the end? I'm noticing similar issues with my set interval on my gsm GPS tracker. I sleep for 1 hour then wake and send coordinates. This seems to fire inconsistently and even when running lower intervals e.g. 30 mins. However 5 mi utes seems to be fine Posted at 2015-05-16 by DrAzzy Are you using latest version? Changelog suggests that v79 fixes a bug with timeouts and deepsleep. Posted at 2015-05-18 by @gfwilliams As @drazzy says, it was only recently discovered and fixed. You may well not have had the latest version... |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2015-02-10 by net-tobi
Hello everyone,
I am using the current release of Espruino together with the Espruino Board v1.4b and I experienced a weird problem with setTimeout() and deep sleep by using the following peace of code:
This code shall let the device blink for 5sec every hour and go into deep sleep mode after blinking. This works for a while and then it suddenly stops blinking without any error being raised or the light is blinking faster with very low power.
The batteries are fully charged. This behaviour can not be reproduced when the device is connected via USB.
Do you have an idea?
Best,
Tobias
Beta Was this translation helpful? Give feedback.
All reactions