Compare commits
No commits in common. "9d36a758756f5c2aed8ceade38f91e7ebf115dfd" and "a5300f34e6dcd36f977430bb2c56bf447ac1c228" have entirely different histories.
9d36a75875
...
a5300f34e6
11
src/main.cpp
11
src/main.cpp
|
|
@ -48,9 +48,6 @@ unsigned long sendDeviceStatus() {
|
||||||
http.addHeader("Content-Type", "application/x-www-form-urlencoded");
|
http.addHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||||
String httpData = "mac=" + WiFi.macAddress() + "&board=" + BOARD + "&firmware=" + BOARDFIRMWARE + "&service=" + SERVICE;
|
String httpData = "mac=" + WiFi.macAddress() + "&board=" + BOARD + "&firmware=" + BOARDFIRMWARE + "&service=" + SERVICE;
|
||||||
int httpResponseCode = http.POST(httpData);
|
int httpResponseCode = http.POST(httpData);
|
||||||
if ( DEBUG && (httpResponseCode != 200) ) {
|
|
||||||
Serial.println("Error sending status: " + String(httpResponseCode));
|
|
||||||
}
|
|
||||||
http.end();
|
http.end();
|
||||||
return millis();
|
return millis();
|
||||||
}
|
}
|
||||||
|
|
@ -69,17 +66,15 @@ unsigned long lastDebounceTime = 0;
|
||||||
bool actionState = false;
|
bool actionState = false;
|
||||||
bool debouncing = false;
|
bool debouncing = false;
|
||||||
void loop() {
|
void loop() {
|
||||||
unsigned long currentMillis = millis();
|
if ( millis() > (lastStatusTime + STATUSINTERVAL) ) {
|
||||||
if ( (currentMillis - lastStatusTime) >= STATUSINTERVAL ) {
|
|
||||||
lastStatusTime = sendDeviceStatus();
|
lastStatusTime = sendDeviceStatus();
|
||||||
currentMillis = lastStatusTime;
|
|
||||||
}
|
}
|
||||||
unsigned short buttonCheck = digitalRead(BUTTONPIN);
|
unsigned short buttonCheck = digitalRead(BUTTONPIN);
|
||||||
if ( buttonCheck != lastButtonState ) {
|
if ( buttonCheck != lastButtonState ) {
|
||||||
debouncing = true;
|
debouncing = true;
|
||||||
lastDebounceTime = currentMillis;
|
lastDebounceTime = millis();
|
||||||
}
|
}
|
||||||
if ( debouncing && (currentMillis >= (lastDebounceTime + DEBOUNCEMS)) ) {
|
if ( debouncing && (millis() >= (lastDebounceTime + DEBOUNCEMS)) ) {
|
||||||
debouncing = false;
|
debouncing = false;
|
||||||
if ( buttonCheck != buttonState ) {
|
if ( buttonCheck != buttonState ) {
|
||||||
buttonState = buttonCheck;
|
buttonState = buttonCheck;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user