From bb41526516b7c15afe0ae386fb3681ae9e1920bf Mon Sep 17 00:00:00 2001 From: mmcw-dev Date: Fri, 22 Dec 2017 15:28:47 -0500 Subject: [PATCH] Intval.reset() instead of intval._setState() --- lib/intval/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/intval/index.js b/lib/intval/index.js index 287fd3c..cc8a6b4 100644 --- a/lib/intval/index.js +++ b/lib/intval/index.js @@ -51,6 +51,10 @@ intval._release = { intval._microDelay = 10 // delay after stop signal before stopping motors intval._pin = {} +/** + * + */ + intval.init = function () { if (!fs.existsSync('./state')) fs.mkdirSync('./state') storage.init({ @@ -66,7 +70,7 @@ intval.init = function () { forgiveParseErrors: false // [NEW] }).then(intval._restoreState).catch((err) => { log.warn('init', err) - intval._setState() + intval.reset() intval._declarePins() }) @@ -75,7 +79,6 @@ intval.init = function () { } intval._restoreState = function (res) { - //console.dir(res) storage.getItem('_state', 'test').then(intval._setState).catch((err) => { intval._setState(undefined) log.error('_restoreState', err) @@ -308,7 +311,7 @@ intval._releaseClosedState = function (now) { } intval.reset = function () { - intval._setState(undefined) + intval._setState() intval._storeState() }