Two birds, one commit. Can even pull out the bad logic of the light.state.on value, but that's not hurting anybody.

This commit is contained in:
mmcwilliams 2019-02-13 18:49:59 -05:00
parent ed8f1add35
commit e7ac873f41
1 changed files with 15 additions and 8 deletions

View File

@ -554,11 +554,10 @@ dig.move = async function () {
if (dig.state.frame < 1) { if (dig.state.frame < 1) {
dig.state.frame = 1 dig.state.frame = 1
} }
return (+new Date()) - start
if (last > 0) {
display.end()
} }
dig.start = async function () {
try { try {
await ffmpeg.clearAll() await ffmpeg.clearAll()
} catch (err) { } catch (err) {
@ -572,10 +571,12 @@ dig.move = async function () {
} }
display.start(dig.state.frame) display.start(dig.state.frame)
await delay(20)
}
await delay(600) dig.end = async function () {
await delay(20)
return (+new Date()) - start display.end()
} }
cam.intval = null cam.intval = null
@ -614,11 +615,14 @@ cam.set = async function (dir, id) {
cam.move = async function (frame, id) { cam.move = async function (frame, id) {
const cmd = mcopy.cfg.arduino.cmd.camera const cmd = mcopy.cfg.arduino.cmd.camera
let ms let ms
if (proj.digital) {
await dig.start()
}
if (cam.intval) { if (cam.intval) {
try { try {
ms = await cam.intval.move() ms = await cam.intval.move()
} catch (err) { } catch (err) {
console.error(err); console.error(err)
} }
} else { } else {
try { try {
@ -627,6 +631,9 @@ cam.move = async function (frame, id) {
console.error(err) console.error(err)
} }
} }
if (proj.digital) {
await dig.end()
}
log.info('Camera move time', { ms }) log.info('Camera move time', { ms })
return cam.end(cmd, id, ms) return cam.end(cmd, id, ms)
} }