Skip to content

Commit fdc9cd3

Browse files
authored
Merge pull request #24 from LukaGitH/master
Terminate if sensor is not BMP or BME
2 parents 6c06945 + 124b36d commit fdc9cd3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/SparkFunBME280.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ uint8_t BME280::begin()
113113
}
114114

115115
//Check communication with IC before anything else
116-
uint8_t chipID = readRegister(BME280_CHIP_ID_REG); //Should return 0x60
117-
if(chipID != 0x58) // This is not BMP
118-
if(chipID != 0x60) // This is not BME
116+
uint8_t chipID = readRegister(BME280_CHIP_ID_REG); //Should return 0x60 or 0x58
117+
if(chipID != 0x58 && chipID != 0x60) // Is this BMP or BME?
118+
return(chipID); //This is not BMP nor BME!
119119

120120
//Reading all compensation data, range 0x88:A1, 0xE1:E7
121121
calibration.dig_T1 = ((uint16_t)((readRegister(BME280_DIG_T1_MSB_REG) << 8) + readRegister(BME280_DIG_T1_LSB_REG)));

0 commit comments

Comments
 (0)