Comparar commits
6 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| ee66c49ff0 | |||
| abfb37a38e | |||
| 48be1a01db | |||
| 8bbc011ead | |||
| cc839b3b32 | |||
| e2cd5d1dd7 |
@@ -1,7 +1,12 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "4.0"
|
||||
- "4.1"
|
||||
- "4.2"
|
||||
- "5.11.0"
|
||||
- "6.0"
|
||||
- "6.1"
|
||||
- "6.2"
|
||||
install:
|
||||
- npm install --all
|
||||
script:
|
||||
|
||||
+13
-1
@@ -1,3 +1,15 @@
|
||||
# 0.3.7
|
||||
|
||||
### New Features
|
||||
* Upgrade dependencies
|
||||
* Update Travis
|
||||
|
||||
# 0.3.6
|
||||
|
||||
### New Features
|
||||
|
||||
* Simulator now has accelerometer data
|
||||
|
||||
# 0.3.5
|
||||
|
||||
### New Features
|
||||
@@ -75,4 +87,4 @@
|
||||
|
||||
### Github Issues Addressed
|
||||
|
||||
* #25, #26, #27, #29, #30, #31, #33, #34
|
||||
* #25, #26, #27, #29, #30, #31, #33, #34
|
||||
|
||||
+29
-1
@@ -296,6 +296,10 @@ var sampleModule = {
|
||||
sinePhaseRad.fill(0);
|
||||
|
||||
var auxData = [0,0,0];
|
||||
var accelCounter = 0;
|
||||
// With 250Hz, every 10 samples, with 125Hz, every 5...
|
||||
var samplesPerAccelRate = Math.floor(sampleRateHz / 25); // best to make this an integer
|
||||
if (samplesPerAccelRate < 1) samplesPerAccelRate = 1;
|
||||
|
||||
// Init arrays to hold coefficients for each channel and init to 0
|
||||
// This gives the 1/f filter memory on each iteration
|
||||
@@ -352,7 +356,31 @@ var sampleModule = {
|
||||
} else {
|
||||
newSample.sampleNumber = previousSampleNumber + 1;
|
||||
}
|
||||
newSample.auxData = auxData;
|
||||
|
||||
/**
|
||||
* Sample rate of accelerometer is 25Hz... when the accelCounter hits the relative sample rate of the accel
|
||||
* we will output a new accel value. The approach will be to consider that Z should be about 1 and X and Y
|
||||
* should be somewhere around 0.
|
||||
*/
|
||||
if (accelCounter == samplesPerAccelRate) {
|
||||
// Initialize a new array
|
||||
var accelArray = [0,0,0];
|
||||
// Calculate X
|
||||
accelArray[0] = (Math.random() * 0.1 * (Math.random() > 0.5 ? -1 : 1));
|
||||
// Calculate Y
|
||||
accelArray[1] = (Math.random() * 0.1 * (Math.random() > 0.5 ? -1 : 1));
|
||||
// Calculate Z, this is around 1
|
||||
accelArray[2] = 1 - ((Math.random() * 0.4) * (Math.random() > 0.5 ? -1 : 1));
|
||||
// Store the newly calculated value
|
||||
newSample.auxData = accelArray;
|
||||
// Reset the counter
|
||||
accelCounter = 0;
|
||||
} else {
|
||||
// Increment counter
|
||||
accelCounter++;
|
||||
// Store the default value
|
||||
newSample.auxData = auxData;
|
||||
}
|
||||
|
||||
return newSample;
|
||||
};
|
||||
|
||||
+3
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "openbci-sdk",
|
||||
"version": "0.3.5",
|
||||
"version": "0.3.7",
|
||||
"description": "The official Node.js SDK for the OpenBCI Biosensor Board.",
|
||||
"main": "openBCIBoard",
|
||||
"scripts": {
|
||||
@@ -18,7 +18,8 @@
|
||||
"gaussian": "^1.0.0",
|
||||
"istanbul": "^0.4.2",
|
||||
"performance-now": "^0.2.0",
|
||||
"serialport": "~2.1.0",
|
||||
"scientific-statistics": "^0.2.7",
|
||||
"serialport": "3.1.2",
|
||||
"sntp": "^2.0.0"
|
||||
},
|
||||
"directories": {
|
||||
|
||||
@@ -242,6 +242,23 @@ describe('openBCISample',function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
it('should generate a sample with accel data every 25Hz',function() {
|
||||
var generateSample = openBCISample.randomSample(k.OBCINumberOfChannelsDefault, k.OBCISampleRate250);
|
||||
var newSample = generateSample(0);
|
||||
|
||||
var passed = false;
|
||||
// Should get one non-zero auxData array (on the 10th sample)
|
||||
for (var i = 0; i < 10; i++) {
|
||||
newSample = generateSample(newSample.sampleNumber);
|
||||
if (newSample.auxData[0] !== 0 || newSample.auxData[1] !== 0 || newSample.auxData[2] !== 0) {
|
||||
passed = true;
|
||||
newSample.auxData[0].should.be.approximately(0,0.1);
|
||||
newSample.auxData[1].should.be.approximately(0,0.1);
|
||||
newSample.auxData[2].should.be.approximately(1,0.4);
|
||||
}
|
||||
}
|
||||
assert(passed,"a sample with accel data was produced");
|
||||
});
|
||||
});
|
||||
describe('#impedanceCalculationForChannel', function() {
|
||||
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário