From 32625bbbde0607f30295fdb23cbadca7f787f4c8 Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Sat, 16 Sep 2017 13:35:39 -0400 Subject: [PATCH] Unexport buttons on uncaught exception --- lib/intval/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/intval/index.js b/lib/intval/index.js index 8c7c6e1..cbf2e44 100644 --- a/lib/intval/index.js +++ b/lib/intval/index.js @@ -43,6 +43,9 @@ class Intval { } } this._declarePins() + process.on('SIGINT', () => { + this._undeclarePins() + }) } _declarePins () { this._pin.fwd = Gpio(4, 'out') @@ -52,7 +55,13 @@ class Intval { this._pin.release.watch(this._watchRelease) } - _startFwd () { + _undeclarePins () { + this._pin.fwd.unexport() + this._pin.bwd.unexport() + this._pin.micro.unexport() + this._pin.release.unexport() + } + _startFwd () { this._pin.fwd.set(1) this._pin.bwd.set(0) //start high-cpu watch