Hi, I have a small application spending most of the time sleeping. It wakes up, does a quick gauge measurement, publishes the data, and continues sleeping while putting the network into standby. I turn on the D7 led while the Electron is awake to have a visual feedback, but I dont really understand what I see.
This is a beta Electron 2G running 0.6.0-rc2, I have a 3G version as well, but it behaves the same way. Battery was full.
Here is a short video clip what I have:
Here is some explanation:
- (00:01) Reset the Electron.
- (00:05) Connected to Cloud, published data, start sleeping. - OK
- (00:36) Device woke up, published data, keeps on breathing cyan… - Why?
- (01:37) Stopped breathing cyan. - What happened here for 1 min??? D7 led doesn’t turn on.
- (02:07) Device woke up, published data, start sleeping 10 sec later. - Strange
- (02:45) Device woke up, reconnecting to Cloud. I get device came online on Console, published data, start sleeping. - Renegotiating with the Cloud?
- Maybe does one more cycle, then continues from state 3, so it is reproducible.
Questions:
- After 00:36 why does the Electron keep on breathing cyan?
- What happens between 00:36 and 01:37? D7 led is off, so the Electron should be sleeping.
- Sometimes the Electron goes back sleeping much later ~10 seconds. Why does it need some much time?
- Why does it need to renegotiate with the Cloud just after such a short time? (It was running the same app before the video, so 23 mins didn’t expired.)
- Why is this behavior periodic?
Here is the whole code:
SYSTEM_THREAD(ENABLED);
char str[64];
FuelGauge fuel;
void setup()
{
pinMode(D7, OUTPUT);
digitalWrite(D7, LOW);
}
void loop()
{
digitalWrite(D7,HIGH);
waitUntil(Particle.connected);
sprintf(str, "%02.2f %03.2f", fuel.getVCell(), fuel.getSoC());
Particle.publish("data", str, 60, PRIVATE);
digitalWrite(D7,LOW);
System.sleep(D0, RISING, 30, SLEEP_NETWORK_STANDBY);
}
Let me know if you have any suggestions. Thank you.