node-red-node-pisrf needs updating to cope with replacement for RPi.GPIO
cymplecy opened this issue · 0 comments
cymplecy commented
If you install this node on a PI5 running Bookworm - you get errors in the log console and with the node status and it doesn't return any distance measurements
I'm pretty certain this is to do with the python3-rpi.gpio being replaced by python-rpi-lgpio
I couldn't work out the proper way to fix it so as a bodge, I replaced all the allOK=false with allOK=true and it works
try {
var cpuinfo = fs.readFileSync("/proc/cpuinfo").toString();
if (cpuinfo.indexOf(": BCM") === -1 && cpuinfo.indexOf(": Raspberry Pi") === -1) {
RED.log.warn("rpi-srf : "+RED._("node-red:rpi-gpio.errors.ignorenode"));
allOK = false;
}
else if (!fs.existsSync("/usr/share/doc/python-rpi.gpio") && !fs.existsSync("/usr/share/doc/python3-rpi.gpio")) {
RED.log.warn("rpi-srf : "+RED._("node-red:rpi-gpio.errors.libnotfound"));
allOK = false;
}
else if (!(1 & parseInt ((fs.statSync(gpioCommand).mode & parseInt ("777", 8)).toString (8)[0]))) {
RED.log.warn("rpi-srf : "+RED._("node-red:rpi-gpio.errors.needtobeexecutable",{command:gpioCommand}));
allOK = false;
}
}
catch(err) {
RED.log.warn("rpi-srf : "+RED._("node-red:rpi-gpio.errors.ignorenode"));
allOK = false;
}