Sequence feature for bluetooth control does NOT need to be split (yet) into start and stop. intval.mobile.js was using the incorrect callback on the sequence characteristic and should be tested before changes are made.

This commit is contained in:
mmcwilliams 2018-02-07 18:38:19 -05:00
parent eae8e50cf8
commit 42580c46b9
2 changed files with 8 additions and 4 deletions

View File

@ -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 () {

View File

@ -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)
}