-
Hello,
I'm running the original Espruino board, latest revision.
As far as I could tell, rapid firing would continue indefinitely, though I usually wouldn't wait that long.
Didn't know about the calibration phase, anywhere I could read up on that? Delaying the code execution by 10 seconds did indeed solve the issue, thank you. -
-
Hello,
I'm trying to get Espruino to store a timestamp in Storage, and the read from it on boot and set the current time accordingly. This is the salient code:var TimeController = { currentTimeFilename: "currentTime", writeCurrentTime: function() { var currentTime = Number(new Date(Date.now()).getTime() / 1000); Storage.writeJSON(this.currentTimeFilename, { "timestamp": currentTime, }); }, readCurrentTime: function() { var currentTime = Storage.readJSON(this.currentTimeFilename, true); if (currentTime) { setTime(currentTime.timestamp); } }, }; E.on('init', function() { clearInterval(); clearTimeout(); clearWatch(); TimeController.readCurrentTime(); setInterval(() => { TimeController.writeCurrentTime(); }, 30000); }); save();
However, when the code executes the first time after Espruino is plugged into power (not PC), all of the intervals fire incredibly rapidly (similarly to issue described here). Removing all instances of
setTime
remedies this. Not sure what kind of conflict is occurring there, any help would be appreciated!
@Gordon
After some additional testing, it seems that making any
setInterval()
calls within that calibration period will throw it off. I have some fairly innocuous code firing within 50ms intervals, and before removing it, I noticed a significant time drift (about 1 minute per hour).