Pull delay setting out of the _state.frame object into the _state object. Ugh this is such a mess.
This commit is contained in:
parent
d566c2160b
commit
3667c8dd36
25
index.js
25
index.js
|
@ -149,7 +149,7 @@ function rDelay (req, res, next) {
|
|||
if (set) {
|
||||
intval.setDelay(delay)
|
||||
} else {
|
||||
delay = intval._state.frame.delay
|
||||
delay = intval._state.delay
|
||||
}
|
||||
log.info('/delay', { method: req.method, set : set, delay : delay })
|
||||
res.send({ delay : delay })
|
||||
|
@ -222,20 +222,7 @@ async function rFrame (req, res, next) {
|
|||
exposure = req.body.exposure
|
||||
}
|
||||
}
|
||||
if (req.query && typeof req.query.delay !== 'undefined') {
|
||||
if (typeof req.query.delay === 'string') {
|
||||
delay = parseInt(req.query.delay)
|
||||
} else {
|
||||
delay = req.query.delay
|
||||
}
|
||||
}
|
||||
if (req.body && typeof req.body.delay !== 'undefined') {
|
||||
if (typeof req.body.delay === 'string') {
|
||||
delay = parseInt(req.body.delay)
|
||||
} else {
|
||||
delay = req.body.delay
|
||||
}
|
||||
}
|
||||
|
||||
log.info('/frame', { method : req.method, dir : dir, exposure : exposure })
|
||||
|
||||
if (exposure < 30000) {
|
||||
|
@ -265,8 +252,8 @@ async function rSequence (req, res, next) {
|
|||
if (intval._state.frame.exposure !== 0) {
|
||||
exposure = intval._state.frame.exposure
|
||||
}
|
||||
if (intval._state.frame.delay !== 0) {
|
||||
delay = intval._state.frame.delay
|
||||
if (intval._state.delay !== 0) {
|
||||
options.delay = intval._state.delay
|
||||
}
|
||||
|
||||
if (req.query && typeof req.query.dir !== 'undefined') {
|
||||
|
@ -508,8 +495,8 @@ function bSequence (obj, cb) {
|
|||
if (intval._state.frame.exposure !== 0) {
|
||||
exposure = intval._state.frame.exposure
|
||||
}
|
||||
if (intval._state.frame.delay !== 0) {
|
||||
delay = intval._state.frame.delay
|
||||
if (intval._state.delay !== 0) {
|
||||
delay = intval._state.delay
|
||||
}
|
||||
|
||||
if (typeof obj.dir !== 'undefined') {
|
||||
|
|
|
@ -142,10 +142,10 @@ class Intval {
|
|||
active: false,
|
||||
paused: false,
|
||||
exposure: 0,
|
||||
delay: 0,
|
||||
current: {},
|
||||
cb: () => { }
|
||||
},
|
||||
delay: 0,
|
||||
counter: 0,
|
||||
sequence: false
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -55,13 +55,13 @@ class Sequence {
|
|||
if (multiple > 1) {
|
||||
for (let x = 0; x < multiple; x++) {
|
||||
await this.intval.frame();
|
||||
log.info('start', { id: this.id, count: this.count });
|
||||
log.info('frame', { id: this.id, count: this.count });
|
||||
this.count++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
await this.intval.frame();
|
||||
log.info('start', { id: this.id, count: this.count });
|
||||
log.info('frame', { id: this.id, count: this.count });
|
||||
this.count++;
|
||||
}
|
||||
if (this.delay > 0 && i < len - 1) {
|
||||
|
|
|
@ -177,10 +177,10 @@ export default class Intval {
|
|||
active : false, //should frame be running
|
||||
paused : false,
|
||||
exposure : 0, //length of frame exposure, in ms
|
||||
delay : 0, //delay before start of frame, in ms
|
||||
current : {}, //current settings
|
||||
current : {}, //current settings
|
||||
cb : () => {}
|
||||
},
|
||||
delay : 0, //delay before start of frame, in ms
|
||||
counter : 0,
|
||||
sequence : false
|
||||
}
|
||||
|
@ -505,21 +505,14 @@ export default class Intval {
|
|||
this._state.frame.paused = true;
|
||||
if (dir) {
|
||||
await delay(this._frame.open)
|
||||
|
||||
this._pause()
|
||||
|
||||
await delay(exposure + this._frame.closed)
|
||||
|
||||
this._state.frame.paused = false
|
||||
this._startFwd()
|
||||
} else {
|
||||
|
||||
await delay(this._frame.openBwd)
|
||||
|
||||
this._pause()
|
||||
|
||||
await delay(exposure + this._frame.closed)
|
||||
|
||||
this._state.frame.paused = false;
|
||||
this._startBwd()
|
||||
}
|
||||
|
|
|
@ -68,12 +68,12 @@ export class Sequence {
|
|||
if (multiple > 1) {
|
||||
for (let x = 0; x < multiple; x++) {
|
||||
await this.intval.frame()
|
||||
log.info('start', { id : this.id, count : this.count })
|
||||
log.info('frame', { id : this.id, count : this.count })
|
||||
this.count++
|
||||
}
|
||||
} else {
|
||||
await this.intval.frame()
|
||||
log.info('start', { id : this.id, count : this.count })
|
||||
log.info('frame', { id : this.id, count : this.count })
|
||||
this.count++
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue