From e1d2eea88271aa0c0638b08b366bf1ca3dfc806c Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Wed, 15 Jan 2020 20:40:37 +0100 Subject: [PATCH] Prefer abandonware i2c Change-Id: Ifc2df3f9567f85d21c121c0bcc129b72e7d3f895 Forwarded: https://github.com/bbx10/node-htu21d/pull/3 Relate-to: https://github.com/kelly/node-i2c/issues/97 Signed-off-by: Philippe Coval --- index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 79c1133..ca26fbb 100644 --- a/index.js +++ b/index.js @@ -22,8 +22,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -var i2c = require('i2c'); var fs=require('fs'); +var i2c = null; +try { + i2c = require('@abandonware/i2c'); +} catch(err) { + i2c = require('i2c'); +} var MAX_TEMP_CONVERSION = 50; // milliseconds var MAX_HUMI_CONVERSION = 16; // ms