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:
parent
eae8e50cf8
commit
42580c46b9
|
@ -279,16 +279,19 @@ mobile.sequence = function () {
|
||||||
const opts = {
|
const opts = {
|
||||||
type : 'sequence'
|
type : 'sequence'
|
||||||
};
|
};
|
||||||
|
const elem = document.getElementById('seq');
|
||||||
if (!mobile.ble.connected) {
|
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,
|
ble.write(mobile.ble.device.id,
|
||||||
mobile.ble.SERVICE_ID,
|
mobile.ble.SERVICE_ID,
|
||||||
mobile.ble.CHAR_ID,
|
mobile.ble.CHAR_ID,
|
||||||
stringToBytes(JSON.stringify(opts)), //check length?
|
stringToBytes(JSON.stringify(opts)), //check length?
|
||||||
mobile.frameSuccess,
|
mobile.sequenceSuccess,
|
||||||
mobile.ble.onError);
|
mobile.ble.onError);
|
||||||
document.getElementById('seq').classList.add('focus');
|
if (!elem.classList.contains('focus')) {
|
||||||
|
elem.classList.add('focus');
|
||||||
|
}
|
||||||
mobile.ble.active = true;
|
mobile.ble.active = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -306,6 +309,7 @@ mobile.sequenceSuccess = function () {
|
||||||
}, 20);
|
}, 20);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//retreive object with list of available Wifi APs,
|
//retreive object with list of available Wifi APs,
|
||||||
//and state of current connection, if available
|
//and state of current connection, if available
|
||||||
mobile.getWifi = function () {
|
mobile.getWifi = function () {
|
||||||
|
|
2
index.js
2
index.js
|
@ -37,6 +37,7 @@ function createServer () {
|
||||||
app.post('/frame', rFrame)
|
app.post('/frame', rFrame)
|
||||||
app.get( '/sequence', rSequence)
|
app.get( '/sequence', rSequence)
|
||||||
app.post('/sequence', rSequence)
|
app.post('/sequence', rSequence)
|
||||||
|
|
||||||
app.post('/reset', rReset)
|
app.post('/reset', rReset)
|
||||||
app.get( '/status', rStatus)
|
app.get( '/status', rStatus)
|
||||||
app.listen(PORT, () => {
|
app.listen(PORT, () => {
|
||||||
|
@ -54,7 +55,6 @@ function createBLE () {
|
||||||
ble.on('delay', bDelay)
|
ble.on('delay', bDelay)
|
||||||
ble.on('counter', bCounter)
|
ble.on('counter', bCounter)
|
||||||
ble.on('sequence', bSequence)
|
ble.on('sequence', bSequence)
|
||||||
ble.on('stop', bSequenceStop)
|
|
||||||
ble.on('reset', bReset)
|
ble.on('reset', bReset)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue