jdcaprace / signalk-raspberry-pi-ina219

SignalK node server plugin that reads data from ina219 current/voltage/power sensors on Raspberry-Pi
MIT License
4 stars 2 forks source link

Fixed fd leak, and indented #3

Open jakobdalsgaard opened 11 months ago

jakobdalsgaard commented 11 months ago

Basically moved this part:

const sensor = await ina219(Number(options.i2c_address), options.i2c_bus);
await sensor.calibrate32V2A();

outside the readina219 function to prevent filedescriptor leak -- also redid the catch statement.

Fixing this leak is essential for running SignalK for many weeks.