Просмотр исходного кода

Skip validation of disabled GPIO settings

SybexXx 3 дней назад
Родитель
Сommit
0a2aa91c01
1 измененных файлов с 8 добавлено и 3 удалено
  1. 8 3
      sd-card/html/edit_config_template.html

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

@@ -2152,9 +2152,14 @@ function ReadParameterAll() {
     ReadParameter(param, "Webhook", "ApiKey", true);
     ReadParameter(param, "Webhook", "UploadImg", false);
 
-    (window.GPIO_AVAILABLE_PINS || []).forEach(function (gpio) {
-        ReadParameter(param, "GPIO", "IO" + gpio, true);
-    });
+    // GPIO fields are irrelevant while the complete GPIO category is disabled.
+    // In particular, stale values from older firmware must not block saving
+    // unrelated configuration changes.
+    if (category["GPIO"]["enabled"]) {
+        (window.GPIO_AVAILABLE_PINS || []).forEach(function (gpio) {
+            ReadParameter(param, "GPIO", "IO" + gpio, true);
+        });
+    }
     ReadParameter(param, "GPIO", "LEDType", false);
     ReadParameter(param, "GPIO", "LEDNumbers", false);
     ReadParameter(param, "GPIO", "LEDColor", false);