node-red-contrib-i2c
node-red-contrib-i2c copied to clipboard
msg.bus not working
Hello,
The use of the msg.bus variable as input to the i2c scan node does not work and systematically uses bus 1. I have not tested with the i2c In and i2c Out nodes. After looking at the code it even seems that msg.bus is not even expected.
regards,
Finally msg.bus is not implemented. Here is an example of the modification in "26-i2c.js" for the implementation in I2C scan. The same can be done on I2CIn and I2COut. In function I2CScanNode :
//node.port = I2C.openSync( node.busno );
node.on("input", function(msg) {
var busno = isNaN(parseInt(msg.bus)) ? node.busno : parseInt(msg.bus);
node.port = I2C.openSync(busno);
node.port.scan(function(err, res) { ....
If it can help anyone ! regards,
A pull request to fix the node would help everyone :-) Thanks in advance !
A pull request to fix the node would help everyone :-) Thanks in advance !
Hi dceejay,
I'm not used to how GitHub works because this is the first time I've raised an issue on GitHub. I will try to write a correct "pull request" regarding the assignment of the i2C bus number by msg.bus.
( sorry for my english, thanks google translator :) )
Great - welcome aboard !
(don't worry we can help you fix it if it needs it.)