diff --git a/app/www/static/js/intval.mobile.js b/app/www/static/js/intval.mobile.js index ef002e1..b7f33e5 100644 --- a/app/www/static/js/intval.mobile.js +++ b/app/www/static/js/intval.mobile.js @@ -279,16 +279,19 @@ mobile.sequence = function () { const opts = { type : 'sequence' }; + const elem = document.getElementById('seq'); if (!mobile.ble.connected) { - return alert('Not connected to an INTVAL device.'); + return alert('Not connected to an INTVAL3 device.'); } ble.write(mobile.ble.device.id, mobile.ble.SERVICE_ID, mobile.ble.CHAR_ID, stringToBytes(JSON.stringify(opts)), //check length? - mobile.frameSuccess, + mobile.sequenceSuccess, mobile.ble.onError); - document.getElementById('seq').classList.add('focus'); + if (!elem.classList.contains('focus')) { + elem.classList.add('focus'); + } mobile.ble.active = true; }; @@ -306,6 +309,7 @@ mobile.sequenceSuccess = function () { }, 20); }; + //retreive object with list of available Wifi APs, //and state of current connection, if available mobile.getWifi = function () { diff --git a/index.js b/index.js index 9abde59..2ac5532 100644 --- a/index.js +++ b/index.js @@ -37,6 +37,7 @@ function createServer () { app.post('/frame', rFrame) app.get( '/sequence', rSequence) app.post('/sequence', rSequence) + app.post('/reset', rReset) app.get( '/status', rStatus) app.listen(PORT, () => { @@ -54,7 +55,6 @@ function createBLE () { ble.on('delay', bDelay) ble.on('counter', bCounter) ble.on('sequence', bSequence) - ble.on('stop', bSequenceStop) ble.on('reset', bReset) }