|
|
@@ -3086,8 +3086,23 @@ window.GPIO_AVAILABLE_PINS = [];
|
|
|
addOption(mode, "input-pullup", "Input pull-up", !!((caps & CAP_INPUT) && (caps & CAP_PULL_UP)));
|
|
|
addOption(mode, "input-pulldown", "Input pull-down", !!((caps & CAP_INPUT) && (caps & CAP_PULL_DOWN)));
|
|
|
addOption(mode, "output", "Output", !!(caps & CAP_OUTPUT));
|
|
|
- addOption(mode, "output-pwm", "PWM output", !!((caps & CAP_OUTPUT) && (caps & CAP_PWM)));
|
|
|
modeCell.appendChild(mode);
|
|
|
+
|
|
|
+ var resolution = document.createElement("input");
|
|
|
+ resolution.type = "hidden";
|
|
|
+ resolution.id = prefix + "_value3";
|
|
|
+ resolution.value = "10";
|
|
|
+ modeCell.appendChild(resolution);
|
|
|
+
|
|
|
+ var supportedModes = Array.from(mode.options).filter(function (option) { return !option.disabled; });
|
|
|
+ if (!supportedModes.length) {
|
|
|
+ throw new Error("GPIO" + pin + " has no supported input/output mode");
|
|
|
+ }
|
|
|
+ mode.value = supportedModes[0].value;
|
|
|
+ if (!param.GPIO["IO" + pin].found && typeof param.GPIO["IO" + pin].value1 === "undefined") {
|
|
|
+ param.GPIO["IO" + pin].value1 = mode.value;
|
|
|
+ }
|
|
|
+
|
|
|
first.appendChild(labelCell);
|
|
|
first.appendChild(modeCell);
|
|
|
first.appendChild(document.createElement("td"));
|
|
|
@@ -3099,15 +3114,6 @@ window.GPIO_AVAILABLE_PINS = [];
|
|
|
.forEach(function (v) { addOption(interrupt, v, v, v === "disabled" || !!(caps & CAP_INTERRUPT)); });
|
|
|
addRow(pin, "", "Interrupt", interrupt);
|
|
|
|
|
|
- var resolution = document.createElement("input");
|
|
|
- resolution.type = "number";
|
|
|
- resolution.min = "1";
|
|
|
- resolution.max = "20";
|
|
|
- resolution.step = "1";
|
|
|
- resolution.id = prefix + "_value3";
|
|
|
- resolution.value = "10";
|
|
|
- addRow(pin, "", "PWM duty resolution (bits)", resolution);
|
|
|
-
|
|
|
var mqtt = document.createElement("input");
|
|
|
mqtt.type = "checkbox";
|
|
|
mqtt.id = prefix + "_value4";
|
|
|
@@ -3165,6 +3171,11 @@ window.GPIO_AVAILABLE_PINS = [];
|
|
|
|
|
|
window.GPIO_MAX_CHANNELS = profile.maxChannels;
|
|
|
window.GPIO_AVAILABLE_PINS = pins.map(function (pin) { return pin.gpio; });
|
|
|
+ for (var gpio = 0; gpio <= 48; ++gpio) {
|
|
|
+ if (window.GPIO_AVAILABLE_PINS.indexOf(gpio) === -1) {
|
|
|
+ param.GPIO["IO" + gpio].enabled = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
pins.forEach(function (pin) { makeChannel(pin.gpio, pin.capabilities); });
|
|
|
|
|
|
if (notice) notice.style.display = pins.length ? "none" : "";
|