minor changes

master
David Kebler 2017-01-22 17:36:41 -08:00
parent 87fdcd0df8
commit ff72b670ab
2 changed files with 6 additions and 4 deletions

View File

@ -19,7 +19,7 @@ class Interrupt extends EventEmitter {
this.hook = opts.hook // will be passed back with the emit this.hook = opts.hook // will be passed back with the emit
this.path = GPIO_ROOT_PATH + 'gpio' + this.num + '/' this.path = GPIO_ROOT_PATH + 'gpio' + this.num + '/'
this.edge = opts.edge ? opts.edge : 'falling' 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.dbt = opts.debounce ? opts.debounce : 300
this.poller = new Epoll( this.poller = new Epoll(
debounce((err, fd, events) => { 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 fs.writeFile(GPIO_ROOT_PATH + 'export', this.num).then(() => { console.log('exported') }) },
() => { () => {
return pWaitFor(() => pathExists(this.path + 'direction')).then(_.pDelay(this.delay)) 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 fs.open(this.path + 'value', 'r+').then(fd => { this.valuefd = fd }) },
() => { return this.clear().then(() => { return this.start() }) } () => { return this.clear().then(() => { return this.start() }) }
] ]

View File

@ -4,9 +4,10 @@
"description": "a class for adding interrupt processesing via sysfs and gpio pins on Raspberry and similar", "description": "a class for adding interrupt processesing via sysfs and gpio pins on Raspberry and similar",
"main": "index.js", "main": "index.js",
"watch": { "watch": {
"testw": "{lib,test}/*.js" "testi": "{lib,test}/*.js"
}, },
"scripts": { "scripts": {
"testi": "node test/interrupt.test.js",
"testw": "./node_modules/.bin/mocha --reporter list --recursive ", "testw": "./node_modules/.bin/mocha --reporter list --recursive ",
"test": "istanbul cover ./node_modules/.bin/_mocha test/ --report lcovonly -- -R spec --recursive && codecov || true", "test": "istanbul cover ./node_modules/.bin/_mocha test/ --report lcovonly -- -R spec --recursive && codecov || true",
"watch": "./node_modules/.bin/npm-watch" "watch": "./node_modules/.bin/npm-watch"