@@ -209,7 +209,7 @@ bioData SparkFun_Bio_Sensor_Hub::readBpm(){
209
209
210
210
numSamplesOutFifo ();
211
211
212
- if (_userSelectedMode = MODE_ONE) {
212
+ if (_userSelectedMode == MODE_ONE) {
213
213
214
214
readFillArray (READ_DATA_OUTPUT, READ_DATA, MAXFAST_ARRAY_SIZE, bpmArr);
215
215
@@ -232,8 +232,7 @@ bioData SparkFun_Bio_Sensor_Hub::readBpm(){
232
232
return libBpm;
233
233
}
234
234
235
- else if (_userSelectedMode = MODE_TWO) {
236
-
235
+ else if (_userSelectedMode == MODE_TWO) {
237
236
readFillArray (READ_DATA_OUTPUT, READ_DATA,\
238
237
MAXFAST_ARRAY_SIZE + MAXFAST_EXTENDED_DATA, bpmArrTwo);
239
238
@@ -248,15 +247,16 @@ bioData SparkFun_Bio_Sensor_Hub::readBpm(){
248
247
// Blood oxygen level formatting
249
248
libBpm.oxygen = uint16_t (bpmArrTwo[3 ]) << 8 ;
250
249
libBpm.oxygen |= bpmArrTwo[4 ];
251
- libBpm.oxygen /= 10 ;
250
+ libBpm.oxygen /= 10.0 ;
252
251
253
252
// "Machine State" - has a finger been detected?
254
253
libBpm.status = bpmArrTwo[5 ];
255
254
256
255
// Sp02 r Value formatting
257
- libBpm.rValue = uint16_t (bpmArrTwo[6 ]) << 8 ;
258
- libBpm.rValue |= bpmArrTwo[7 ];
259
- libBpm.rValue /= 10 ;
256
+ uint16_t tempVal = uint16_t (bpmArrTwo[6 ]) << 8 ;
257
+ tempVal |= bpmArrTwo[7 ];
258
+ libBpm.rValue = tempVal;
259
+ libBpm.rValue /= 10.0 ;
260
260
261
261
// Extended Machine State formatting
262
262
libBpm.extStatus = bpmArrTwo[8 ];
@@ -375,8 +375,9 @@ bioData SparkFun_Bio_Sensor_Hub::readSensorBpm(){
375
375
libLedBpm.status = bpmSenArr[17 ];
376
376
377
377
// Sp02 r Value formatting
378
- libLedBpm.rValue = uint16_t (bpmArrTwo[18 ]) << 8 ;
379
- libLedBpm.rValue |= bpmArrTwo[19 ];
378
+ uint16_t tempVal = uint16_t (bpmArrTwo[6 ]) << 8 ;
379
+ tempVal |= bpmArrTwo[7 ];
380
+ libLedBpm.rValue = tempVal;
380
381
libLedBpm.rValue /= 10 ;
381
382
382
383
// Extended Machine State formatting
@@ -1031,7 +1032,6 @@ bool SparkFun_Bio_Sensor_Hub::eraseFlash() {
1031
1032
1032
1033
}
1033
1034
1034
- // Family Byte: BOOTLOADER_FLASH (0x80), Index Byte: SEND_PAGE_VALUE (0x04)
1035
1035
// Family Byte: BOOTLOADER_INFO (0x81), Index Byte: BOOTLOADER_VERS (0x00)
1036
1036
version SparkFun_Bio_Sensor_Hub::readBootloaderVers (){
1037
1037
@@ -1044,7 +1044,7 @@ version SparkFun_Bio_Sensor_Hub::readBootloaderVers(){
1044
1044
1045
1045
_i2cPort->requestFrom (_address, static_cast <uint8_t >(4 ));
1046
1046
uint8_t statusByte = _i2cPort->read ();
1047
- if (! statusByte) { // Pass through if SUCCESS (0x00).
1047
+ if (statusByte) { // Pass through if SUCCESS (0x00).
1048
1048
booVers.major = 0 ;
1049
1049
booVers.minor = 0 ;
1050
1050
booVers.revision = 0 ;
@@ -1059,20 +1059,19 @@ version SparkFun_Bio_Sensor_Hub::readBootloaderVers(){
1059
1059
1060
1060
}
1061
1061
1062
- // Family Byte: BOOTLOADER_INFO (0x81), Index Byte: PAGE_SIZE (0x01)
1063
1062
// Family Byte: IDENTITY (0xFF), Index Byte: READ_SENSOR_HUB_VERS (0x03)
1064
1063
version SparkFun_Bio_Sensor_Hub::readSensorHubVersion (){
1065
1064
1066
1065
version bioHubVers;
1067
1066
_i2cPort->beginTransmission (_address);
1068
- _i2cPort->write (BOOTLOADER_INFO );
1069
- _i2cPort->write (BOOTLOADER_VERS );
1067
+ _i2cPort->write (IDENTITY );
1068
+ _i2cPort->write (READ_SENSOR_HUB_VERS );
1070
1069
_i2cPort->endTransmission ();
1071
1070
delay (CMD_DELAY);
1072
1071
1073
1072
_i2cPort->requestFrom (_address, static_cast <uint8_t >(4 ));
1074
1073
uint8_t statusByte = _i2cPort->read ();
1075
- if (! statusByte){ // Pass through if SUCCESS (0x00).
1074
+ if (statusByte){ // Pass through if SUCCESS (0x00).
1076
1075
bioHubVers.major = 0 ;
1077
1076
bioHubVers.minor = 0 ;
1078
1077
bioHubVers.revision = 0 ;
@@ -1092,14 +1091,14 @@ version SparkFun_Bio_Sensor_Hub::readAlgorithmVersion(){
1092
1091
1093
1092
version libAlgoVers;
1094
1093
_i2cPort->beginTransmission (_address);
1095
- _i2cPort->write (BOOTLOADER_INFO );
1096
- _i2cPort->write (BOOTLOADER_VERS );
1094
+ _i2cPort->write (IDENTITY );
1095
+ _i2cPort->write (READ_ALGO_VERS );
1097
1096
_i2cPort->endTransmission ();
1098
1097
delay (CMD_DELAY);
1099
1098
1100
1099
_i2cPort->requestFrom (_address, static_cast <uint8_t >(4 ));
1101
1100
uint8_t statusByte = _i2cPort->read ();
1102
- if (! statusByte){ // Pass through if SUCCESS (0x00).
1101
+ if (statusByte){ // Pass through if SUCCESS (0x00).
1103
1102
libAlgoVers.major = 0 ;
1104
1103
libAlgoVers.minor = 0 ;
1105
1104
libAlgoVers.revision = 0 ;
0 commit comments