Push dev work to master #2
|
@ -124,8 +124,8 @@ intval._startBwd = function () {
|
||||||
intval._stop = function () {
|
intval._stop = function () {
|
||||||
intval._pin.fwd.writeSync(0)
|
intval._pin.fwd.writeSync(0)
|
||||||
intval._pin.bwd.writeSync(0)
|
intval._pin.bwd.writeSync(0)
|
||||||
|
const now = +new Date()
|
||||||
let len = (+new Date()) - intval._state.frame.start
|
const len = now - intval._state.frame.start
|
||||||
|
|
||||||
log.info(`Frame stopped ${len}ms`)
|
log.info(`Frame stopped ${len}ms`)
|
||||||
|
|
||||||
|
@ -158,14 +158,14 @@ intval._watchMicro = function (err, val) {
|
||||||
if (!intval._state.micro.primed) {
|
if (!intval._state.micro.primed) {
|
||||||
intval._state.micro.primed = true
|
intval._state.micro.primed = true
|
||||||
intval._state.micro.time = NOW
|
intval._state.micro.time = NOW
|
||||||
log.info('Mircoswitch primed to stop motor')
|
log.info('Microswitch primed to stop motor')
|
||||||
}
|
}
|
||||||
} else if (val === 1 && intval._state.frame.active) {
|
} else if (val === 1 && intval._state.frame.active) {
|
||||||
if (intval._state.micro.primed) {
|
if (intval._state.micro.primed) {
|
||||||
intval._state.micro.primed = false
|
intval._state.micro.primed = false
|
||||||
intval._state.micro.time = 0
|
intval._state.micro.time = 0
|
||||||
setTimeout( () => {
|
setTimeout( () => {
|
||||||
log.info(`Stopped frame after ${NOW - intval._state.micro.time}ms`)
|
intval._stop()
|
||||||
}, intval._microDelay)
|
}, intval._microDelay)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue