diff --git a/lib/interrupt.js b/lib/interrupt.js index 7d4516b..5cdb2dd 100644 --- a/lib/interrupt.js +++ b/lib/interrupt.js @@ -19,7 +19,7 @@ class Interrupt extends EventEmitter { this.hook = opts.hook // will be passed back with the emit this.path = GPIO_ROOT_PATH + 'gpio' + this.num + '/' this.edge = opts.edge ? opts.edge : 'falling' - this.delay = opts.delay ? opts.delay : 50 + this.delay = opts.delay ? opts.delay : 1000 this.dbt = opts.debounce ? opts.debounce : 300 this.poller = new Epoll( debounce((err, fd, events) => { @@ -34,9 +34,10 @@ class Interrupt extends EventEmitter { () => { return fs.writeFile(GPIO_ROOT_PATH + 'export', this.num).then(() => { console.log('exported') }) }, () => { return pWaitFor(() => pathExists(this.path + 'direction')).then(_.pDelay(this.delay)) - .then(() => { return fs.writeFile(this.path + 'direction', 'in').then(() => { console.log('direction set') }) }) + .then(() => { return fs.writeFile(this.path + 'direction', 'in').then(() => { console.log('direction', 'in') }) }) + //.then(() => { return fs.writeFile(this.path + 'value', 1).then(() => { console.log('pulled up') }) }) }, - () => { return fs.writeFile(this.path + 'edge', this.edge).then(() => { console.log('edge') }) }, + () => { return fs.writeFile(this.path + 'edge', this.edge).then(() => { console.log('edge', this.edge) }) }, () => { return fs.open(this.path + 'value', 'r+').then(fd => { this.valuefd = fd }) }, () => { return this.clear().then(() => { return this.start() }) } ] diff --git a/package.json b/package.json index 5556957..c8c9ae1 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,10 @@ "description": "a class for adding interrupt processesing via sysfs and gpio pins on Raspberry and similar", "main": "index.js", "watch": { - "testw": "{lib,test}/*.js" + "testi": "{lib,test}/*.js" }, "scripts": { + "testi": "node test/interrupt.test.js", "testw": "./node_modules/.bin/mocha --reporter list --recursive ", "test": "istanbul cover ./node_modules/.bin/_mocha test/ --report lcovonly -- -R spec --recursive && codecov || true", "watch": "./node_modules/.bin/npm-watch"