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