improve output/sensor table

This commit is contained in:
Marcus 2024-11-17 07:16:01 +01:00
parent df6435f6e1
commit 16f4871306
2 changed files with 39 additions and 16 deletions

View file

@ -122,6 +122,31 @@ bool Check_GPIOindex_Used(byte gpio) {
}
}
}
if(used == false) {
for(byte i=0; i < Max_Sensors; i++) {
#ifndef DEBUG
//Serial.printf("DB [Core:Check_GPIOindex_Used] OutputId: %d , type: %d\n", i, config.system.output.type[i]);
#endif
// check if sensor type is gpio
if(config.system.sensor.gpio[i] > 0) {
#ifndef DEBUG
Serial.printf("DB [Core:Check_GPIOindex_Used] SensorId: %d is GPIO (type %d)\n", i, config.system.sensor.gpio[i]);
#endif
// check if gpio id is already in use
if(config.system.sensor.gpio[i] == gpio) {
#ifndef DEBUG
Serial.printf("DB [Core:Check_GPIOindex_Used] sensor.gpio[%d](%d) == GPIO %d\n", i, config.system.sensor.gpio[i], gpio);
#endif
used = true;
break;
} else {
used = false;
}
}
}
}
#ifndef DEBUG
Serial.printf("DB [Core:Check_GPIOindex_Used] GPIO: %d, used: %d\n", gpio, used);
#endif

View file

@ -340,9 +340,8 @@ String Proc_WebPage_system_output(const String& var) {
output_tr_td += "</td><td>";
output_tr_td += Output_Type_descr[config.system.output.type[i]];
if((config.system.output.type[i] == OUTPUT_TYPE_GPIO) || (config.system.output.type[i] == OUTPUT_TYPE_I2C)) {
if((config.system.output.type[i] == OUTPUT_TYPE_GPIO) || ( (config.system.output.type[i] == OUTPUT_TYPE_I2C) && (strlen(config.system.output.i2c[i]) > 0) )) {
output_tr_td += " (";
}
switch(config.system.output.type[i]) {
case OUTPUT_TYPE_GPIO:
@ -357,7 +356,6 @@ String Proc_WebPage_system_output(const String& var) {
break;
}
if((config.system.output.type[i] == OUTPUT_TYPE_GPIO) || (config.system.output.type[i] == OUTPUT_TYPE_I2C)) {
output_tr_td += ")";
}
@ -828,7 +826,7 @@ String Proc_WebPage_system_sensor(const String& var) {
output_tr_td += "</td><td>";
output_tr_td += SensorIndex[config.system.sensor.type[i]].name;
if((config.system.sensor.i2c_address[i] != "") || (config.system.sensor.gpio[i] > 0)) {
if((strlen(config.system.sensor.i2c_address[i]) > 0) || (config.system.sensor.gpio[i] > 0)) {
output_tr_td += " (";
if(config.system.sensor.gpio[i] > 0) {
output_tr_td += GPIOindex[config.system.sensor.gpio[i]].gpio;