@@ -535,11 +535,9 @@ describe('openBCIUtilities', function () {
535
535
channelSetting . srb1 = true ;
536
536
} ) ;
537
537
let data = Buffer . from ( k . OBCIRegisterQueryCyton + k . OBCIRegisterQueryAccelerometerFirmwareV1 ) ;
538
- const majorFirmwareVersion = 1 ;
539
538
openBCIUtilities . syncChannelSettingsWithRawData ( {
540
539
channelSettings,
541
- data,
542
- majorFirmwareVersion
540
+ data
543
541
} ) ;
544
542
expect ( channelSettings ) . to . deep . equal ( k . channelSettingsArrayInit ( k . OBCINumberOfChannelsCyton ) ) ;
545
543
} ) ;
@@ -699,25 +697,15 @@ describe('openBCIUtilities', function () {
699
697
majorFirmwareVersion
700
698
} ) ) . to . throw ( k . OBCIErrorUndefinedOrNullInput ) ;
701
699
} ) ;
702
- it ( 'majorFirmwareVersion is undefined' , function ( ) {
703
- let channelSettings = k . channelSettingsArrayInit ( k . OBCINumberOfChannelsCyton ) ;
704
- let data = Buffer . from ( k . OBCIRegisterQueryCyton + k . OBCIRegisterQueryCytonDaisy + k . OBCIRegisterQueryAccelerometerFirmwareV3 ) ;
705
- expect ( openBCIUtilities . syncChannelSettingsWithRawData . bind ( openBCIUtilities , {
706
- channelSettings,
707
- data
708
- } ) ) . to . throw ( k . OBCIErrorUndefinedOrNullInput ) ;
709
- } ) ;
710
700
it ( 'invalid channel settings' , function ( ) {
711
701
let channelSettings = [ ] ;
712
702
for ( let i = 0 ; i < k . OBCINumberOfChannelsCyton ; i ++ ) {
713
703
channelSettings . push ( { taco : 'gordo' } ) ;
714
704
}
715
- const majorFirmwareVersion = 3 ;
716
705
let data = Buffer . from ( k . OBCIRegisterQueryCyton + k . OBCIRegisterQueryAccelerometerFirmwareV3 ) ;
717
706
expect ( openBCIUtilities . syncChannelSettingsWithRawData . bind ( openBCIUtilities , {
718
707
channelSettings,
719
- data,
720
- majorFirmwareVersion
708
+ data
721
709
} ) ) . to . throw ( k . OBCIErrorMissingRequiredProperty ) ;
722
710
} ) ;
723
711
} ) ;
@@ -1768,6 +1756,22 @@ describe('openBCIUtilities', function () {
1768
1756
}
1769
1757
} ) ;
1770
1758
} ) ;
1759
+ describe ( 'BLE' , function ( ) {
1760
+ it ( 'should multiply each channel by the proper scale value' , function ( ) {
1761
+ let chanArr = k . channelSettingsArrayInit ( k . OBCINumberOfChannelsCytonBLE ) ; // Not in daisy mode
1762
+ let scaleFactor = 4.5 / 24 / ( Math . pow ( 2 , 23 ) - 1 ) ;
1763
+ // Call the function under test
1764
+ let valueArray = openBCIUtilities . getChannelDataArray ( {
1765
+ rawDataPacket : sampleBuf ,
1766
+ channelSettings : chanArr ,
1767
+ protocol : k . OBCIProtocolBLE
1768
+ } ) ;
1769
+ for ( let j = 0 ; j < k . OBCINumberOfChannelsCytonBLE ; j ++ ) {
1770
+ // console.log(`channel data ${j + 1}: ${valueArray[j]} : actual ${scaleFactor * (j + 1)}`);
1771
+ expect ( valueArray [ j ] ) . to . be . closeTo ( scaleFactor * ( j + 1 ) , 0.0001 ) ;
1772
+ }
1773
+ } ) ;
1774
+ } ) ;
1771
1775
} ) ;
1772
1776
describe ( '#countADSPresent' , function ( ) {
1773
1777
it ( 'should not crash on small buff' , function ( ) {
0 commit comments