From 8799b1e85bc219f8fa0ff2e9a50f11743c3e5735 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sun, 14 May 2017 23:05:52 +0100 Subject: [PATCH] Try better pin picker for pigpiod --- hardware/pigpiod/package.json | 2 +- hardware/pigpiod/pi-gpiod.html | 371 ++++++++++++++++++++++++++------- 2 files changed, 302 insertions(+), 71 deletions(-) diff --git a/hardware/pigpiod/package.json b/hardware/pigpiod/package.json index e5880b5b..2b886b8f 100644 --- a/hardware/pigpiod/package.json +++ b/hardware/pigpiod/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-pi-gpiod", - "version": "0.0.5", + "version": "0.0.6", "description": "A node-red node for PiGPIOd", "dependencies" : { "js-pigpio": "*" diff --git a/hardware/pigpiod/pi-gpiod.html b/hardware/pigpiod/pi-gpiod.html index dbee7a1f..71d0515d 100644 --- a/hardware/pigpiod/pi-gpiod.html +++ b/hardware/pigpiod/pi-gpiod.html @@ -1,37 +1,143 @@ @@ -103,53 +208,169 @@ var suf = ""; if (this.intype === "PUD_UP") { suf = "↑ "} if (this.intype === "PUD_DOWN") { suf = "↓ "} - return this.name || "GPIO: "+suf+bcm2pin[this.pin] ; + return this.name || "PIN: "+suf+bcm2pin[this.pin] ; }, labelStyle: function() { return this.name?"node_label_italic":""; }, + outputLabels: function() { return "GPIO"+this.pin; }, palettelabel: "pi gpiod", oneditprepare: function() { var pinnow = this.pin; var pintip = this._("pi-gpiod.tip.pin"); var pinname = this._("pi-gpiod.pinname"); + $('#pinform input').on('change', function() { + this.pin = $("#pinform input[type='radio']:checked").val(); + $("#node-input-pin").val(this.pin); + }); + $("#node-input-pin").change(function () { + if ($("#node-input-pin").val()) { + $("#pinform input[value="+$("#node-input-pin").val()+"]").prop('checked', true); + } + }); } });