Browse Source

Web itf show GpioObserved status

sonoff
Mathieu Maret 5 years ago
parent
commit
0396ccfb45
  1. 17
      WifiControlSensor/WebServer.ino

17
WifiControlSensor/WebServer.ino

@ -3,7 +3,22 @@
String gpioControlHTML = "";
String pwmControlHTML = "";
void WebBuildGpioObserved(String &html){
if (NB_ELEMENTS(gpioObserved) > 0){
html += "<fieldset>"
"<legend>Detector</legend>";
for (uint i = 0 ; i < NB_ELEMENTS(gpioObserved) ; i++) {
html += "Sensor " + String(gpioObserved[i]) + ": " + digitalRead(gpioObserved[i]) + "<br/>";
}
html += "</fieldset>";
}
}
void WebHandleRoot() {
String gpioObserved = "";
WebBuildGpioObserved(gpioObserved);
server.send(200, "text/html",
"<head><meta http-equiv=\"refresh\" content=\"" + String(CONFIG_SAMPLING_PERIODE_MS / 1000) + "\" ></head>"
@ -21,7 +36,7 @@ void WebHandleRoot() {
#ifdef CONFIG_ENABLE_DRY_SENSOR
"Dryness " + String((dryness*100)/1024) + "%<br/>"
#endif
"</fieldset>" + gpioControlHTML + pwmControlHTML + "<fieldset>"
"</fieldset>" + gpioControlHTML + gpioObserved + pwmControlHTML + "<fieldset>"
"<legend>Settings</legend>"
"<a href=\"/setup\">Enter Setup</a><br/>"
"<a href=\"/otamode\">Put device in OTA mode</a><br/>"

Loading…
Cancel
Save