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 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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue