Change underlying library of node-red-node-pi-gpiod

Hi folks,

i'm thinking about to change the underlying library of node-red-node-pi-gpiod nodes as i have some concerns about the currently used js-pigpio.

As i was doing my frequency set feature i struggled with the js-pigpio library as there're some minor issue with the library.

For example i found some issues regarding the used locking mechanism which leads to a crash ob the node.
Also some functions are without callbacks which i think doesn't make sense.

As seen by the linked issue i already contacted the maintainer of the library already and nothing happened for almost a year now.

So i searched for an alternative and found the pigpio-client library.

I think this is a good replacement as this lib seems to be better maintained and do not use a locking mechanism at all.

What do you think about replacing the library?

Best regards
Philipp

Do you think you could make it syntax compatible with the existing ? IE so it wouldn't break existing users ? If so then I don't see a problem.

After first view over pigpio-client the changes should be doable without breaking the user interface/settings.
So i will start with the changes.
Best regards
Philipp

1 Like

Hi there. I came to the same conclusion about the library change and was about to start working on it when I saw this trail. Did you get anywhere? We've had another discussion about PWM frequency at https://discourse.nodered.org/t/raspberry-gpio-pwm-frequency-wrong/3474

Hi Steven,
i started porting the node to the new library and i got it working in general for some time now.
I only have some open points regarding the error handling.
This doesn't work in some cases. Need to test them all and fix the remaining/not working ones.
I will have some time on the weekend and i will have a look into it.
Best regards
Philipp

1 Like

Hi Philipp,
thanks for that. I've already got the input node working with the new library, except for some of the error reporting ... that looked like a smaller task the the output node, although it is output that I really want to change. I had hoped to get some more done on it at the weekend, but life intervened. I'm happy to share what I've done so far via github to see if we're working along the same lines.

Regards,

  Steven

Hi Steven,
oh i forgot to add a link to the current state. The branch lib_change_pwm_freq is the one with borh the lib change and the setting of the pwm frequency and is the one i‘m testing with.

This works good in normal case. I have to test all error cases. E.g. pigpio doesn‘t respond(turned off), remote host doesn‘t respond at all,...

I did get my setup working at the weekend but didn‘t get further with the error handling.

Best regards
Philipp

1 Like

Hi @Psykoman1990,
did you get anywhere with this?
I'm, looking to use advanced features of pigpiod (like notifications for multiple GPIs with tick - so that I can accurately get wheel encoder inputs).
The node client libraries I've found that seem to suit are
GitHub - guymcswain/pigpio-client: A nodejs client for pigpio socket interface. - simpler.
and
GitHub - satoren/node-pigpio - comprehensive but seemingly little adopted.

br,
Simon