@@ -114,7 +114,8 @@ uint8_t BME280::begin()
114
114
115
115
// Check communication with IC before anything else
116
116
uint8_t chipID = readRegister (BME280_CHIP_ID_REG); // Should return 0x60
117
- if (chipID != 0x60 ) return (chipID); // Failed!
117
+ if (chipID != 0x58 ) // This is not BMP
118
+ if (chipID != 0x60 ) // This is not BME
118
119
119
120
// Reading all compensation data, range 0x88:A1, 0xE1:E7
120
121
calibration.dig_T1 = ((uint16_t )((readRegister (BME280_DIG_T1_MSB_REG) << 8 ) + readRegister (BME280_DIG_T1_LSB_REG)));
@@ -156,8 +157,9 @@ bool BME280::beginSPI(uint8_t csPin)
156
157
{
157
158
settings.chipSelectPin = csPin;
158
159
settings.commInterface = SPI_MODE;
159
-
160
- if (begin () == 0x60 ) return (true ); // Begin normal init with these settings. Should return chip ID of 0x60
160
+
161
+ if (begin () == 0x58 ) return (true ); // Begin normal init with these settings. Should return chip ID of 0x58 for BMP
162
+ if (begin () == 0x60 ) return (true ); // Begin normal init with these settings. Should return chip ID of 0x60 for BME
161
163
return (false );
162
164
}
163
165
@@ -168,9 +170,10 @@ bool BME280::beginI2C(TwoWire &wirePort)
168
170
_wireType = HARD_WIRE;
169
171
170
172
settings.commInterface = I2C_MODE;
173
+
171
174
// settings.I2CAddress = 0x77; //We assume user has set the I2C address using setI2CAddress()
172
-
173
- if (begin () == 0x60 ) return (true ); // Begin normal init with these settings. Should return chip ID of 0x60
175
+ if ( begin () == 0x58 ) return ( true ); // Begin normal init with these settings. Should return chip ID of 0x58 for BMP
176
+ if (begin () == 0x60 ) return (true ); // Begin normal init with these settings. Should return chip ID of 0x60 for BME
174
177
return (false );
175
178
}
176
179
@@ -184,7 +187,8 @@ bool BME280::beginI2C(SoftwareWire& wirePort)
184
187
settings.commInterface = I2C_MODE;
185
188
// settings.I2CAddress = 0x77; //We assume user has set the I2C address using setI2CAddress()
186
189
187
- if (begin () == 0x60 ) return (true ); // Begin normal init with these settings. Should return chip ID of 0x60
190
+ if (begin () == 0x58 ) return (true ); // Begin normal init with these settings. Should return chip ID of 0x58 for BMP
191
+ if (begin () == 0x60 ) return (true ); // Begin normal init with these settings. Should return chip ID of 0x60 for BME
188
192
return (false );
189
193
}
190
194
#endif
0 commit comments