34 lines
953 B
C++
34 lines
953 B
C++
|
|
#include <ESP8266WiFi.h>
|
|
|
|
#include "ProjGlobals.h"
|
|
#include "Web_RootPage.h"
|
|
#include "GrowController.h"
|
|
#include "Web_Resources.h"
|
|
|
|
void HandleRootPage() {
|
|
if (server.hasArg("SW")) {
|
|
String newState = server.arg("SW");
|
|
if (newState == "1") {
|
|
SetCircuit(CMD_On);
|
|
Serial.printf("SW 1\n");
|
|
} else if (newState == "0") {
|
|
SetCircuit(CMD_Off);
|
|
Serial.printf("SW 0\n");
|
|
} else if (newState == "2") {
|
|
SetCircuit(CMD_Toggle);
|
|
Serial.printf("SW 2\n");
|
|
} else {
|
|
Serial.printf("SW %s ???\n", newState.c_str());
|
|
; // no action
|
|
}
|
|
}
|
|
String modeText = (isStationMode) ? "Station mode<br/>" : "Access Point mode<br/>";
|
|
String status = GetCircuitStatus() ? "On<br/>" : "Off<br/>";
|
|
String myIP = String(WiFi.localIP()[0]);
|
|
myIP += "." + String(WiFi.localIP()[1]);
|
|
myIP += "." + String(WiFi.localIP()[2]);
|
|
myIP += "." + String(WiFi.localIP()[3]);
|
|
server.send_P(200, "text/html", index_htm);
|
|
}
|