File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed
Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,7 @@ function OpenBCIFactory() {
162162 */
163163 OpenBCIBoard . prototype . streamStart = function ( ) {
164164 this . streaming = true ;
165+ this . _reset ( ) ;
165166 return this . write ( k . OBCIStreamStart ) ;
166167 } ;
167168
@@ -175,7 +176,6 @@ function OpenBCIFactory() {
175176 */
176177 OpenBCIBoard . prototype . streamStop = function ( ) {
177178 this . streaming = false ;
178- this . _reset ( ) ;
179179 return this . write ( k . OBCIStreamStop ) ;
180180 } ;
181181
@@ -472,6 +472,8 @@ function OpenBCIFactory() {
472472 reject ( 'Simulator Already Running' ) ;
473473 } else {
474474 // start simulating
475+ this . connected = true ;
476+ this . streaming = true ;
475477 this . isSimulating = true ;
476478 // generateSample is a func that takes the previous sample number
477479 var generateSample = openBCISample . randomSample ( this . numberOfChannels ( ) , this . sampleRate ( ) ) ;
@@ -485,7 +487,7 @@ function OpenBCIFactory() {
485487 this . emit ( 'sample' , newSample ) ;
486488 oldSample = newSample ;
487489 resolve ( ) ;
488- } , 20 ) ;
490+ } , 4 ) ;
489491
490492 }
491493
@@ -503,6 +505,8 @@ function OpenBCIFactory() {
503505 if ( this . isSimulating ) {
504506 // stop simulating
505507 this . isSimulating = false ;
508+ this . connected = false ;
509+ this . streaming = false ;
506510 if ( this . simulator ) {
507511 clearInterval ( this . simulator ) ;
508512 }
Original file line number Diff line number Diff line change @@ -173,7 +173,11 @@ module.exports = {
173173
174174 }
175175 }
176- newSample . sampleNumber = previousSampleNumber + 1 ;
176+ if ( previousSampleNumber == 255 ) {
177+ newSample . sampleNumber = 0 ;
178+ } else {
179+ newSample . sampleNumber = previousSampleNumber + 1 ;
180+ }
177181 newSample . auxData = auxData ;
178182
179183 return newSample ;
Original file line number Diff line number Diff line change 11{
22 "name" : " openbci-sdk" ,
3- "version" : " 0.1.7 " ,
3+ "version" : " 0.1.8 " ,
44 "description" : " A fully NodeJS based API for the OpenBCI board connecting to the hardware directly over serial" ,
55 "main" : " openBCIBoard" ,
66 "scripts" : {
You can’t perform that action at this time.
0 commit comments