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");
|
||||
String httpData = "mac=" + WiFi.macAddress() + "&board=" + BOARD + "&firmware=" + BOARDFIRMWARE + "&service=" + SERVICE;
|
||||
int httpResponseCode = http.POST(httpData);
|
||||
if ( DEBUG && (httpResponseCode != 200) ) {
|
||||
Serial.println("Error sending status: " + String(httpResponseCode));
|
||||
}
|
||||
http.end();
|
||||
return millis();
|
||||
}
|
||||
|
|
@ -69,17 +66,15 @@ unsigned long lastDebounceTime = 0;
|
|||
bool actionState = false;
|
||||
bool debouncing = false;
|
||||
void loop() {
|
||||
unsigned long currentMillis = millis();
|
||||
if ( (currentMillis - lastStatusTime) >= STATUSINTERVAL ) {
|
||||
if ( millis() > (lastStatusTime + STATUSINTERVAL) ) {
|
||||
lastStatusTime = sendDeviceStatus();
|
||||
currentMillis = lastStatusTime;
|
||||
}
|
||||
unsigned short buttonCheck = digitalRead(BUTTONPIN);
|
||||
if ( buttonCheck != lastButtonState ) {
|
||||
debouncing = true;
|
||||
lastDebounceTime = currentMillis;
|
||||
lastDebounceTime = millis();
|
||||
}
|
||||
if ( debouncing && (currentMillis >= (lastDebounceTime + DEBOUNCEMS)) ) {
|
||||
if ( debouncing && (millis() >= (lastDebounceTime + DEBOUNCEMS)) ) {
|
||||
debouncing = false;
|
||||
if ( buttonCheck != buttonState ) {
|
||||
buttonState = buttonCheck;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user