Web itf show GpioObserved status
This commit is contained in:
parent
3957d9645f
commit
0396ccfb45
@ -3,7 +3,22 @@
|
|||||||
String gpioControlHTML = "";
|
String gpioControlHTML = "";
|
||||||
String pwmControlHTML = "";
|
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() {
|
void WebHandleRoot() {
|
||||||
|
String gpioObserved = "";
|
||||||
|
|
||||||
|
WebBuildGpioObserved(gpioObserved);
|
||||||
|
|
||||||
server.send(200, "text/html",
|
server.send(200, "text/html",
|
||||||
"<head><meta http-equiv=\"refresh\" content=\"" + String(CONFIG_SAMPLING_PERIODE_MS / 1000) + "\" ></head>"
|
"<head><meta http-equiv=\"refresh\" content=\"" + String(CONFIG_SAMPLING_PERIODE_MS / 1000) + "\" ></head>"
|
||||||
@ -21,7 +36,7 @@ void WebHandleRoot() {
|
|||||||
#ifdef CONFIG_ENABLE_DRY_SENSOR
|
#ifdef CONFIG_ENABLE_DRY_SENSOR
|
||||||
"Dryness " + String((dryness*100)/1024) + "%<br/>"
|
"Dryness " + String((dryness*100)/1024) + "%<br/>"
|
||||||
#endif
|
#endif
|
||||||
"</fieldset>" + gpioControlHTML + pwmControlHTML + "<fieldset>"
|
"</fieldset>" + gpioControlHTML + gpioObserved + pwmControlHTML + "<fieldset>"
|
||||||
"<legend>Settings</legend>"
|
"<legend>Settings</legend>"
|
||||||
"<a href=\"/setup\">Enter Setup</a><br/>"
|
"<a href=\"/setup\">Enter Setup</a><br/>"
|
||||||
"<a href=\"/otamode\">Put device in OTA mode</a><br/>"
|
"<a href=\"/otamode\">Put device in OTA mode</a><br/>"
|
||||||
|
Loading…
Reference in New Issue
Block a user