Tweaks to verify input to Pirella Node, remove unused variable.

This commit is contained in:
Dave C-J 2014-03-31 22:37:28 +01:00
parent ab8d6b1b65
commit e8c328a9e1
2 changed files with 9 additions and 11 deletions

View File

@ -18,7 +18,7 @@
<div class="form-row"> <div class="form-row">
<label for="node-input-pin"><i class="icon-asterisk"></i> Input</label> <label for="node-input-pin"><i class="icon-asterisk"></i> Input</label>
<select type="text" id="node-input-pin" style="width: 150px;"> <select type="text" id="node-input-pin" style="width: 150px;">
<option value="-">select input </option> <option value="-">select input</option>
<option value="Red Button">Red Button</option> <option value="Red Button">Red Button</option>
<option value="In A">In A</option> <option value="In A">In A</option>
<option value="In B">In B</option> <option value="In B">In B</option>
@ -45,8 +45,7 @@
color:"#c6dbef", color:"#c6dbef",
defaults: { defaults: {
name: { value:"" }, name: { value:"" },
intype: { value: "in" }, pin: { value:"",required:true,validate:RED.validators.regex(/ /) }
pin: { value:"",required:true },
}, },
inputs:0, inputs:0,
outputs:1, outputs:1,
@ -65,7 +64,7 @@
<div class="form-row"> <div class="form-row">
<label for="node-input-pin"><i class="icon-asterisk"></i> Output</label> <label for="node-input-pin"><i class="icon-asterisk"></i> Output</label>
<select type="text" id="node-input-pin" style="width: 150px;"> <select type="text" id="node-input-pin" style="width: 150px;">
<option value="-">select output </option> <option value="-">select output</option>
<option value="Red LED">Red LED</option> <option value="Red LED">Red LED</option>
<option value="Amber LED">Amber LED</option> <option value="Amber LED">Amber LED</option>
<option value="Green LED">Green LED</option> <option value="Green LED">Green LED</option>
@ -73,7 +72,7 @@
<option value="Out F">Out F</option> <option value="Out F">Out F</option>
<option value="Out G">Out G</option> <option value="Out G">Out G</option>
<option value="Out H">Out H</option> <option value="Out H">Out H</option>
<option value="Buzzer">Buzzer</option> <option value="Buzzer ">Buzzer</option>
</select> </select>
</div> </div>
<div class="form-row"> <div class="form-row">
@ -96,7 +95,7 @@
color:"#c6dbef", color:"#c6dbef",
defaults: { defaults: {
name: { value:"" }, name: { value:"" },
pin: { value:"",required:true }, pin: { value:"",required:true,validate:RED.validators.regex(/ /) }
}, },
inputs:1, inputs:1,
outputs:0, outputs:0,

View File

@ -33,7 +33,7 @@ if (!fs.existsSync("/usr/local/bin/gpio")) {
var pintable = { var pintable = {
// Physical : WiringPi // Physical : WiringPi
"Amber LED":"0", "Amber LED":"0",
"Buzzer":"1", "Buzzer ":"1",
"Red LED":"2", "Red LED":"2",
"Out E":"3", "Out E":"3",
"Out F":"4", "Out F":"4",
@ -49,7 +49,7 @@ var pintable = {
var tablepin = { var tablepin = {
// WiringPi : Physical // WiringPi : Physical
"0":"Amber", "0":"Amber",
"Buzzer":"1", "1":"Buzzer",
"2":"Red", "2":"Red",
"3":"E", "3":"E",
"4":"F", "4":"F",
@ -67,11 +67,10 @@ function PibrellaIn(n) {
RED.nodes.createNode(this,n); RED.nodes.createNode(this,n);
this.buttonState = -1; this.buttonState = -1;
this.pin = pintable[n.pin]; this.pin = pintable[n.pin];
this.intype = n.intype;
var node = this; var node = this;
if (this.pin) { if (this.pin) {
exec("gpio mode "+node.pin+" "+node.intype, function(err,stdout,stderr) { exec("gpio mode "+node.pin+" in", function(err,stdout,stderr) {
if (err) node.error(err); if (err) node.error(err);
else { else {
node._interval = setInterval( function() { node._interval = setInterval( function() {
@ -88,7 +87,7 @@ function PibrellaIn(n) {
} }
} }
}); });
}, 250); }, 200);
} }
}); });
} }