mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
fix mcp3008 to close only the channels it has
This commit is contained in:
parent
e20cf97fce
commit
75df218a23
@ -1,9 +1,9 @@
|
||||
{
|
||||
"name" : "node-red-node-pi-mcp3008",
|
||||
"version" : "0.2.0",
|
||||
"version" : "0.2.1",
|
||||
"description" : "A Node-RED node to read from the MCP3008 Analogue to Digital Converter",
|
||||
"dependencies" : {
|
||||
"mcp-spi-adc": "^2.0.3"
|
||||
"mcp-spi-adc": "^2.0.6"
|
||||
},
|
||||
"repository" : {
|
||||
"type":"git",
|
||||
|
@ -62,8 +62,8 @@ module.exports = function(RED) {
|
||||
node.on("close", function(done) {
|
||||
if (mcp3xxx.length !== 0) {
|
||||
var j=0;
|
||||
for (var i=0; i<8; i++) {
|
||||
mcp3xxx[i].close(function() { j += 1; if (j === 8) {done()} });
|
||||
for (var i=0; i<chans; i++) {
|
||||
mcp3xxx[i].close(function() { j += 1; if (j === chans) {done()} });
|
||||
}
|
||||
mcp3xxx = [];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user