Open structure7 opened 7 years ago
What I came up with:
bool blynkFlag;
int blynkDisconnectCount;
void setup (){
timer.setInterval(250L, disconnectWatcher); // Watches for a disconnect event
timer.setInterval(5000L, disconnectReporter); // Reports disconnects to the app every 5 seconds
}
void disconnectWatcher() {
if (Blynk.connected() == false && blynkFlag == false) {
++blynkDisconnectCount;
blynkFlag = true;
}
else if (Blynk.connected() == true && blynkFlag == true) {
blynkFlag = false;
}
}
void disconnectReporter() {
Blynk.virtualWrite(V10, blynkDisconnectCount);
}
\\ Optionally... in a run once type deal
Blynk.setProperty(V10, "label", String(hour()) + ":" + minute() + " " + month() + "/" + day()); // Or whatever prints current time/date
I can see there's some value in being able to differentiate between a blynk or WiFi "event." Not sure how I can do that but worth looking into.
So there's three bad things that can happen:
What I know:
The idea: Monitor each occurrence of Blynk disconnecting, for whatever the reason. Ideally, report this to a vPin like the uptime monitoring seconds are. THIS SHOULD HELP TROUBLESHOOT PROBLEMS.
Side notes:
Blynk.disconnect()
is a thing. Might need to see if that's something I'd like to play with for some reason.