Skip to content

Commit baa43a2

Browse files
committed
Set timeout impedance-start/stop to 2 seconds
Fixes OpenBCI/OpenBCI_GUI#421
1 parent ae27815 commit baa43a2

File tree

3 files changed

+63
-50
lines changed

3 files changed

+63
-50
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# v2.0.9
2+
3+
### Bug Fixes
4+
5+
- Fix BLED112 Impedance check by allowing 2 seconds for command/success OpenBCI/OpenBCI_GUI#421
6+
17
# v2.0.8
28

39
### Bug Fixes

app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "openbci-electron-hub",
33
"productName": "OpenBCIHub",
44
"description": "OpenBCIHub",
5-
"version": "2.0.8",
5+
"version": "2.0.9",
66
"author": "AJ Keller <hello@pushtheworld.us>",
77
"copyright": "© 2019, OpenBCI inc.",
88
"homepage": "http://openbci.com",

src/background.js

Lines changed: 56 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,61 +1512,68 @@ const _processImpedanceCyton = (msg, client) => {
15121512
const _processImpedanceGanglion = (msg, client) => {
15131513
switch (msg.action) {
15141514
case kTcpActionStart:
1515-
ganglionBLE
1516-
.impedanceStart()
1517-
.then(() => {
1518-
ganglionBLE.on(
1519-
k.OBCIEmitterImpedance,
1520-
impedanceFunction.bind(null, client)
1521-
);
1522-
writeCodeToClientOfType(
1523-
client,
1524-
kTcpTypeImpedance,
1525-
kTcpCodeSuccess,
1526-
{
1527-
action: kTcpActionStart
1528-
}
1529-
);
1530-
})
1531-
.catch(err => {
1532-
writeCodeToClientOfType(
1533-
client,
1534-
kTcpTypeImpedance,
1535-
kTcpCodeErrorImpedanceCouldNotStart,
1536-
{
1537-
message: err.message
1538-
}
1539-
);
1540-
});
1515+
setTimeout(() => {
1516+
console.log('start impedance check');
1517+
ganglionBLE
1518+
.impedanceStart()
1519+
.then(() => {
1520+
ganglionBLE.on(
1521+
k.OBCIEmitterImpedance,
1522+
impedanceFunction.bind(null, client)
1523+
);
1524+
writeCodeToClientOfType(
1525+
client,
1526+
kTcpTypeImpedance,
1527+
kTcpCodeSuccess,
1528+
{
1529+
action: kTcpActionStart
1530+
}
1531+
);
1532+
})
1533+
.catch(err => {
1534+
writeCodeToClientOfType(
1535+
client,
1536+
kTcpTypeImpedance,
1537+
kTcpCodeErrorImpedanceCouldNotStart,
1538+
{
1539+
message: err.message
1540+
}
1541+
);
1542+
});
1543+
}, 2000);
15411544
break;
15421545
case kTcpActionStop:
1543-
ganglionBLE
1544-
.impedanceStop()
1545-
.then(() => {
1546-
ganglionBLE.removeAllListeners(k.OBCIEmitterImpedance);
1547-
writeCodeToClientOfType(
1548-
client,
1549-
kTcpTypeImpedance,
1550-
kTcpCodeSuccess,
1551-
{
1552-
action: kTcpActionStop
1553-
}
1554-
);
1555-
})
1556-
.catch(err => {
1557-
writeCodeToClientOfType(
1558-
client,
1559-
kTcpTypeImpedance,
1560-
kTcpCodeErrorImpedanceCouldNotStop,
1561-
{
1562-
message: err.message
1563-
}
1564-
);
1565-
});
1546+
setTimeout(() => {
1547+
console.log('stop impedance check');
1548+
ganglionBLE
1549+
.impedanceStop()
1550+
.then(() => {
1551+
ganglionBLE.removeAllListeners(k.OBCIEmitterImpedance);
1552+
writeCodeToClientOfType(
1553+
client,
1554+
kTcpTypeImpedance,
1555+
kTcpCodeSuccess,
1556+
{
1557+
action: kTcpActionStop
1558+
}
1559+
);
1560+
})
1561+
.catch(err => {
1562+
writeCodeToClientOfType(
1563+
client,
1564+
kTcpTypeImpedance,
1565+
kTcpCodeErrorImpedanceCouldNotStop,
1566+
{
1567+
message: err.message
1568+
}
1569+
);
1570+
});
1571+
}, 2000);
15661572
break;
15671573
}
15681574
};
15691575

1576+
15701577
const _processImpedanceWifi = (msg, client) => {
15711578
if (wifi.getNumberOfChannels() > k.OBCINumberOfChannelsGanglion) {
15721579
_processImpedanceCyton(msg, client);

0 commit comments

Comments
 (0)