mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Fix PiFace node initial state so it works...
(which it never did… oops! )
This commit is contained in:
parent
0662354ec3
commit
7408cf7674
@ -63,6 +63,8 @@
|
|||||||
<p>The <b>msg.topic</b> is set to <i>piface/{the pin number}</i></p>
|
<p>The <b>msg.topic</b> is set to <i>piface/{the pin number}</i></p>
|
||||||
<p>Requires the WiringPi gpio command in order to work.</p>
|
<p>Requires the WiringPi gpio command in order to work.</p>
|
||||||
<p><b>Note:</b> This node currently polls the pin every 250mS. This is not ideal as it loads the cpu.</p>
|
<p><b>Note:</b> This node currently polls the pin every 250mS. This is not ideal as it loads the cpu.</p>
|
||||||
|
<p><b>Note:</b> Some versions of the PiFace relabelled the switch inputs to be 0 - 7 instead of 1 - 8.
|
||||||
|
We cannot automatically detect this so the user will have to apply some common sense.</p>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -99,6 +99,8 @@ module.exports = function(RED) {
|
|||||||
function PiFACEOutNode(n) {
|
function PiFACEOutNode(n) {
|
||||||
RED.nodes.createNode(this,n);
|
RED.nodes.createNode(this,n);
|
||||||
this.pin = pintable[n.pin];
|
this.pin = pintable[n.pin];
|
||||||
|
this.set = n.set;
|
||||||
|
this.level = n.level;
|
||||||
var node = this;
|
var node = this;
|
||||||
if (node.pin) {
|
if (node.pin) {
|
||||||
if (node.set) {
|
if (node.set) {
|
||||||
@ -123,10 +125,9 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exec("gpio load spi",function(err,stdout,stderr) {
|
exec("gpio load spi",function(err,stdout,stderr) {
|
||||||
if (err) {
|
if (err) {
|
||||||
util.log('[37-rpi-piface.js] Error: "gpio load spi" command failed for some reason.');
|
util.log('[37-rpi-piface.js] Error: "gpio load spi" command failed. Check device tree is disabled.');
|
||||||
}
|
}
|
||||||
RED.nodes.registerType("rpi-piface in",PiFACEInNode);
|
RED.nodes.registerType("rpi-piface in",PiFACEInNode);
|
||||||
RED.nodes.registerType("rpi-piface out",PiFACEOutNode);
|
RED.nodes.registerType("rpi-piface out",PiFACEOutNode);
|
||||||
|
@ -5,6 +5,10 @@ node-red-node-piface
|
|||||||
<a href="http://www.piface.org.uk/products/piface_digital/" target="_new">PiFace Digital</a>
|
<a href="http://www.piface.org.uk/products/piface_digital/" target="_new">PiFace Digital</a>
|
||||||
add-on board for a Raspberry-Pi.
|
add-on board for a Raspberry-Pi.
|
||||||
|
|
||||||
|
**Note:** Some later versions of the PiFace relabelled the switch inputs to be `0 - 7`
|
||||||
|
instead of `1 - 8` as on the original boards.
|
||||||
|
We cannot automatically detect this so the user will have to apply some common sense.
|
||||||
|
|
||||||
Install
|
Install
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-piface",
|
"name" : "node-red-node-piface",
|
||||||
"version" : "0.0.4",
|
"version" : "0.0.5",
|
||||||
"description" : "Node-RED nodes to read from and write to a PiFace Digital Raspberry Pi add-on board",
|
"description" : "Node-RED nodes to read from and write to a PiFace Digital Raspberry Pi add-on board",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user