Push dev work to master #2

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

View File

@ -47,6 +47,7 @@ function createBLE () {
}) })
ble.on('frame', bFrame) ble.on('frame', bFrame)
ble.on('dir', bDir) ble.on('dir', bDir)
ble.on('exposure', bExposure)
} }
//Restify functions //Restify functions
@ -300,8 +301,12 @@ function bFrame (obj, cb) {
dir = obj.dir dir = obj.dir
} }
} }
if (typeof obj.dir !== 'undefined') { if (typeof obj.exposure !== 'undefined') {
exposure if (typeof obj.exposure === 'string') {
exposure = parseInt(obj.exposure)
} else {
exposure = obj.exposure
}
} }
log.info('frame', { method : 'ble', dir : dir, exposure : exposure }) log.info('frame', { method : 'ble', dir : dir, exposure : exposure })
/*intval.frame(dir, exposure, (len) => { /*intval.frame(dir, exposure, (len) => {
@ -325,6 +330,20 @@ function bDir (obj, cb) {
cb() cb()
} }
function bExposure (obj, cb) {
let exposure = 0
if (typeof obj.exposure !== 'undefined') {
if (typeof obj.exposure === 'string') {
exposure = parseInt(obj.exposure)
} else {
exposure = req.body.exposure
}
}
intval.setExposure(exposure)
log.info('exposure', { method: 'ble', exposure : exposure })
return cb()
}
function index (req, res, next) { function index (req, res, next) {
fs.readFile(INDEXPATH, 'utf8', (err, data) => { fs.readFile(INDEXPATH, 'utf8', (err, data) => {
if (err) { if (err) {