From 0984f91f8b0af8ed12fc760507582703470c9510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4fele?= Date: Fri, 30 Mar 2018 11:43:59 +0200 Subject: [PATCH 1/8] Add option to set frequency --- hardware/pigpiod/locales/en-US/pi-gpiod.json | 2 ++ hardware/pigpiod/pi-gpiod.html | 32 ++++++++++++++++++-- hardware/pigpiod/pi-gpiod.js | 12 +++++--- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/hardware/pigpiod/locales/en-US/pi-gpiod.json b/hardware/pigpiod/locales/en-US/pi-gpiod.json index 5eaa33e6c..8e6bd7b97 100644 --- a/hardware/pigpiod/locales/en-US/pi-gpiod.json +++ b/hardware/pigpiod/locales/en-US/pi-gpiod.json @@ -7,6 +7,8 @@ "resistor": "Resistor?", "readinitial": "Read initial state of pin on deploy/restart?", "type": "Type", + "setfreq": "Set frequency?", + "freq": "Frequency", "initpin": "Initialise pin state?", "debounce": "Debounce", "limits": "Limits", diff --git a/hardware/pigpiod/pi-gpiod.html b/hardware/pigpiod/pi-gpiod.html index d83641b26..057469f62 100644 --- a/hardware/pigpiod/pi-gpiod.html +++ b/hardware/pigpiod/pi-gpiod.html @@ -381,6 +381,15 @@ +
+ + + +
+
+ + Hz +
uS @@ -448,6 +457,8 @@ set: { value:"" }, level: { value:"0" }, out: { value:"out" }, + setfreq: { value:""}, + freq: { value:"800" }, sermin: { value:"1000" }, sermax: { value:"2000" } }, @@ -479,8 +490,9 @@ if ($("#node-input-out").val() === "pwm") { $('#node-set-tick').hide(); $('#node-set-state').hide(); - $('#node-set-minimax').hide(); $('#node-input-set').prop('checked', false); + $('#node-set-freq-tick').show(); + $('#node-set-minimax').hide(); $("#dig-tip").hide(); $("#pwm-tip").show(); $("#ser-tip").hide(); @@ -488,14 +500,20 @@ else if ($("#node-input-out").val() === "ser") { $('#node-set-tick').hide(); $('#node-set-state').hide(); - $('#node-set-minimax').show(); $('#node-input-set').prop('checked', false); + $('#node-set-freq-tick').hide(); + $("#node-set-frequency").hide(); + $('#node-input-setfreq').prop('checked', false); + $('#node-set-minimax').show(); $("#dig-tip").hide(); $("#pwm-tip").hide(); $("#ser-tip").show(); } else { $('#node-set-tick').show(); + $('#node-set-freq-tick').hide(); + $("#node-set-frequency").hide(); + $('#node-input-setfreq').prop('checked', false); $('#node-set-minimax').hide(); $("#dig-tip").show(); $("#pwm-tip").hide(); @@ -515,6 +533,16 @@ $("#node-input-set").change(function () { setstate(); }); setstate(); + var setfreqstate = function () { + if ($('#node-input-setfreq').is(":checked")) { + $("#node-set-frequency").show(); + } else { + $("#node-set-frequency").hide(); + } + }; + $("#node-input-setfreq").change(function () { setfreqstate(); }); + setfreqstate(); + $('#pinform input').on('change', function() { this.pin = $("#pinform input[type='radio']:checked").val(); $("#node-input-pin").val(this.pin); diff --git a/hardware/pigpiod/pi-gpiod.js b/hardware/pigpiod/pi-gpiod.js index ca16dd1fe..084bab781 100644 --- a/hardware/pigpiod/pi-gpiod.js +++ b/hardware/pigpiod/pi-gpiod.js @@ -86,6 +86,10 @@ module.exports = function(RED) { this.set = n.set || false; this.level = parseInt(n.level || 0); this.out = n.out || "out"; + this.setfreq = n.setfreq || false; + this.freq = Number(n.freq || 800); + if (this.freq < 5) { this.freq = 5; } + if (this.freq > 40000) { this.freq = 40000; } this.sermin = Number(n.sermin)/100; this.sermax = Number(n.sermax)/100; if (this.sermin > this.sermax) { @@ -142,10 +146,10 @@ module.exports = function(RED) { } else { node.status({fill:"green",shape:"dot",text:"node-red:common.status.ok"}); } - // if (node.out === "pwm") { - // PiGPIO.set_PWM_frequency(1000); - // PiGPIO.set_PWM_range(1000); - // } + if (node.setfreq) { + PiGPIO.set_PWM_frequency(node.pin,node.freq); + } + //PiGPIO.set_PWM_range(node.pin,1000); } }); } From 26b9588ba6190985bebccff4673d005674173538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4fele?= Date: Fri, 30 Mar 2018 12:09:40 +0200 Subject: [PATCH 2/8] Add tip for frequency setting --- hardware/pigpiod/locales/en-US/pi-gpiod.json | 1 + hardware/pigpiod/pi-gpiod.html | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/hardware/pigpiod/locales/en-US/pi-gpiod.json b/hardware/pigpiod/locales/en-US/pi-gpiod.json index 8e6bd7b97..865a7a399 100644 --- a/hardware/pigpiod/locales/en-US/pi-gpiod.json +++ b/hardware/pigpiod/locales/en-US/pi-gpiod.json @@ -35,6 +35,7 @@ "in": "Only Digital Input is supported - input must be 0 or 1.", "dig": "Digital output - input must be 0 or 1.", "pwm": "PWM output - input must be between 0 to 100.", + "freq": "Frequency must be in between 5 and 40000 Hz", "ser": "Servo output - input must be between 0 to 100. 50 is centre.
Min must be 500uS or more, Max must be 2500uS or less." }, "types": { diff --git a/hardware/pigpiod/pi-gpiod.html b/hardware/pigpiod/pi-gpiod.html index 057469f62..bc4b4214d 100644 --- a/hardware/pigpiod/pi-gpiod.html +++ b/hardware/pigpiod/pi-gpiod.html @@ -419,6 +419,7 @@
+
Pins marked in blue are dual use. Make sure they are not enabled for their other use before using as GPIO.
@@ -507,6 +508,7 @@ $('#node-set-minimax').show(); $("#dig-tip").hide(); $("#pwm-tip").hide(); + $("#freq-tip").hide(); $("#ser-tip").show(); } else { @@ -517,6 +519,7 @@ $('#node-set-minimax').hide(); $("#dig-tip").show(); $("#pwm-tip").hide(); + $("#freq-tip").hide(); $("#ser-tip").hide(); } }; @@ -536,8 +539,10 @@ var setfreqstate = function () { if ($('#node-input-setfreq').is(":checked")) { $("#node-set-frequency").show(); + $("#freq-tip").show(); } else { $("#node-set-frequency").hide(); + $("#freq-tip").hide(); } }; $("#node-input-setfreq").change(function () { setfreqstate(); }); From e8bcb4b6b5ddc6806bf74fe6744d7b71b6b66cb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4fele?= Date: Fri, 30 Mar 2018 18:14:49 +0200 Subject: [PATCH 3/8] Remove checkbox for setting pwm frequency --- hardware/pigpiod/locales/en-US/pi-gpiod.json | 4 +-- hardware/pigpiod/pi-gpiod.html | 26 +------------------- hardware/pigpiod/pi-gpiod.js | 2 +- 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/hardware/pigpiod/locales/en-US/pi-gpiod.json b/hardware/pigpiod/locales/en-US/pi-gpiod.json index 865a7a399..dcd605ce2 100644 --- a/hardware/pigpiod/locales/en-US/pi-gpiod.json +++ b/hardware/pigpiod/locales/en-US/pi-gpiod.json @@ -7,7 +7,6 @@ "resistor": "Resistor?", "readinitial": "Read initial state of pin on deploy/restart?", "type": "Type", - "setfreq": "Set frequency?", "freq": "Frequency", "initpin": "Initialise pin state?", "debounce": "Debounce", @@ -34,8 +33,7 @@ "pin": "Pins in Use: ", "in": "Only Digital Input is supported - input must be 0 or 1.", "dig": "Digital output - input must be 0 or 1.", - "pwm": "PWM output - input must be between 0 to 100.", - "freq": "Frequency must be in between 5 and 40000 Hz", + "pwm": "PWM output - input must be between 0 to 100.
Frequency must be in between 5 and 40000 Hz.", "ser": "Servo output - input must be between 0 to 100. 50 is centre.
Min must be 500uS or more, Max must be 2500uS or less." }, "types": { diff --git a/hardware/pigpiod/pi-gpiod.html b/hardware/pigpiod/pi-gpiod.html index bc4b4214d..7c32e9383 100644 --- a/hardware/pigpiod/pi-gpiod.html +++ b/hardware/pigpiod/pi-gpiod.html @@ -381,11 +381,6 @@ -
- - - -
Hz @@ -419,7 +414,6 @@
-
Pins marked in blue are dual use. Make sure they are not enabled for their other use before using as GPIO.
@@ -492,7 +486,7 @@ $('#node-set-tick').hide(); $('#node-set-state').hide(); $('#node-input-set').prop('checked', false); - $('#node-set-freq-tick').show(); + $("#node-set-frequency").show(); $('#node-set-minimax').hide(); $("#dig-tip").hide(); $("#pwm-tip").show(); @@ -502,24 +496,18 @@ $('#node-set-tick').hide(); $('#node-set-state').hide(); $('#node-input-set').prop('checked', false); - $('#node-set-freq-tick').hide(); $("#node-set-frequency").hide(); - $('#node-input-setfreq').prop('checked', false); $('#node-set-minimax').show(); $("#dig-tip").hide(); $("#pwm-tip").hide(); - $("#freq-tip").hide(); $("#ser-tip").show(); } else { $('#node-set-tick').show(); - $('#node-set-freq-tick').hide(); $("#node-set-frequency").hide(); - $('#node-input-setfreq').prop('checked', false); $('#node-set-minimax').hide(); $("#dig-tip").show(); $("#pwm-tip").hide(); - $("#freq-tip").hide(); $("#ser-tip").hide(); } }; @@ -536,18 +524,6 @@ $("#node-input-set").change(function () { setstate(); }); setstate(); - var setfreqstate = function () { - if ($('#node-input-setfreq').is(":checked")) { - $("#node-set-frequency").show(); - $("#freq-tip").show(); - } else { - $("#node-set-frequency").hide(); - $("#freq-tip").hide(); - } - }; - $("#node-input-setfreq").change(function () { setfreqstate(); }); - setfreqstate(); - $('#pinform input').on('change', function() { this.pin = $("#pinform input[type='radio']:checked").val(); $("#node-input-pin").val(this.pin); diff --git a/hardware/pigpiod/pi-gpiod.js b/hardware/pigpiod/pi-gpiod.js index 084bab781..228f27de5 100644 --- a/hardware/pigpiod/pi-gpiod.js +++ b/hardware/pigpiod/pi-gpiod.js @@ -149,7 +149,7 @@ module.exports = function(RED) { if (node.setfreq) { PiGPIO.set_PWM_frequency(node.pin,node.freq); } - //PiGPIO.set_PWM_range(node.pin,1000); + //PiGPIO.set_PWM_range(node.pin,1000); } }); } From 4282cfe5fae4ea4fb05f56fe8aa129b07dcea0ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4fele?= Date: Fri, 30 Mar 2018 18:31:53 +0200 Subject: [PATCH 4/8] Forgot to adapt logical code to not use checkbox value --- hardware/pigpiod/pi-gpiod.html | 1 - hardware/pigpiod/pi-gpiod.js | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hardware/pigpiod/pi-gpiod.html b/hardware/pigpiod/pi-gpiod.html index 7c32e9383..cf8b9cb0e 100644 --- a/hardware/pigpiod/pi-gpiod.html +++ b/hardware/pigpiod/pi-gpiod.html @@ -452,7 +452,6 @@ set: { value:"" }, level: { value:"0" }, out: { value:"out" }, - setfreq: { value:""}, freq: { value:"800" }, sermin: { value:"1000" }, sermax: { value:"2000" } diff --git a/hardware/pigpiod/pi-gpiod.js b/hardware/pigpiod/pi-gpiod.js index 228f27de5..415d9dc49 100644 --- a/hardware/pigpiod/pi-gpiod.js +++ b/hardware/pigpiod/pi-gpiod.js @@ -86,7 +86,6 @@ module.exports = function(RED) { this.set = n.set || false; this.level = parseInt(n.level || 0); this.out = n.out || "out"; - this.setfreq = n.setfreq || false; this.freq = Number(n.freq || 800); if (this.freq < 5) { this.freq = 5; } if (this.freq > 40000) { this.freq = 40000; } @@ -146,10 +145,10 @@ module.exports = function(RED) { } else { node.status({fill:"green",shape:"dot",text:"node-red:common.status.ok"}); } - if (node.setfreq) { + if (node.out === "pwm") { PiGPIO.set_PWM_frequency(node.pin,node.freq); + //PiGPIO.set_PWM_range(node.pin,1000); } - //PiGPIO.set_PWM_range(node.pin,1000); } }); } From c186a22347b36c9f85f3530e5800faed806763a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4fele?= Date: Fri, 30 Mar 2018 11:43:59 +0200 Subject: [PATCH 5/8] Add option to set frequency --- hardware/pigpiod/locales/en-US/pi-gpiod.json | 2 ++ hardware/pigpiod/pi-gpiod.html | 32 ++++++++++++++++++-- hardware/pigpiod/pi-gpiod.js | 12 +++++--- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/hardware/pigpiod/locales/en-US/pi-gpiod.json b/hardware/pigpiod/locales/en-US/pi-gpiod.json index 5eaa33e6c..8e6bd7b97 100644 --- a/hardware/pigpiod/locales/en-US/pi-gpiod.json +++ b/hardware/pigpiod/locales/en-US/pi-gpiod.json @@ -7,6 +7,8 @@ "resistor": "Resistor?", "readinitial": "Read initial state of pin on deploy/restart?", "type": "Type", + "setfreq": "Set frequency?", + "freq": "Frequency", "initpin": "Initialise pin state?", "debounce": "Debounce", "limits": "Limits", diff --git a/hardware/pigpiod/pi-gpiod.html b/hardware/pigpiod/pi-gpiod.html index 824399c6e..e900d24da 100644 --- a/hardware/pigpiod/pi-gpiod.html +++ b/hardware/pigpiod/pi-gpiod.html @@ -381,6 +381,15 @@ +
+ + + +
+
+ + Hz +
uS @@ -448,6 +457,8 @@ set: { value:"" }, level: { value:"0" }, out: { value:"out" }, + setfreq: { value:""}, + freq: { value:"800" }, sermin: { value:"1000" }, sermax: { value:"2000" } }, @@ -479,8 +490,9 @@ if ($("#node-input-out").val() === "pwm") { $('#node-set-tick').hide(); $('#node-set-state').hide(); - $('#node-set-minimax').hide(); $('#node-input-set').prop('checked', false); + $('#node-set-freq-tick').show(); + $('#node-set-minimax').hide(); $("#dig-tip").hide(); $("#pwm-tip").show(); $("#ser-tip").hide(); @@ -488,14 +500,20 @@ else if ($("#node-input-out").val() === "ser") { $('#node-set-tick').hide(); $('#node-set-state').hide(); - $('#node-set-minimax').show(); $('#node-input-set').prop('checked', false); + $('#node-set-freq-tick').hide(); + $("#node-set-frequency").hide(); + $('#node-input-setfreq').prop('checked', false); + $('#node-set-minimax').show(); $("#dig-tip").hide(); $("#pwm-tip").hide(); $("#ser-tip").show(); } else { $('#node-set-tick').show(); + $('#node-set-freq-tick').hide(); + $("#node-set-frequency").hide(); + $('#node-input-setfreq').prop('checked', false); $('#node-set-minimax').hide(); $("#dig-tip").show(); $("#pwm-tip").hide(); @@ -515,6 +533,16 @@ $("#node-input-set").change(function () { setstate(); }); setstate(); + var setfreqstate = function () { + if ($('#node-input-setfreq').is(":checked")) { + $("#node-set-frequency").show(); + } else { + $("#node-set-frequency").hide(); + } + }; + $("#node-input-setfreq").change(function () { setfreqstate(); }); + setfreqstate(); + $('#pinform input').on('change', function() { this.pin = $("#pinform input[type='radio']:checked").val(); $("#node-input-pin").val(this.pin); diff --git a/hardware/pigpiod/pi-gpiod.js b/hardware/pigpiod/pi-gpiod.js index 143629dad..3414f83fb 100644 --- a/hardware/pigpiod/pi-gpiod.js +++ b/hardware/pigpiod/pi-gpiod.js @@ -86,6 +86,10 @@ module.exports = function(RED) { this.set = n.set || false; this.level = parseInt(n.level || 0); this.out = n.out || "out"; + this.setfreq = n.setfreq || false; + this.freq = Number(n.freq || 800); + if (this.freq < 5) { this.freq = 5; } + if (this.freq > 40000) { this.freq = 40000; } this.sermin = Number(n.sermin)/100; this.sermax = Number(n.sermax)/100; if (this.sermin > this.sermax) { @@ -146,10 +150,10 @@ module.exports = function(RED) { } else { node.status({fill:"green",shape:"dot",text:"node-red:common.status.ok"}); } - // if (node.out === "pwm") { - // PiGPIO.set_PWM_frequency(1000); - // PiGPIO.set_PWM_range(1000); - // } + if (node.setfreq) { + PiGPIO.set_PWM_frequency(node.pin,node.freq); + } + //PiGPIO.set_PWM_range(node.pin,1000); } }); } From cda6eec3ab3650a64010c4b47479c94b50f42324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4fele?= Date: Fri, 30 Mar 2018 12:09:40 +0200 Subject: [PATCH 6/8] Add tip for frequency setting --- hardware/pigpiod/locales/en-US/pi-gpiod.json | 1 + hardware/pigpiod/pi-gpiod.html | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/hardware/pigpiod/locales/en-US/pi-gpiod.json b/hardware/pigpiod/locales/en-US/pi-gpiod.json index 8e6bd7b97..865a7a399 100644 --- a/hardware/pigpiod/locales/en-US/pi-gpiod.json +++ b/hardware/pigpiod/locales/en-US/pi-gpiod.json @@ -35,6 +35,7 @@ "in": "Only Digital Input is supported - input must be 0 or 1.", "dig": "Digital output - input must be 0 or 1.", "pwm": "PWM output - input must be between 0 to 100.", + "freq": "Frequency must be in between 5 and 40000 Hz", "ser": "Servo output - input must be between 0 to 100. 50 is centre.
Min must be 500uS or more, Max must be 2500uS or less." }, "types": { diff --git a/hardware/pigpiod/pi-gpiod.html b/hardware/pigpiod/pi-gpiod.html index e900d24da..eee85ff63 100644 --- a/hardware/pigpiod/pi-gpiod.html +++ b/hardware/pigpiod/pi-gpiod.html @@ -419,6 +419,7 @@
+
Pins marked in blue are dual use. Make sure they are not enabled for their other use before using as GPIO.
@@ -507,6 +508,7 @@ $('#node-set-minimax').show(); $("#dig-tip").hide(); $("#pwm-tip").hide(); + $("#freq-tip").hide(); $("#ser-tip").show(); } else { @@ -517,6 +519,7 @@ $('#node-set-minimax').hide(); $("#dig-tip").show(); $("#pwm-tip").hide(); + $("#freq-tip").hide(); $("#ser-tip").hide(); } }; @@ -536,8 +539,10 @@ var setfreqstate = function () { if ($('#node-input-setfreq').is(":checked")) { $("#node-set-frequency").show(); + $("#freq-tip").show(); } else { $("#node-set-frequency").hide(); + $("#freq-tip").hide(); } }; $("#node-input-setfreq").change(function () { setfreqstate(); }); From 8baea03abc86c63f592a51eed230ab5f28a1ab52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4fele?= Date: Fri, 30 Mar 2018 18:14:49 +0200 Subject: [PATCH 7/8] Remove checkbox for setting pwm frequency --- hardware/pigpiod/locales/en-US/pi-gpiod.json | 4 +-- hardware/pigpiod/pi-gpiod.html | 26 +------------------- hardware/pigpiod/pi-gpiod.js | 2 +- 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/hardware/pigpiod/locales/en-US/pi-gpiod.json b/hardware/pigpiod/locales/en-US/pi-gpiod.json index 865a7a399..dcd605ce2 100644 --- a/hardware/pigpiod/locales/en-US/pi-gpiod.json +++ b/hardware/pigpiod/locales/en-US/pi-gpiod.json @@ -7,7 +7,6 @@ "resistor": "Resistor?", "readinitial": "Read initial state of pin on deploy/restart?", "type": "Type", - "setfreq": "Set frequency?", "freq": "Frequency", "initpin": "Initialise pin state?", "debounce": "Debounce", @@ -34,8 +33,7 @@ "pin": "Pins in Use: ", "in": "Only Digital Input is supported - input must be 0 or 1.", "dig": "Digital output - input must be 0 or 1.", - "pwm": "PWM output - input must be between 0 to 100.", - "freq": "Frequency must be in between 5 and 40000 Hz", + "pwm": "PWM output - input must be between 0 to 100.
Frequency must be in between 5 and 40000 Hz.", "ser": "Servo output - input must be between 0 to 100. 50 is centre.
Min must be 500uS or more, Max must be 2500uS or less." }, "types": { diff --git a/hardware/pigpiod/pi-gpiod.html b/hardware/pigpiod/pi-gpiod.html index eee85ff63..de458b009 100644 --- a/hardware/pigpiod/pi-gpiod.html +++ b/hardware/pigpiod/pi-gpiod.html @@ -381,11 +381,6 @@ -
- - - -
Hz @@ -419,7 +414,6 @@
-
Pins marked in blue are dual use. Make sure they are not enabled for their other use before using as GPIO.
@@ -492,7 +486,7 @@ $('#node-set-tick').hide(); $('#node-set-state').hide(); $('#node-input-set').prop('checked', false); - $('#node-set-freq-tick').show(); + $("#node-set-frequency").show(); $('#node-set-minimax').hide(); $("#dig-tip").hide(); $("#pwm-tip").show(); @@ -502,24 +496,18 @@ $('#node-set-tick').hide(); $('#node-set-state').hide(); $('#node-input-set').prop('checked', false); - $('#node-set-freq-tick').hide(); $("#node-set-frequency").hide(); - $('#node-input-setfreq').prop('checked', false); $('#node-set-minimax').show(); $("#dig-tip").hide(); $("#pwm-tip").hide(); - $("#freq-tip").hide(); $("#ser-tip").show(); } else { $('#node-set-tick').show(); - $('#node-set-freq-tick').hide(); $("#node-set-frequency").hide(); - $('#node-input-setfreq').prop('checked', false); $('#node-set-minimax').hide(); $("#dig-tip").show(); $("#pwm-tip").hide(); - $("#freq-tip").hide(); $("#ser-tip").hide(); } }; @@ -536,18 +524,6 @@ $("#node-input-set").change(function () { setstate(); }); setstate(); - var setfreqstate = function () { - if ($('#node-input-setfreq').is(":checked")) { - $("#node-set-frequency").show(); - $("#freq-tip").show(); - } else { - $("#node-set-frequency").hide(); - $("#freq-tip").hide(); - } - }; - $("#node-input-setfreq").change(function () { setfreqstate(); }); - setfreqstate(); - $('#pinform input').on('change', function() { this.pin = $("#pinform input[type='radio']:checked").val(); $("#node-input-pin").val(this.pin); diff --git a/hardware/pigpiod/pi-gpiod.js b/hardware/pigpiod/pi-gpiod.js index 3414f83fb..16dbd635d 100644 --- a/hardware/pigpiod/pi-gpiod.js +++ b/hardware/pigpiod/pi-gpiod.js @@ -153,7 +153,7 @@ module.exports = function(RED) { if (node.setfreq) { PiGPIO.set_PWM_frequency(node.pin,node.freq); } - //PiGPIO.set_PWM_range(node.pin,1000); + //PiGPIO.set_PWM_range(node.pin,1000); } }); } From 2046211fc1923a57f9fba092dbf09cdace511198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4fele?= Date: Fri, 30 Mar 2018 18:31:53 +0200 Subject: [PATCH 8/8] Forgot to adapt logical code to not use checkbox value --- hardware/pigpiod/pi-gpiod.html | 1 - hardware/pigpiod/pi-gpiod.js | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hardware/pigpiod/pi-gpiod.html b/hardware/pigpiod/pi-gpiod.html index de458b009..c480e25c7 100644 --- a/hardware/pigpiod/pi-gpiod.html +++ b/hardware/pigpiod/pi-gpiod.html @@ -452,7 +452,6 @@ set: { value:"" }, level: { value:"0" }, out: { value:"out" }, - setfreq: { value:""}, freq: { value:"800" }, sermin: { value:"1000" }, sermax: { value:"2000" } diff --git a/hardware/pigpiod/pi-gpiod.js b/hardware/pigpiod/pi-gpiod.js index 16dbd635d..93e95bdaf 100644 --- a/hardware/pigpiod/pi-gpiod.js +++ b/hardware/pigpiod/pi-gpiod.js @@ -86,7 +86,6 @@ module.exports = function(RED) { this.set = n.set || false; this.level = parseInt(n.level || 0); this.out = n.out || "out"; - this.setfreq = n.setfreq || false; this.freq = Number(n.freq || 800); if (this.freq < 5) { this.freq = 5; } if (this.freq > 40000) { this.freq = 40000; } @@ -150,10 +149,10 @@ module.exports = function(RED) { } else { node.status({fill:"green",shape:"dot",text:"node-red:common.status.ok"}); } - if (node.setfreq) { + if (node.out === "pwm") { PiGPIO.set_PWM_frequency(node.pin,node.freq); + //PiGPIO.set_PWM_range(node.pin,1000); } - //PiGPIO.set_PWM_range(node.pin,1000); } }); }