Comparar commits

..

4 Commits

Autor SHA1 Mensagem Data
AJ Keller b51cb54f92 Merge pull request #74 from pushtheworldllc/serialport-upgrade
Enh upgrade serial port to 4.x
2016-08-10 07:35:38 -04:00
AJ Keller 19f05e362f Enh upgrade serial port to 4.x 2016-08-09 22:31:36 -04:00
AJ Keller c33d08b486 Merge pull request #73 from pushtheworldllc/dev-firmware
v1.2.1 Fix for radio channel set functions
2016-08-08 22:42:36 -04:00
AJ Keller 97cff2dac9 Fix for radio channel set functions 2016-08-08 22:36:09 -04:00
7 arquivos alterados com 50 adições e 22 exclusões
+2
Ver Arquivo
@@ -2,6 +2,8 @@
[![Join the chat at https://gitter.im/OpenBCI/OpenBCI_NodeJS](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/OpenBCI/OpenBCI_NodeJS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/OpenBCI/OpenBCI_NodeJS.svg?branch=master)](https://travis-ci.org/OpenBCI/OpenBCI_NodeJS)
[![codecov](https://codecov.io/gh/OpenBCI/OpenBCI_NodeJS/branch/master/graph/badge.svg)](https://codecov.io/gh/OpenBCI/OpenBCI_NodeJS)
[![Dependency Status](https://david-dm.org/OpenBCI/OpenBCI_NodeJS.svg)](https://david-dm.org/OpenBCI/OpenBCI_NodeJS)
[![npm](https://img.shields.io/npm/dm/openbci.svg?maxAge=2592000)](http://npmjs.com/package/openbci)
# OpenBCI Node.js SDK
+12
Ver Arquivo
@@ -1,3 +1,15 @@
# 1.2.2
### Enhancements
* Upgrade serialport to 4.x
# 1.2.1
### Bug Fixes
* Fixed bug where set channel function allowed for channel 0 to be set. Cannot set system to channel 0; lower limit is 1.
# 1.2.0
### New Features
+9 -9
Ver Arquivo
@@ -3,7 +3,7 @@
var EventEmitter = require('events').EventEmitter,
util = require('util'),
stream = require('stream'),
serialPort = require('serialport'),
SerialPort = require('serialport'),
openBCISample = require('./openBCISample'),
k = openBCISample.k,
openBCISimulator = require('./openBCISimulator'),
@@ -240,7 +240,7 @@ function OpenBCIFactory() {
} else {
/* istanbul ignore if */
if (this.options.verbose) console.log('using real board ' + portName);
boardSerial = new serialPort.SerialPort(portName, {
boardSerial = new SerialPort(portName, {
baudRate: this.options.baudRate
},(err) => {
if (err) reject(err);
@@ -473,14 +473,14 @@ function OpenBCIFactory() {
OpenBCIBoard.prototype._writeAndDrain = function(data) {
return new Promise((resolve,reject) => {
if(!this.serial) reject('Serial port not open');
this.serial.write(data,(error,results) => {
if(results) {
this.serial.write(data,(error) => {
if(error) {
console.log('Error [writeAndDrain]: ' + error);
reject(error);
} else {
this.serial.drain(function() {
resolve();
});
} else {
console.log('Error [writeAndDrain]: ' + error);
reject(error);
}
})
});
@@ -504,7 +504,7 @@ function OpenBCIFactory() {
if (this.options.verbose) console.log('auto found sim board');
resolve(k.OBCISimulatorPortName);
} else {
serialPort.list((err, ports) => {
SerialPort.list((err, ports) => {
if(err) {
if (this.options.verbose) console.log('serial port err');
reject(err);
@@ -921,7 +921,7 @@ function OpenBCIFactory() {
*/
OpenBCIBoard.prototype.listPorts = function() {
return new Promise((resolve, reject) => {
serialPort.list((err, ports) => {
SerialPort.list((err, ports) => {
if(err) reject(err);
else {
ports.push( {
+1 -1
Ver Arquivo
@@ -306,7 +306,7 @@ const OBCISimulatorStandard = 'standard';
/** OpenBCI Radio Limits */
const OBCIRadioChannelMax = 25;
const OBCIRadioChannelMin = 0;
const OBCIRadioChannelMin = 1;
const OBCIRadioPollTimeMax = 255;
const OBCIRadioPollTimeMin = 0;
+3 -3
Ver Arquivo
@@ -1,6 +1,6 @@
{
"name": "openbci",
"version": "1.2.0",
"version": "1.2.2",
"description": "The official Node.js SDK for the OpenBCI Biosensor Board.",
"main": "openBCIBoard",
"scripts": {
@@ -19,7 +19,7 @@
"gaussian": "^1.0.0",
"mathjs": "^3.3.0",
"performance-now": "^0.2.0",
"serialport": "3.1.2",
"serialport": "4.0.1",
"sntp": "^2.0.0",
"streamsearch": "^0.1.2"
},
@@ -31,7 +31,7 @@
"chai-as-promised": "^5.2.0",
"codecov": "^1.0.1",
"istanbul": "^0.4.4",
"mocha": "^2.3.4",
"mocha": "^3.0.2",
"sandboxed-module": "^2.0.3",
"sinon": "^1.17.2",
"sinon-chai": "^2.8.0"
+1 -1
Ver Arquivo
@@ -770,7 +770,7 @@ describe('OpenBCIConstants', function() {
expect(k.OBCIRadioChannelMax).to.be.equal(25);
});
it("should get the right channel number min",function () {
expect(k.OBCIRadioChannelMin).to.be.equal(0);
expect(k.OBCIRadioChannelMin).to.be.equal(1);
});
it("should get the right poll time max",function () {
expect(k.OBCIRadioPollTimeMax).to.be.equal(255);
+22 -8
Ver Arquivo
@@ -400,9 +400,6 @@ describe('openbci-sdk',function() {
}).catch(err => done(err));
});
});
describe('#boardTests', function() {
this.timeout(3000);
before(function() {
@@ -2530,7 +2527,7 @@ describe('openbci-sdk',function() {
});
describe('#radioTestsWithBoard',function() {
this.timeout(3000);
this.timeout(0);
before(function(done) {
ourBoard = new openBCIBoard.OpenBCIBoard({
verbose: true
@@ -2583,11 +2580,11 @@ describe('openbci-sdk',function() {
done();
}).catch(err => done(err));
});
it("should be able to set the channel to 0", function(done) {
it("should be able to set the channel to 5", function(done) {
// Don't test if not using real board
if (!realBoard) return done();
ourBoard.radioChannelSet(0).then(channelNumber => {
expect(channelNumber).to.equal(0);
ourBoard.radioChannelSet(5).then(channelNumber => {
expect(channelNumber).to.equal(5);
done();
}).catch(err => done(err));
});
@@ -2596,11 +2593,13 @@ describe('openbci-sdk',function() {
if (!realBoard) return done();
var systemChanNumber = 0;
var newChanNum = 0;
// var timey = Date.now();
// Get the current system channel
ourBoard.radioChannelGet()
.then(res => {
// Store it
systemChanNumber = res.channelNumber;
// console.log(`system channel number: ${res.channelNumber}`);
if (systemChanNumber == 25) {
newChanNum = 24;
} else {
@@ -2611,9 +2610,24 @@ describe('openbci-sdk',function() {
})
.then(newChanNumActual => {
expect(newChanNumActual).to.equal(newChanNum);
return ourBoard.radioSystemStatusGet();
// timey = Date.now();
// console.log(`new chan ${newChanNumActual} got`, timey, '0ms');
return new Promise((resolve, reject) => {
setTimeout(function() {
// console.log(`get status`, Date.now(), `${Date.now() - timey}ms`);
ourBoard.radioSystemStatusGet().
then(isUp => {
// console.log('resolving', Date.now(), `${Date.now() - timey}ms`);
resolve(isUp);
})
.catch(err => {
reject(err);
})
}, 270); // Should be accurate after 270 seconds
});
})
.then(isUp => {
// console.log(`isUp test`, Date.now(), `${Date.now() - timey}ms`);
expect(isUp).to.be.false;
return ourBoard.radioChannelSetHostOverride(systemChanNumber); // Set back to good
})