Fix PiFace node initial state so it works...

(which it never did… oops! )
This commit is contained in:
Dave Conway-Jones 2016-01-03 12:25:08 +00:00
parent 0662354ec3
commit 7408cf7674
4 changed files with 10 additions and 3 deletions

View File

@ -63,6 +63,8 @@
<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><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 type="text/javascript">

View File

@ -99,6 +99,8 @@ module.exports = function(RED) {
function PiFACEOutNode(n) {
RED.nodes.createNode(this,n);
this.pin = pintable[n.pin];
this.set = n.set;
this.level = n.level;
var node = this;
if (node.pin) {
if (node.set) {
@ -123,10 +125,9 @@ module.exports = function(RED) {
}
}
exec("gpio load spi",function(err,stdout,stderr) {
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 out",PiFACEOutNode);

View File

@ -5,6 +5,10 @@ node-red-node-piface
<a href="http://www.piface.org.uk/products/piface_digital/" target="_new">PiFace Digital</a>
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
-------

View File

@ -1,6 +1,6 @@
{
"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",
"dependencies" : {
},