1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

correct maths and help for servo min/max timings

This commit is contained in:
Dave Conway-Jones 2017-04-18 16:39:56 +01:00
parent 63a873f1f1
commit f2cc2bb321
No known key found for this signature in database
GPG Key ID: 81B04231572A9A2D
4 changed files with 9 additions and 9 deletions

View File

@ -33,7 +33,7 @@
"in": "<b>Tip</b>: Only Digital Input is supported - input must be 0 or 1.", "in": "<b>Tip</b>: Only Digital Input is supported - input must be 0 or 1.",
"dig": "<b>Tip</b>: For digital output - input must be 0 or 1.", "dig": "<b>Tip</b>: For digital output - input must be 0 or 1.",
"pwm": "<b>Tip</b>: For PWM output - input must be between 0 to 100.", "pwm": "<b>Tip</b>: For PWM output - input must be between 0 to 100.",
"ser": "<b>Tip</b>: For Servo output - input must be between 0 to 100. 50 is centre.<br/>Min must be 5mS or more, Max must be 25mS or less." "ser": "<b>Tip</b>: For Servo output - input must be between 0 to 100. 50 is centre.<br/>Min must be 500uS or more, Max must be 2500uS or less."
}, },
"types": { "types": {
"digout": "digital output", "digout": "digital output",

View File

@ -1,9 +1,9 @@
{ {
"name": "node-red-node-pi-gpiod", "name": "node-red-node-pi-gpiod",
"version": "0.0.2", "version": "0.0.3",
"description": "A node-red node for PiGPIOd", "description": "A node-red node for PiGPIOd",
"dependencies" : { "dependencies" : {
"js-pigpio": "^1.0.0" "js-pigpio": "*"
}, },
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"

View File

@ -161,9 +161,9 @@
</div> </div>
<div class="form-row" id="node-set-minimax"> <div class="form-row" id="node-set-minimax">
<label>&nbsp;&nbsp;&nbsp;&nbsp;<span data-i18n="pi-gpiod.label.limits"></label> <label>&nbsp;&nbsp;&nbsp;&nbsp;<span data-i18n="pi-gpiod.label.limits"></label>
<span data-i18n="pi-gpiod.label.min"></span> <input type="text" id="node-input-sermin" style="width:70px;"> mS <span data-i18n="pi-gpiod.label.min"></span> <input type="text" id="node-input-sermin" style="width:70px;"> uS
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span data-i18n="pi-gpiod.label.max"></span> <input type="text" id="node-input-sermax" style="width:70px;"> mS <span data-i18n="pi-gpiod.label.max"></span> <input type="text" id="node-input-sermax" style="width:70px;"> uS
</div> </div>
<div class="form-row" id="node-set-tick"> <div class="form-row" id="node-set-tick">
<label>&nbsp;</label> <label>&nbsp;</label>
@ -226,8 +226,8 @@
set: { value:"" }, set: { value:"" },
level: { value:"0" }, level: { value:"0" },
out: { value:"out" }, out: { value:"out" },
sermin: { value:"10" }, sermin: { value:"1000" },
sermax: { value:"20" } sermax: { value:"2000" }
}, },
inputs:1, inputs:1,
outputs:0, outputs:0,

View File

@ -86,8 +86,8 @@ module.exports = function(RED) {
this.set = n.set || false; this.set = n.set || false;
this.level = parseInt(n.level || 0); this.level = parseInt(n.level || 0);
this.out = n.out || "out"; this.out = n.out || "out";
this.sermin = Number(n.sermin); this.sermin = Number(n.sermin)/100;
this.sermax = Number(n.sermax); this.sermax = Number(n.sermax)/100;
if (this.sermin > this.sermax) { if (this.sermin > this.sermax) {
var tmp = this.sermin; var tmp = this.sermin;
this.sermin = this.sermax; this.sermin = this.sermax;