call Check_GPIOindex_Used only once

This commit is contained in:
Marcus 2024-10-26 18:14:44 +02:00
parent a983129085
commit 54b6d48e1e

View file

@ -371,11 +371,13 @@ String Proc_WebPage_system_output_add(const String& var) {
String gpioIndex_html; String gpioIndex_html;
// iterate through through all available GPIOs in index // iterate through through all available GPIOs in index
for(byte i = 0; i < GPIOindex_length; i++) { for(byte i = 0; i < GPIOindex_length; i++) {
bool gpioUsed = Check_GPIOindex_Used(i);
gpioIndex_html += "<option value='"; gpioIndex_html += "<option value='";
gpioIndex_html += i; gpioIndex_html += i;
gpioIndex_html += "'"; gpioIndex_html += "'";
// set disabled option for gpio which are already in use or incompatible // set disabled option for gpio which are already in use or incompatible
if((Check_GPIOindex_Used(i) == true) || (GPIOindex[i].note == INPUT_ONLY)) { if((gpioUsed == true) || (GPIOindex[i].note == INPUT_ONLY)) {
gpioIndex_html += " disabled"; gpioIndex_html += " disabled";
} }
gpioIndex_html += ">GPIO "; gpioIndex_html += ">GPIO ";
@ -389,7 +391,7 @@ String Proc_WebPage_system_output_add(const String& var) {
if(GPIOindex[i].note == INPUT_ONLY) { if(GPIOindex[i].note == INPUT_ONLY) {
gpioIndex_html += " (N/A)"; gpioIndex_html += " (N/A)";
// add USED if gpio is already in use // add USED if gpio is already in use
} else if(Check_GPIOindex_Used(i) == true) { } else if(gpioUsed == true) {
gpioIndex_html += " (used)"; gpioIndex_html += " (used)";
} }
gpioIndex_html += "</option>"; gpioIndex_html += "</option>";