From 1215360bbaa4956e9c79e137939f63bdc2745197 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Wed, 15 Jan 2020 20:40:37 +0100 Subject: [PATCH] lib: Prefer abandonware i2c Legacy i2c will be used by IoT.js runtime 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 e4d706a..81a53ed 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