Achronite / energenie-ener314rt

Node module for RaspberryPi energenie ener314-rt board, used by node-red-contrib-energenie-ener314rt
MIT License
4 stars 2 forks source link

Replace all exit() calls with return values instead #8

Closed Achronite closed 4 years ago

Achronite commented 4 years ago

@whaleygeek's original code uses 'exit' to bomb out when there are hardware errors. This is not appropriate within the context of node.js, we should be returning values via the C calls instead, so appropriate action can be taken.

For example in gpio_rpi.c, gpio_init().

whaleygeek commented 4 years ago

Yes, noted. I did this with the other modules I think (return codes in radio etc), but the gpio was imported from a different project and I never did that. It's on the list, thanks for logging it.

Achronite commented 4 years ago

It's because I'm trying to get this working with home-assistant (hass.io) via the node-red support. I'm having difficult getting the radio version. I suspect it may be due to either gpio being locked down, or that the gpio device may be different in the underlying O/S, hence the need to return the status code.

Achronite commented 4 years ago

@whaleygeek fixed in my code base if you want a look :)