Push dev work to master #2

Merged
sixteenmillimeter merged 416 commits from dev into master 2018-07-19 15:29:02 +00:00
2 changed files with 40 additions and 4 deletions
Showing only changes of commit d7ca2ebe46 - Show all commits

View File

@ -120,9 +120,45 @@ function rDelay (req, res, next) {
} }
function rFrame (req, res, next) { function rFrame (req, res, next) {
log.info('/frame', { method : req.method }) let dir = true
intval.frame(true, 0, (dir, len) => { let exposure = 0
res.send({ dir : true, len : len}) if (intval._state.frame.dir !== true) {
dir = false
}
if (intval._state.frame.exposure !== 0) {
exposure = intval._state.frame.exposure
}
if (req.query && typeof req.query.dir !== 'undefined') {
if (typeof req.query.dir === 'string') {
dir = (req.query.dir === 'true')
} else {
dir = req.query.dir
}
}
if (req.body && typeof req.body.dir !== 'undefined') {
if (typeof req.body.dir === 'string') {
dir = (req.body.dir === 'true')
} else {
dir = req.body.dir
}
}
if (req.query && typeof req.query.exposure !== 'undefined') {
if (typeof req.query.exposure === 'string') {
exposure = parseInt(req.query.exposure)
} else {
exposure = req.query.exposure
}
}
if (req.body && typeof req.body.exposure !== 'undefined') {
if (typeof req.body.exposure === 'string') {
exposure = parseInt(req.body.exposure)
} else {
exposure = req.body.exposure
}
}
log.info('/frame', { method : req.method, dir : dir, exposure : exposure })
intval.frame(dir, exposure, (len) => {
res.send({ dir : dir, len : len})
return next() return next()
}) })
} }

View File

@ -314,7 +314,7 @@ intval.frame = function (dir = null, time = null, cb = () => {}) {
} }
} }
intval._state.frame.cb = (len) => { intval._state.frame.cb = (len) => {
cb(dir, len) cb(len)
} }
} }
/** /**