From b8787c0fac8c0c8eabf2da109afdb264b08334de Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Wed, 17 Jan 2018 15:58:55 -0500 Subject: [PATCH] If exposure if over 5000ms, call back from ble service immediately and block UI until frame is done. --- app/www/static/js/intval.mobile.js | 14 +++++++++++--- index.js | 15 +++++++++++++-- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/app/www/static/js/intval.mobile.js b/app/www/static/js/intval.mobile.js index 1b99792..c610fd2 100644 --- a/app/www/static/js/intval.mobile.js +++ b/app/www/static/js/intval.mobile.js @@ -171,9 +171,17 @@ mobile.frame = function () { mobile.frameSuccess = function () { console.log('Frame finished, getting state.'); - mobile.ble.active = false; - document.getElementById('frame').classList.remove('focus'); - mobile.getState(); + if (STATE.exposure < 5000) { + mobile.ble.active = false; + document.getElementById('frame').classList.remove('focus'); + mobile.getState(); + } else { + setTimeout(() => { + mobile.ble.active = false; + document.getElementById('frame').classList.remove('focus'); + mobile.getState(); + }, STATE.exposure + 500) + } } mobile.setDir = function () { const opts = { diff --git a/index.js b/index.js index 80fcbd8..2f7a3ca 100644 --- a/index.js +++ b/index.js @@ -363,9 +363,16 @@ function bFrame (obj, cb) { } } log.info('frame', { method : 'ble', dir : dir, exposure : exposure }) - intval.frame(dir, exposure, (len) => { + + if (exposure < 5000) { + intval.frame(dir, exposure, (len) => { + return cb() + }) + } else { + intval.frame(dir, exposure, (len) => {}) return cb() - }) + } + //setTimeout(cb, exposure === 0 ? 630 : exposure) } @@ -485,6 +492,10 @@ function bSequence (obj, cb) { } } +function bSequenceStop (obj, cb) { + +} + function bReset (obj, cb) { intval.reset() setTimeout(cb, 10)