You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if you are registering read events for two pins with the same number on each port, say GPIOA-1 (pin 1) and GPIOB-1 (pin 9), the two read event will be generated with the same "digital-read-1" name. Therefore, whenever any of those two pins is read, the two registered callbacks will be called, resulting in an unexpected behaviour.
to fix this, the pin number passed as a parameter should be saved and used to generate the event
I'm so sorry it's taken me this long to respond. Your fix looks good and makes sense. I will be back to work next week and will set up some test hardware to confirm.
I appreciate your patience. I'm a new Dad this year and I've been struggling to stay on top of this project.
hello,
HW: rasp PI 3
latest J5 version.
if you are registering read events for two pins with the same number on each port, say GPIOA-1 (pin 1) and GPIOB-1 (pin 9), the two read event will be generated with the same "digital-read-1" name. Therefore, whenever any of those two pins is read, the two registered callbacks will be called, resulting in an unexpected behaviour.
to fix this, the pin number passed as a parameter should be saved and used to generate the event
value: function(pin, callback) {
var orgPin=pin;
...
this.on("digital-read-" + orgPin, callback);
...
this.emit("digital-read-" + orgPin, value);
I hope it helps, I tested the fix and it works well.
best,
alex
original code----
digitalRead: {
value: function(pin, callback) {
var pinIndex = pin;
var gpioaddr = 0;
},
The text was updated successfully, but these errors were encountered: