From 0396ccfb45a47ed3b85c384be2d6ef9f0c574365 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Wed, 14 Dec 2016 22:19:17 +0100 Subject: [PATCH] Web itf show GpioObserved status --- WifiControlSensor/WebServer.ino | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/WifiControlSensor/WebServer.ino b/WifiControlSensor/WebServer.ino index baa023c..4130b19 100644 --- a/WifiControlSensor/WebServer.ino +++ b/WifiControlSensor/WebServer.ino @@ -3,7 +3,22 @@ String gpioControlHTML = ""; String pwmControlHTML = ""; + +void WebBuildGpioObserved(String &html){ + if (NB_ELEMENTS(gpioObserved) > 0){ + html += "
" + "Detector"; + for (uint i = 0 ; i < NB_ELEMENTS(gpioObserved) ; i++) { + html += "Sensor " + String(gpioObserved[i]) + ": " + digitalRead(gpioObserved[i]) + "
"; + } + html += "
"; + } + +} void WebHandleRoot() { + String gpioObserved = ""; + + WebBuildGpioObserved(gpioObserved); server.send(200, "text/html", "" @@ -21,7 +36,7 @@ void WebHandleRoot() { #ifdef CONFIG_ENABLE_DRY_SENSOR "Dryness " + String((dryness*100)/1024) + "%
" #endif - "" + gpioControlHTML + pwmControlHTML + "
" + "
" + gpioControlHTML + gpioObserved + pwmControlHTML + "
" "Settings" "Enter Setup
" "Put device in OTA mode
"