mraa-gpio: clean up on close for ain, pwm, dout

Required as nodejs will only lazily delete the node objects, and we may
race with the next user requesting the resources.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Ivan Mikhaylov <ivan.mikhaylov@siemens.com>
This commit is contained in:
Ivan Mikhaylov 2022-08-01 12:06:16 -04:00
parent 7050f0a147
commit 24079943b3
3 changed files with 3 additions and 0 deletions

View File

@ -25,6 +25,7 @@ module.exports = function(RED) {
this.on('close', function() {
clearInterval(this.timer);
node.x.close();
});
}
RED.nodes.registerType("mraa-gpio-ain", gpioAin);

View File

@ -29,6 +29,7 @@ module.exports = function(RED) {
});
this.on('close', function() {
node.p.close();
});
}
RED.nodes.registerType("mraa-gpio-dout", gpioDout);

View File

@ -21,6 +21,7 @@ module.exports = function(RED) {
this.on('close', function() {
node.p.enable(false);
node.p.close();
});
}
RED.nodes.registerType("mraa-gpio-pwm", gpioPWM);