Is the code sample in the doc for imp.deepsleepfor(x) the method I should be using if I want to take a point every minute without waking up the WiFi radio at all but then after a certain nv table defined amount of minutes push an averaged point to our server?
I have copy and pasted the code verbatim from the link above and then changed a few things to look like this:
`
t <- time();
function hourly() {
server.log(“wifi is on right now”);
nv.data = 0;
server.expectonlinein(3600);
}
function log() {
local min = (t/60) % 60;
nv.data++;
if (min == 59) {
hourly();
}
server.log(“wifi should be off here”);
imp.onidle(function() { imp.deepsleepfor(60 - (time() % 60)); });
}
if (!(“nv” in getroottable())) {
nv <- { data = 0 };
hourly();
}
imp.onidle(log);
`
When i run this code the I am seeing this every minute:
2014-05-07 19:00:14 UTC-4: [Status] Device booting; xx.xx% program storage used
2014-05-07 19:00:17 UTC-4: [Device] wifi should be off here
2014-05-07 19:00:17 UTC-4: [Status] Device disconnected; x bytes sent, x received, x total
This leads me to believe that the wifi is turning on every minute to put another point into the nv table. I NEVER want the wifi to turn on for a minute log only for the specified amount of minutes log.
any help would be greatly appreciated.