Intval.reset() instead of intval._setState()
This commit is contained in:
parent
58c01c4108
commit
bb41526516
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue