Skip to content

Commit df329f6

Browse files
committed
Adding comm test to .begin. Fixing H6 declarations.
1 parent 10d2691 commit df329f6

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/SparkFunBME280.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,11 @@ uint8_t BME280::begin()
102102
break;
103103
}
104104

105+
//Check communication with IC before anything else
106+
uint8_t chipID = readRegister(BME280_CHIP_ID_REG); //Should return 0x60
107+
if(chipID != 0x60) return(chipID); //Failed!
108+
105109
//Reading all compensation data, range 0x88:A1, 0xE1:E7
106-
107110
calibration.dig_T1 = ((uint16_t)((readRegister(BME280_DIG_T1_MSB_REG) << 8) + readRegister(BME280_DIG_T1_LSB_REG)));
108111
calibration.dig_T2 = ((int16_t)((readRegister(BME280_DIG_T2_MSB_REG) << 8) + readRegister(BME280_DIG_T2_LSB_REG)));
109112
calibration.dig_T3 = ((int16_t)((readRegister(BME280_DIG_T3_MSB_REG) << 8) + readRegister(BME280_DIG_T3_LSB_REG)));
@@ -305,7 +308,7 @@ float BME280::readFloatPressure( void )
305308
//Sets the internal variable _referencePressure so the
306309
void BME280::setReferencePressure(float refPressure)
307310
{
308-
_referencePressure = rePressure;
311+
_referencePressure = refPressure;
309312
}
310313

311314
//Return the local reference pressure

src/SparkFunBME280.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ struct SensorCalibration
141141
uint8_t dig_H3;
142142
int16_t dig_H4;
143143
int16_t dig_H5;
144-
uint8_t dig_H6;
144+
int8_t dig_H6;
145145

146146
};
147147

0 commit comments

Comments
 (0)