Send info if their is a modification

This commit is contained in:
Chteufleur 2016-06-17 19:36:26 +02:00
parent 784ebdee22
commit 3147a064db
1 changed files with 6 additions and 1 deletions

View File

@ -31,6 +31,7 @@ String OPTARIF = "";
String BASE = "";
String HCHP = "";
String HCHC = "";
bool sendData = false;
//----------------------------------------------------
// Wait for x second.
@ -82,6 +83,7 @@ void sendDataToServer() {
nextInterval = DEFAULT_INTERVAL;
}
nextInterval = millis() + nextInterval;
sendData = false;
}
bool isDigitSelf(char c) {
@ -188,12 +190,15 @@ void loop() {
}
if (label == "HCHC" && isNumberSelf(value)) {
HCHC = value;
sendData = true;
}
if (label == "HCHP" && isNumberSelf(value)) {
HCHP = value;
sendData = true;
}
if (millis() >= nextInterval) {
// if (millis() >= nextInterval) {
if (sendData && millis() >= nextInterval) {
sendDataToServer();
}
}