Change the word toggle to action

This commit is contained in:
Junior 2025-04-08 19:43:17 -04:00
parent bcb5208e4d
commit c7ece609ea

View File

@ -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);
}
}
}