Harden the logic which allows exposures at arbitrary exposure times. A "pause" variable has been added to the frame state that tracks when the frame is intentionally paused, preventing the premature pausing of a single frame.
This commit is contained in:
parent
ef77ecce83
commit
243f45c836
|
@ -42,6 +42,7 @@ intval.init = function () {
|
|||
frame : {
|
||||
start : 0, //time frame started, timestamp
|
||||
active : false, //should frame be running
|
||||
paused : false,
|
||||
time : 0, //length of frame, in ms
|
||||
delay : 0, //delay before start of frame, in ms
|
||||
open : 300, //delay before pausing frame in open state
|
||||
|
@ -121,6 +122,7 @@ intval._startBwd = function () {
|
|||
intval._pause = function () {
|
||||
intval._pin.fwd.writeSync(0)
|
||||
intval._pin.fwd.writeSync(0)
|
||||
intval._state.micro.paused = true
|
||||
}
|
||||
/**
|
||||
* Stop motor by setting both motor pins to 0 (LOW)
|
||||
|
@ -167,7 +169,7 @@ intval._watchMicro = function (err, val) {
|
|||
log.info('Microswitch primed to stop motor')
|
||||
}
|
||||
} else if (val === 1 && intval._state.frame.active) {
|
||||
if (intval._state.micro.primed) {
|
||||
if (intval._state.micro.primed && !intval._state.micro.paused) {
|
||||
intval._state.micro.primed = false
|
||||
intval._state.micro.time = 0
|
||||
//setTimeout( () => {
|
||||
|
@ -289,12 +291,15 @@ intval.frame = function (dir = null, time = null) {
|
|||
setTimeout(intval._pause, intval._state.frame.open)
|
||||
if (dir) {
|
||||
log.info('frame', { pausing : time - intval._state.frame.open })
|
||||
setTimeout(() => {
|
||||
log.info('frame', 'restarting after pause')
|
||||
setTimeout( () => {
|
||||
intval._state.frame.paused = false
|
||||
intval._startFwd()
|
||||
}, time - intval._state.frame.open)
|
||||
} else {
|
||||
setTimeout(intval._startBwd, time - intval._state.frame.open)
|
||||
setTimeout( () => {
|
||||
intval._state.frame.paused = false
|
||||
intval._startBwd()
|
||||
}, time - intval._state.frame.open)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue