diff --git a/src/main.cpp b/src/main.cpp index 1c1d87d..0be86a5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,7 +12,7 @@ #define SERVICE "LEDsActionButton" #define STATUSINTERVAL 600000 -String toggleURL = "http://moon.basement.lan/l/actionbutton.php?state="; +String actionURL = "http://moon.basement.lan/l/actionbutton.php?state="; String statusURL = "http://moon.basement.lan/l/boardstatus.php"; unsigned short buttonState = HIGH, lastButtonState = HIGH; unsigned long lastStatusTime = 0; @@ -20,10 +20,10 @@ unsigned long lastStatusTime = 0; AsyncWebServer server(80); PrettyOTA OTAUpdates; -void sendToggleMessage(bool state) { +void sendActionMessage(bool state) { Serial.println("Action button triggered"); char webMsg[255] = ""; - strcat(webMsg, toggleURL.c_str()); + strcat(webMsg, actionURL.c_str()); strcat(webMsg, (state) ? "true" : "false"); HTTPClient http; http.begin(webMsg); @@ -86,7 +86,7 @@ void setup() { } unsigned long lastDebounceTime = 0; -bool toggleState = false; +bool actionState = false; bool debouncing = false; void loop() { if ( millis() > (lastStatusTime + STATUSINTERVAL) ) { @@ -105,8 +105,8 @@ void loop() { if ( buttonCheck != buttonState ) { buttonState = buttonCheck; if ( buttonState == LOW ) { - toggleState = !toggleState; - sendToggleMessage(toggleState); + actionState = !actionState; + sendActionMessage(actionState); } } }