Przeglądaj źródła

Preserve GPIO settings while board capabilities load

SybexXx 3 dni temu
rodzic
commit
bd7d97b3a2
1 zmienionych plików z 4 dodań i 3 usunięć
  1. 4 3
      sd-card/html/edit_config_template.html

+ 4 - 3
sd-card/html/edit_config_template.html

@@ -3025,10 +3025,10 @@ window.GPIO_AVAILABLE_PINS = [];
             notice.cells[0].appendChild(document.createTextNode(message));
         }
         if (categoryCheckbox) {
-            categoryCheckbox.checked = false;
+            // Preserve the saved category state while loading or when no
+            // profile is available. The firmware remains fail-closed.
             categoryCheckbox.disabled = true;
         }
-        if (category && category.GPIO) category.GPIO.enabled = false;
     }
 
     function addOption(select, value, label, enabled) {
@@ -3110,8 +3110,9 @@ window.GPIO_AVAILABLE_PINS = [];
 
         var interrupt = document.createElement("select");
         interrupt.id = prefix + "_value2";
+        var interruptSupported = !!(caps & CAP_INTERRUPT) && !!(caps & CAP_INPUT);
         ["disabled", "rising-edge", "falling-edge", "rising-and-falling", "low-level-trigger", "high-level-trigger"]
-            .forEach(function (v) { addOption(interrupt, v, v, v === "disabled" || !!(caps & CAP_INTERRUPT)); });
+            .forEach(function (v) { addOption(interrupt, v, v, v === "disabled" || interruptSupported); });
         addRow(pin, "", "Interrupt", interrupt);
 
         var mqtt = document.createElement("input");