Skip to content

Commit 0abebcd

Browse files
author
AJ Keller
committed
FIX: disconnect did not close serial port if device was not streaming
1 parent 1e0dba5 commit 0abebcd

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

changelog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
### Enhancements
44

5-
* Update openbci-utilities to v0.1.1 to patch for sendCounts.
5+
* Update openbci-utilities to v0.1.2 to patch for sendCounts.
6+
* Disconnect did not disconnect from serial port if the device was not streaming.
67

78
# 2.1.1
89

openBCICyton.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,13 +368,15 @@ Cyton.prototype.disconnect = function () {
368368
if (this.isStreaming()) {
369369
if (this.options.verbose) console.log('stop streaming');
370370
return this.streamStop();
371+
} else {
372+
return Promise.resolve();
371373
}
372374
})
373375
.then(() => {
374376
if (!this.isConnected()) {
375377
return Promise.reject(Error('no board connected'));
376378
} else {
377-
return new Promise((resolve, reject) => {
379+
return new Promise((resolve) => {
378380
// serial emitting 'close' will call _disconnected
379381
this.serial.close(() => {
380382
resolve();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"gaussian": "^1.0.0",
2222
"lodash": "^4.17.4",
2323
"mathjs": "^3.14.2",
24-
"openbci-utilities": "0.1.1",
24+
"openbci-utilities": "0.1.2",
2525
"performance-now": "^2.1.0",
2626
"safe-buffer": "^5.1.1",
2727
"serialport": "4.0.7",

0 commit comments

Comments
 (0)