Save some bytes

This commit is contained in:
Theo Arends 2023-10-21 17:37:31 +02:00
parent 57860b692d
commit 0ae793a8d4
1 changed files with 3 additions and 8 deletions

View File

@ -1775,14 +1775,9 @@ void CmndGpioRead(void) {
bool jsflg = false;
Response_P(PSTR("{\"" D_CMND_GPIOREAD "\":{"));
for (uint32_t i = 0; i < nitems(Settings->my_gp.io); i++) {
bool sensor_active = false;
uint32_t sensor_type = template_gp.io[i]; // Template GPIO
if ((sensor_type != GPIO_NONE) && (AGPIO(GPIO_USER) != sensor_type)) {
sensor_active = true;
} else if (Settings->my_gp.io[i] != GPIO_NONE) { // Module GPIO
sensor_active = true;
}
if (sensor_active) {
uint32_t sensor_type = template_gp.io[i]; // Template GPIO
if (((sensor_type != GPIO_NONE) && (AGPIO(GPIO_USER) != sensor_type)) ||
(Settings->my_gp.io[i] != GPIO_NONE)) { // Module GPIO
if (jsflg) {
ResponseAppend_P(PSTR(","));
}