Skip to content

Commit

Permalink
FIX: disconnect did not close serial port if device was not streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
AJ Keller committed Jul 20, 2017
1 parent 1e0dba5 commit 0abebcd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

### Enhancements

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

# 2.1.1

Expand Down
4 changes: 3 additions & 1 deletion openBCICyton.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,13 +368,15 @@ Cyton.prototype.disconnect = function () {
if (this.isStreaming()) {
if (this.options.verbose) console.log('stop streaming');
return this.streamStop();
} else {
return Promise.resolve();
}
})
.then(() => {
if (!this.isConnected()) {
return Promise.reject(Error('no board connected'));
} else {
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
// serial emitting 'close' will call _disconnected
this.serial.close(() => {
resolve();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"gaussian": "^1.0.0",
"lodash": "^4.17.4",
"mathjs": "^3.14.2",
"openbci-utilities": "0.1.1",
"openbci-utilities": "0.1.2",
"performance-now": "^2.1.0",
"safe-buffer": "^5.1.1",
"serialport": "4.0.7",
Expand Down

0 comments on commit 0abebcd

Please sign in to comment.