|
@ -15,11 +15,15 @@ bool BME280::begin(void) { |
|
|
digitalWrite(23, HIGH); // enable bme280 CS
|
|
|
digitalWrite(23, HIGH); // enable bme280 CS
|
|
|
delay(50); |
|
|
delay(50); |
|
|
bme = new Adafruit_BME280(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI
|
|
|
bme = new Adafruit_BME280(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI
|
|
|
|
|
|
int retries = 0; |
|
|
while (!(status = bme->begin())) { |
|
|
while (!(status = bme->begin())) { |
|
|
|
|
|
if (retries > 5) break; |
|
|
|
|
|
retries++; |
|
|
Serial.println("Could not find a valid BME280 sensor, check wiring!"); |
|
|
Serial.println("Could not find a valid BME280 sensor, check wiring!"); |
|
|
// bme->reset();
|
|
|
// bme->reset();
|
|
|
delay(500); |
|
|
delay(500); |
|
|
} |
|
|
} |
|
|
|
|
|
if (!status) return false; |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|