Web itf show GpioObserved status

This commit is contained in:
Mathieu Maret 2016-12-14 22:19:17 +01:00
parent 3957d9645f
commit 0396ccfb45
1 changed files with 16 additions and 1 deletions

View File

@ -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/>"