Send info if their is a modification
This commit is contained in:
parent
784ebdee22
commit
3147a064db
|
|
@ -31,6 +31,7 @@ String OPTARIF = "";
|
||||||
String BASE = "";
|
String BASE = "";
|
||||||
String HCHP = "";
|
String HCHP = "";
|
||||||
String HCHC = "";
|
String HCHC = "";
|
||||||
|
bool sendData = false;
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
|
||||||
// Wait for x second.
|
// Wait for x second.
|
||||||
|
|
@ -82,6 +83,7 @@ void sendDataToServer() {
|
||||||
nextInterval = DEFAULT_INTERVAL;
|
nextInterval = DEFAULT_INTERVAL;
|
||||||
}
|
}
|
||||||
nextInterval = millis() + nextInterval;
|
nextInterval = millis() + nextInterval;
|
||||||
|
sendData = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isDigitSelf(char c) {
|
bool isDigitSelf(char c) {
|
||||||
|
|
@ -188,12 +190,15 @@ void loop() {
|
||||||
}
|
}
|
||||||
if (label == "HCHC" && isNumberSelf(value)) {
|
if (label == "HCHC" && isNumberSelf(value)) {
|
||||||
HCHC = value;
|
HCHC = value;
|
||||||
|
sendData = true;
|
||||||
}
|
}
|
||||||
if (label == "HCHP" && isNumberSelf(value)) {
|
if (label == "HCHP" && isNumberSelf(value)) {
|
||||||
HCHP = value;
|
HCHP = value;
|
||||||
|
sendData = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (millis() >= nextInterval) {
|
// if (millis() >= nextInterval) {
|
||||||
|
if (sendData && millis() >= nextInterval) {
|
||||||
sendDataToServer();
|
sendDataToServer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue