diff --git a/lib/intval/index.js b/lib/intval/index.js index 06219b1..fa27623 100644 --- a/lib/intval/index.js +++ b/lib/intval/index.js @@ -162,7 +162,7 @@ intval._stop = function () { * */ intval._watchMicro = function (err, val) { - const NOW = +new Date() + const now = +new Date() if (err) { log.error('_watchMicro', err) } @@ -171,13 +171,13 @@ intval._watchMicro = function (err, val) { if (val === 0 && intval._state.frame.active) { if (!intval._state.micro.primed) { intval._state.micro.primed = true - intval._state.micro.exposure = NOW + intval._state.micro.time = now //log.info('Microswitch primed to stop motor') } } else if (val === 1 && intval._state.frame.active) { - if (intval._state.micro.primed && !intval._state.micro.paused) { + if (intval._state.micro.primed && !intval._state.micro.paused && (now - intval._state.frame.start) > intval._frame.open) { intval._state.micro.primed = false - intval._state.micro.exposure = 0 + intval._state.micro.time = 0 //setTimeout( () => { intval._stop() //}, intval._microDelay)