Set delay from ble

This commit is contained in:
mmcwilliams 2017-12-13 16:22:22 -05:00
parent 7fc84a3f14
commit 2a28b622f0
1 changed files with 18 additions and 1 deletions

View File

@ -48,6 +48,7 @@ function createBLE () {
ble.on('frame', bFrame)
ble.on('dir', bDir)
ble.on('exposure', bExposure)
ble.on('delay', bDelay)
}
//Restify functions
@ -312,7 +313,7 @@ function bFrame (obj, cb) {
/*intval.frame(dir, exposure, (len) => {
return cb()
})*/
setTimeout(cb, 630)
setTimeout(cb, exposure === 0 ? 630 : exposure)
}
function bDir (obj, cb) {
@ -344,6 +345,22 @@ function bExposure (obj, cb) {
return cb()
}
function bDelay (obj, cb) {
let delay = 0
let set = false
if (typeof obj.delay !== 'undefined') {
if (typeof obj.delay === 'string') {
delay = parseInt(obj.delay)
} else {
delay = obj.delay
}
set = true
}
intval.setDelay(delay)
log.info('delay', { method: 'ble', delay : delay })
return cb()
}
function index (req, res, next) {
fs.readFile(INDEXPATH, 'utf8', (err, data) => {
if (err) {