wip dashboard stuff
This commit is contained in:
parent
f238e32594
commit
e897fe60a6
3 changed files with 32 additions and 11 deletions
include
|
@ -55,6 +55,7 @@ const byte Max_Sensors_GPIO = 2;
|
|||
/* Max Limits for Dashboard elements*/
|
||||
const byte Max_Dashboard_Gauge = 6;
|
||||
const byte Max_Dashboard_Chart = 6;
|
||||
const byte Max_Dashboard_Data = 6;
|
||||
|
||||
/* actual structure initialization for GPIO_Index is done within the header files
|
||||
* for ESP32 and ESP8266
|
||||
|
@ -340,9 +341,9 @@ struct Config_Grow_Dashboard {
|
|||
byte chartSensor[Max_Dashboard_Chart];
|
||||
byte chartRead[Max_Dashboard_Chart];
|
||||
char chartColor[Max_Dashboard_Chart][8];
|
||||
bool dataConfigured[Max_Sensors];
|
||||
byte dataSensor[Max_Sensors];
|
||||
byte dataRead[Max_Sensors];
|
||||
bool dataConfigured[Max_Dashboard_Data];
|
||||
byte dataSensor[Max_Dashboard_Data];
|
||||
byte dataRead[Max_Dashboard_Data];
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -963,7 +963,27 @@ String Proc_WebPage_grow_dashboard(const String& var) {
|
|||
return AddHeaderFooter(var, 1);
|
||||
} else if(Test_WebPage_grow_SUBNAV(var)) {
|
||||
return Proc_WebPage_grow_SUBNAV(var, WEB_GROW_SUBNAV_DASHBOARD);
|
||||
} else if(var == "TR_TD_GAUGE") {
|
||||
} else if(var == "ADD_DISABLED_GAUGE") {
|
||||
if(Give_Free_Dashboard_GaugeId() > Max_Dashboard_Gauge ) {
|
||||
return F("disabled force_hide");
|
||||
} else {
|
||||
return String();
|
||||
}
|
||||
} else if(var == "ADD_DISABLED_CHART") {
|
||||
if(Give_Free_Dashboard_ChartId() > Max_Dashboard_Chart ) {
|
||||
return F("disabled force_hide");
|
||||
} else {
|
||||
return String();
|
||||
}
|
||||
}
|
||||
//else if(var == "ADD_DISABLED_DATA") {
|
||||
//if(Give_Free_Dashboard_DataId() > Max_Sensors ) {
|
||||
//return F("disabled force_hide");
|
||||
//} else {
|
||||
//return String();
|
||||
//}
|
||||
//}
|
||||
else if(var == "TR_TD_GAUGE") {
|
||||
String html;
|
||||
for(byte i = 0; i < Max_Dashboard_Gauge; i++) {
|
||||
if(config.grow.dashboard.gaugeConfigured[i] == true) {
|
||||
|
@ -1084,7 +1104,7 @@ String Proc_WebPage_grow_dashboard(const String& var) {
|
|||
return html;
|
||||
} else if(var == "TR_TD_DATA") {
|
||||
String html;
|
||||
for(byte i = 0; i < Max_Sensors; i++) {
|
||||
for(byte i = 0; i < Max_Dashboard_Data; i++) {
|
||||
if(config.grow.dashboard.dataConfigured[i] == true) {
|
||||
html += F("<tr><td>");
|
||||
html += i;
|
||||
|
@ -1355,7 +1375,7 @@ void WebPage_grow_dashboard_gaugeAdd(AsyncWebServerRequest *request) {
|
|||
tmpParam_editGaugeId = param->value().toInt();
|
||||
request->send_P(200, TEXT_HTML, Page_grow_dashboard_gaugeAdd_HTML, Proc_WebPage_grow_dashboard_gaugeAddEdit);
|
||||
/* if we want to add new sensor, check if a sensor id is available. if not send error */
|
||||
} else if(Give_Free_SensorId() > Max_Sensors) {
|
||||
} else if(Give_Free_Dashboard_GaugeId() > Max_Dashboard_Gauge) {
|
||||
request->send_P(200, TEXT_HTML, Page_grow_dashboard_gaugeAdd_HTML_NO_ID_AVAILABLE, Proc_WebPage_grow_dashboard_gaugeAdd);
|
||||
/* Otherwise let the user create new sensor */
|
||||
} else {
|
||||
|
@ -1481,7 +1501,7 @@ void WebPage_grow_dashboard_chartAdd(AsyncWebServerRequest *request) {
|
|||
tmpParam_editChartId = param->value().toInt();
|
||||
request->send_P(200, TEXT_HTML, Page_grow_dashboard_chartAdd_HTML, Proc_WebPage_grow_dashboard_chartAddEdit);
|
||||
/* if we want to add new sensor, check if a sensor id is available. if not send error */
|
||||
} else if(Give_Free_SensorId() > Max_Sensors) {
|
||||
} else if(Give_Free_Dashboard_ChartId() > Max_Dashboard_Chart) {
|
||||
request->send_P(200, TEXT_HTML, Page_grow_dashboard_chartAdd_HTML_NO_ID_AVAILABLE, Proc_WebPage_grow_dashboard_chartAdd);
|
||||
/* Otherwise let the user create new sensor */
|
||||
} else {
|
||||
|
@ -1604,7 +1624,7 @@ void WebPage_grow_dashboard_dataAdd(AsyncWebServerRequest *request) {
|
|||
tmpParam_editDataId = param->value().toInt();
|
||||
request->send_P(200, TEXT_HTML, Page_grow_dashboard_dataAdd_HTML, Proc_WebPage_grow_dashboard_dataAddEdit);
|
||||
/* if we want to add new sensor, check if a sensor id is available. if not send error */
|
||||
} else if(Give_Free_SensorId() > Max_Sensors) {
|
||||
} else if(Give_Free_Dashboard_DataId() > Max_Dashboard_Data) {
|
||||
request->send_P(200, TEXT_HTML, Page_grow_dashboard_dataAdd_HTML_NO_ID_AVAILABLE, Proc_WebPage_grow_dashboard_dataAdd);
|
||||
/* Otherwise let the user create new sensor */
|
||||
} else {
|
||||
|
|
|
@ -92,7 +92,7 @@ const char Page_grow_dashboard_HTML[] PROGMEM = R"(%HEADER%
|
|||
<p>here you can set dashboard stuff<br></p>
|
||||
|
||||
<h3>Gauge</h3>
|
||||
<a class='button %ADD_DISABLED%' href='/grow/dashboard/gaugeAdd'>➕ Add gauge</a>
|
||||
<a class='button %ADD_DISABLED_GAUGE%' href='/grow/dashboard/gaugeAdd'>➕ Add gauge</a>
|
||||
<table class='centered'>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
|
@ -106,7 +106,7 @@ const char Page_grow_dashboard_HTML[] PROGMEM = R"(%HEADER%
|
|||
<hr>
|
||||
|
||||
<h3>Chart</h3>
|
||||
<a class='button %ADD_DISABLED%' href='/grow/dashboard/chartAdd''>➕ Add chart</a>
|
||||
<a class='button %ADD_DISABLED_CHART%' href='/grow/dashboard/chartAdd'>➕ Add chart</a>
|
||||
<table class='centered'>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
|
@ -120,7 +120,7 @@ const char Page_grow_dashboard_HTML[] PROGMEM = R"(%HEADER%
|
|||
<hr>
|
||||
|
||||
<h3>Data</h3>
|
||||
<a class='button %ADD_DISABLED%' href='/grow/dashboard/dataAdd'>➕ Add data</a>
|
||||
<a class='button %ADD_DISABLED_DATA%' href='/grow/dashboard/dataAdd'>➕ Add data</a>
|
||||
<table class='centered'>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue