Unexport buttons on uncaught exception
This commit is contained in:
parent
a0729ff9d9
commit
32625bbbde
|
@ -43,6 +43,9 @@ class Intval {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._declarePins()
|
this._declarePins()
|
||||||
|
process.on('SIGINT', () => {
|
||||||
|
this._undeclarePins()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
_declarePins () {
|
_declarePins () {
|
||||||
this._pin.fwd = Gpio(4, 'out')
|
this._pin.fwd = Gpio(4, 'out')
|
||||||
|
@ -52,6 +55,12 @@ class Intval {
|
||||||
|
|
||||||
this._pin.release.watch(this._watchRelease)
|
this._pin.release.watch(this._watchRelease)
|
||||||
}
|
}
|
||||||
|
_undeclarePins () {
|
||||||
|
this._pin.fwd.unexport()
|
||||||
|
this._pin.bwd.unexport()
|
||||||
|
this._pin.micro.unexport()
|
||||||
|
this._pin.release.unexport()
|
||||||
|
}
|
||||||
_startFwd () {
|
_startFwd () {
|
||||||
this._pin.fwd.set(1)
|
this._pin.fwd.set(1)
|
||||||
this._pin.bwd.set(0)
|
this._pin.bwd.set(0)
|
||||||
|
|
Loading…
Reference in New Issue