Add logic to prevent frames shorter than 250ms. Might work for now. Seemingly only happening with web requests?

This commit is contained in:
mmcw-dev 2017-10-21 19:31:52 -04:00
parent c2f372c7fe
commit da3908c2e5
1 changed files with 4 additions and 4 deletions

View File

@ -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)