diff --git a/src/modules/others/webInterface.cpp b/src/modules/others/webInterface.cpp index 0b35b539..42ad3ec7 100644 --- a/src/modules/others/webInterface.cpp +++ b/src/modules/others/webInterface.cpp @@ -307,9 +307,10 @@ void configureWebServer() { if (server->hasArg("cmnd")) { String cmnd = server->arg("cmnd"); if( processSerialCommand( cmnd ) ) { - server->send(200, "text/plain", "OK"); + setup_gpio(); // temp fix for menu inf. loop + server->send(200, "text/plain", "command " + cmnd + " success"); } else { - server->send(400, "text/plain", "ERROR, check the serial log on the device for details"); + server->send(400, "text/plain", "command failed, check the serial log for details"); } } server->send(400, "text/plain", "http request missing required arg: cmnd"); diff --git a/src/modules/others/webInterface.h b/src/modules/others/webInterface.h index be662ca6..8c668b18 100644 --- a/src/modules/others/webInterface.h +++ b/src/modules/others/webInterface.h @@ -331,6 +331,7 @@ const char index_html[] PROGMEM = R"rawliteral( + @@ -362,6 +363,21 @@ function WifiConfig() { } } +function serialCmd() { + let cmd = prompt("Enter a serial command", ""); + if (cmd == null || cmd == "" || cmd == null) { + window.alert("empty command, nothing sent"); + } else { + const ajax5 = new XMLHttpRequest(); + const formdata5 = new FormData(); + formdata5.append("cmnd", cmd); + ajax5.open("POST", "/cm", false); + ajax5.send(formdata5); + //document.getElementById("status").innerHTML = ajax5.responseText; + window.alert(ajax5.responseText); + } +} + function logoutButton() { var xhr = new XMLHttpRequest(); xhr.open("GET", "/logout", true);