diff --git a/hardware/mcp3008/pimcp3008.html b/hardware/mcp3008/pimcp3008.html
index e6e9894f..4ed013dc 100644
--- a/hardware/mcp3008/pimcp3008.html
+++ b/hardware/mcp3008/pimcp3008.html
@@ -32,6 +32,7 @@
@@ -77,7 +78,7 @@
outputs: 1,
icon: "rpi.png",
label: function() {
- return this.name || "mcp"+this.dev+" "+((this.pin==="M")?"":this.pin);
+ return this.name || "mcp:"+this.dev+" "+" bus:"+this.bus+" CS:"+this.dnum+" pin:"+((this.pin==="M")?"":this.pin);
},
labelStyle: function() {
return this.name?"node_label_italic":"";
diff --git a/hardware/mcp3008/pimcp3008.js b/hardware/mcp3008/pimcp3008.js
index e6125695..ebb0066a 100644
--- a/hardware/mcp3008/pimcp3008.js
+++ b/hardware/mcp3008/pimcp3008.js
@@ -19,7 +19,7 @@ module.exports = function(RED) {
RED.log.warn("Info : mcp3xxx : Not running on a Pi - Ignoring node");
}
- var mcp3xxx = [];
+ //var mcp3xxx = [];
function PiMcpNode(n) {
RED.nodes.createNode(this,n);
@@ -28,15 +28,17 @@ module.exports = function(RED) {
this.dnum = parseInt(n.dnum || 0);
this.bus = parseInt(n.bus || 0);
this.dev = n.dev || "3008";
+ this.mcp3xxx = [];
var node = this;
- var cb = function (err) { if (err) { node.error("Error: "+err); } };
- var opt = { speedHz:20000, deviceNumber:node.dnum, busNumber:node.bus };
+ this.cb = function (err) { if (err) { node.error("Error: "+err); } };
+ this.opt = { speedHz:20000, deviceNumber:node.dnum, busNumber:node.bus };
var chans = parseInt(this.dev.substr(3));
+ var node = this;
if (allOK === true) {
try {
fs.statSync("/dev/spidev"+node.bus+"."+node.dnum);
- if (mcp3xxx.length === 0) {
+ if (node.mcp3xxx.length === 0) {
for (var i=0; i