Push dev work to master #2

Merged
sixteenmillimeter merged 416 commits from dev into master 2018-07-19 15:29:02 +00:00
1 changed files with 6 additions and 3 deletions
Showing only changes of commit bb41526516 - Show all commits

View File

@ -51,6 +51,10 @@ intval._release = {
intval._microDelay = 10 // delay after stop signal before stopping motors intval._microDelay = 10 // delay after stop signal before stopping motors
intval._pin = {} intval._pin = {}
/**
*
*/
intval.init = function () { intval.init = function () {
if (!fs.existsSync('./state')) fs.mkdirSync('./state') if (!fs.existsSync('./state')) fs.mkdirSync('./state')
storage.init({ storage.init({
@ -66,7 +70,7 @@ intval.init = function () {
forgiveParseErrors: false // [NEW] forgiveParseErrors: false // [NEW]
}).then(intval._restoreState).catch((err) => { }).then(intval._restoreState).catch((err) => {
log.warn('init', err) log.warn('init', err)
intval._setState() intval.reset()
intval._declarePins() intval._declarePins()
}) })
@ -75,7 +79,6 @@ intval.init = function () {
} }
intval._restoreState = function (res) { intval._restoreState = function (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('_restoreState', err) log.error('_restoreState', err)
@ -308,7 +311,7 @@ intval._releaseClosedState = function (now) {
} }
intval.reset = function () { intval.reset = function () {
intval._setState(undefined) intval._setState()
intval._storeState() intval._storeState()
} }