Set state if invalid. Hopefully it overwrites?
This commit is contained in:
parent
ec156fc8b6
commit
64440f7c1c
|
@ -66,9 +66,7 @@ intval.init = function () {
|
||||||
forgiveParseErrors: false // [NEW]
|
forgiveParseErrors: false // [NEW]
|
||||||
}).then(intval._restoreState).catch((err) => {
|
}).then(intval._restoreState).catch((err) => {
|
||||||
log.error('init', err)
|
log.error('init', err)
|
||||||
console.dir(fs.rmdirSync('./state'))
|
return intval._setState()
|
||||||
log.warn('Restarting')
|
|
||||||
return process.exit(1)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
process.on('SIGINT', intval._undeclarePins)
|
process.on('SIGINT', intval._undeclarePins)
|
||||||
|
@ -79,7 +77,7 @@ intval._restoreState = function (res) {
|
||||||
//console.dir(res)
|
//console.dir(res)
|
||||||
storage.getItem('_state', 'test').then(intval._setState).catch((err) => {
|
storage.getItem('_state', 'test').then(intval._setState).catch((err) => {
|
||||||
intval._setState(undefined)
|
intval._setState(undefined)
|
||||||
log.error('init', err)
|
log.error('_restoreState', err)
|
||||||
})
|
})
|
||||||
intval._declarePins()
|
intval._declarePins()
|
||||||
}
|
}
|
||||||
|
@ -91,6 +89,7 @@ intval._setState = function (data) {
|
||||||
log.info('_setState', 'Restored intval state from disk')
|
log.info('_setState', 'Restored intval state from disk')
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
log.info('_setState', 'Setting state from defaults')
|
||||||
intval._state = {
|
intval._state = {
|
||||||
frame : {
|
frame : {
|
||||||
dir : true, //forward
|
dir : true, //forward
|
||||||
|
|
Loading…
Reference in New Issue