Skip to content

Commit 2a23df0

Browse files
committed
remove extra begin options. just one now.
also looked at #64 and reduced some delays
1 parent 16c3e72 commit 2a23df0

File tree

3 files changed

+9
-37
lines changed

3 files changed

+9
-37
lines changed

Adafruit_BME280.cpp

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Adafruit_BME280::Adafruit_BME280(int8_t cspin, int8_t mosipin, int8_t misopin,
6464
/*!
6565
* @brief Initialise sensor with given parameters / settings
6666
* @param addr the I2C address the device can be found on
67-
* @param theWire the I2C object to use
67+
* @param theWire the I2C object to use, defaults to &Wire
6868
* @returns true on success, false otherwise
6969
*/
7070
bool Adafruit_BME280::begin(uint8_t addr, TwoWire *theWire) {
@@ -76,32 +76,6 @@ bool Adafruit_BME280::begin(uint8_t addr, TwoWire *theWire) {
7676
return status;
7777
}
7878

79-
/*!
80-
* @brief Initialise sensor with given parameters / settings
81-
* @param theWire the I2C object to use
82-
* @returns true on success, false otherwise
83-
*/
84-
bool Adafruit_BME280::begin(TwoWire *theWire) {
85-
return begin(BME280_ADDRESS, theWire);
86-
}
87-
88-
/*!
89-
* @brief Initialise sensor with given parameters / settings
90-
* @param addr the I2C address the device can be found on
91-
* @returns true on success, false otherwise
92-
*/
93-
bool Adafruit_BME280::begin(uint8_t addr) {
94-
return begin(addr, &Wire);
95-
}
96-
97-
/*!
98-
* @brief Initialise sensor with given parameters / settings
99-
* @returns true on success, false otherwise
100-
*/
101-
bool Adafruit_BME280::begin(void) {
102-
return begin(BME280_ADDRESS, &Wire);
103-
}
104-
10579
/*!
10680
* @brief Initialise sensor with given parameters / settings
10781
* @returns true on success, false otherwise
@@ -135,11 +109,11 @@ bool Adafruit_BME280::init() {
135109
write8(BME280_REGISTER_SOFTRESET, 0xB6);
136110

137111
// wait for chip to wake up.
138-
delay(300);
112+
delay(10);
139113

140114
// if chip is still reading calibration, delay
141115
while (isReadingCalibration())
142-
delay(100);
116+
delay(10);
143117

144118
readCoefficients(); // read trimming parameters, see DS 4.2.2
145119

Adafruit_BME280.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,10 @@ class Adafruit_BME280 {
190190
// constructors
191191
Adafruit_BME280();
192192
Adafruit_BME280(int8_t cspin, SPIClass *theSPI = &SPI);
193-
Adafruit_BME280(int8_t cspin, int8_t mosipin, int8_t misopin,
193+
Adafruit_BME280(int8_t cspin, int8_t mosipin, int8_t misopin,
194194
int8_t sckpin);
195195

196-
bool begin();
197-
bool begin(TwoWire *theWire);
198-
bool begin(uint8_t addr);
199-
bool begin(uint8_t addr, TwoWire *theWire);
196+
bool begin(uint8_t addr=BME280_ADDRESS, TwoWire *theWire=&Wire);
200197
bool init();
201198

202199
void setSampling(sensor_mode mode = MODE_NORMAL,

examples/bme280test/bme280test.ino

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,17 @@ void setup() {
4242
unsigned status;
4343

4444
// default settings
45-
// (you can also pass in a Wire library object like &Wire2)
4645
status = bme.begin();
46+
// You can also pass in a Wire library object like &Wire2
47+
// status = bme.begin(0x76, &Wire2)
4748
if (!status) {
4849
Serial.println("Could not find a valid BME280 sensor, check wiring, address, sensor ID!");
4950
Serial.print("SensorID was: 0x"); Serial.println(bme.sensorID(),16);
5051
Serial.print(" ID of 0xFF probably means a bad address, a BMP 180 or BMP 085\n");
5152
Serial.print(" ID of 0x56-0x58 represents a BMP 280,\n");
5253
Serial.print(" ID of 0x60 represents a BME 280.\n");
5354
Serial.print(" ID of 0x61 represents a BME 680.\n");
54-
while (1);
55+
while (1) delay(10);
5556
}
5657

5758
Serial.println("-- Default Test --");
@@ -86,4 +87,4 @@ void printValues() {
8687
Serial.println(" %");
8788

8889
Serial.println();
89-
}
90+
}

0 commit comments

Comments
 (0)