Skip to content

Commit

Permalink
fix(Gpio): Change restarting timer to only starting when the signal i…
Browse files Browse the repository at this point in the history
…s low
  • Loading branch information
ovaar committed Dec 30, 2019
1 parent 4db76c8 commit 70faaec
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/gpio-proximity.ts
Expand Up @@ -33,11 +33,13 @@ export default class SignalProximity extends EventEmitter {

this.emit('change')
debug(`GPIO=${value}`)
if (!this.isTriggered) {
if (value === 1) {
this.emit('begin')
this.isTriggered = true
this.timer.stop()
} else {
this.timer.start()
}
this.isTriggered = true
this.timer.restart()
}

public stop() {
Expand Down

0 comments on commit 70faaec

Please sign in to comment.