Relatedly, I still haven't tracked my memory leaks down, so I am using this pattern for those devices (sensors) which only poll occasionally and do not require realtime:
//simplified example with all the logic in init.
E.on('init', function () {
setDeepSleep(0); //only want to sleep after I finish my actions
setTimeout(load, 600000); //restart every 10 minutes to poll again
doPolls(function() { //callback function called when complete
setDeepSleep(1); //now I can go to sleep until time to reboot
});
});
Okay, I should find and fix my code leaks, but this is a common and/or reasonable pattern in embedded?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Relatedly, I still haven't tracked my memory leaks down, so I am using this pattern for those devices (sensors) which only poll occasionally and do not require realtime:
Okay, I should find and fix my code leaks, but this is a common and/or reasonable pattern in embedded?