From 5833f42464b1f5d00afc7917db9bb568c9c2f10c Mon Sep 17 00:00:00 2001 From: David Kebler Date: Fri, 23 Feb 2018 13:44:40 -0800 Subject: [PATCH] removed the two default mcp sockets. Make them as needed instead. Now just pass i2c bus options through to i2c-device. updated all packages. --- package.json | 12 ++++++------ src/mcp230xx-packet.mjs | 17 ----------------- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 8ab5cbc..18f9d2e 100644 --- a/package.json +++ b/package.json @@ -33,12 +33,12 @@ }, "@std/esm": "cjs", "devDependencies": { - "@std/esm": "^0.20.0", - "chai": "^3.5.0", - "codecov": "^1.0.1", - "debug": "^2.6.8", + "@std/esm": "^0.22.0", + "chai": "^4.1.2", + "codecov": "^3.0.0", + "debug": "^3.1.0", "istanbul": "^0.4.5", - "mocha": "^3.4.2", - "nodemon": "^1.14.12" + "mocha": "^5.0.1", + "nodemon": "^1.15.1" } } diff --git a/src/mcp230xx-packet.mjs b/src/mcp230xx-packet.mjs index c4e370e..818a54d 100644 --- a/src/mcp230xx-packet.mjs +++ b/src/mcp230xx-packet.mjs @@ -17,14 +17,6 @@ const LOG_OPTS = (id) => { export default class MCP230XX extends Device { constructor(opts) { - if(opts.nmcp) { - if (typeof opts.nmcp.path!=='string') opts.nmcp = {path: (process.env.SOCKETS_DIR || __dirname) + '/mcp.sock'} - opts.sockets = (opts.sockets ? (opts.sockets+',') : '') + 'nmcp#s>n' - } - if(opts.tmcp) { - if (typeof opts.nmcp.port!=='number') opts.tmcp.port = 1776 - opts.sockets = (opts.sockets ? (opts.sockets+',') : '') + 'tmcp#s>t' - } super(opts) log = logger.child(LOG_OPTS(this.id)) if (!opts.address) log.fatal({opts:opts},'no i2c bus address supplied' ) @@ -36,18 +28,9 @@ export default class MCP230XX extends Device { async init(){ await super.init() - // let res = await this.chip.ack.bind(this)() // move this to device class - // if (!res.ack) throw `no device on this bus at address ${this.address}=0x${this.address.toString(16)}` let res = await this.chip.cfg({}) - // console.log(res) let cfg = this.chip17 ?'10100010':'00100010' if (res.response !==cfg ) throw `could not configure mcp chip at ${this.address}=0x${this.address.toString(16)}` } - - // this overwrites the default cmd 'reply' from the bus - reply (packet) { - // console.log(packet._header.request, packet.response) - } - } // end of MCP230XX Class