diff --git a/Arduino/CanGrow/include/CanGrow.h b/Arduino/CanGrow/include/CanGrow.h index b7384a3..8dacb05 100644 --- a/Arduino/CanGrow/include/CanGrow.h +++ b/Arduino/CanGrow/include/CanGrow.h @@ -179,7 +179,7 @@ struct Config_System_Output { /* * Config System Output * - * - output_type: output type like GPIO, I2C, URL + * - type: output type like GPIO, I2C, URL * 1 - GPIO * 2 - I2C * 3 - Web @@ -215,6 +215,36 @@ struct Config_System_Output { char webcall_path_off[Max_Outputs][32]; }; +struct Config_System_Sensor { + /* + * Config System Sensor + * + * - Sensor Name + * - Sensors can offer following types + * - temperature + * - humidity + * - moisture + * - raw + * + * + * - type: sensor type like I2C, OneWire, ... + * 1 - builtin ADC + * 2 - I2C + * 3 - Webcall + * + * What are sensors? + * - Analog builtin + * - I2C ADC + * - I2C Soil Moisture + * - I2C often multisensor offering mutliple values for temp, humidity, light , whatever + * - + */ + + byte type[Max_Outputs]; + byte device[Max_Outputs]; + char name[Max_Outputs][32]; +}; + /* main System struct */ struct Config_System { byte ntpOffset; @@ -225,6 +255,7 @@ struct Config_System { bool httpLogSerial; unsigned short schedulerInterval = 1000; Config_System_Output output; + Config_System_Sensor sensor; }; diff --git a/Arduino/CanGrow/include/CanGrow_Webserver.h b/Arduino/CanGrow/include/CanGrow_Webserver.h index 41d8af4..329299e 100644 --- a/Arduino/CanGrow/include/CanGrow_Webserver.h +++ b/Arduino/CanGrow/include/CanGrow_Webserver.h @@ -110,9 +110,17 @@ void Webserver_Init() { webserver.on("/system/output/add", HTTP_GET, WebPage_system_output_add); webserver.on("/system/output/add", HTTP_POST, WebPage_system_output_add); - requestLogger.setOutput(Serial); + webserver.on("/system/sensor/", HTTP_GET, WebPage_system_sensor); + webserver.on("/system/sensor/", HTTP_POST, WebPage_system_sensor); + + webserver.on("/system/sensor/add", HTTP_GET, WebPage_system_sensor_add); + webserver.on("/system/sensor/add", HTTP_POST, WebPage_system_sensor_add); + + + // this activates the middleware if(config.system.httpLogSerial == true) { + requestLogger.setOutput(Serial); Serial.println(":: [Webserver] serial logging: enabled"); webserver.addMiddleware(&requestLogger); } else { diff --git a/Arduino/CanGrow/include/Webserver/Footer.h b/Arduino/CanGrow/include/Webserver/Footer.h index d304dd2..2899bf9 100644 --- a/Arduino/CanGrow/include/Webserver/Footer.h +++ b/Arduino/CanGrow/include/Webserver/Footer.h @@ -27,5 +27,4 @@ * */ -const char* Footer_HTML PROGMEM = R"(
-