remove extra begin options. just one now.
also looked at https://github.com/adafruit/Adafruit_BME280_Library/issues/64 and reduced some delays
This commit is contained in:
parent
16c3e721c7
commit
2a23df09f3
|
|
@ -64,7 +64,7 @@ Adafruit_BME280::Adafruit_BME280(int8_t cspin, int8_t mosipin, int8_t misopin,
|
||||||
/*!
|
/*!
|
||||||
* @brief Initialise sensor with given parameters / settings
|
* @brief Initialise sensor with given parameters / settings
|
||||||
* @param addr the I2C address the device can be found on
|
* @param addr the I2C address the device can be found on
|
||||||
* @param theWire the I2C object to use
|
* @param theWire the I2C object to use, defaults to &Wire
|
||||||
* @returns true on success, false otherwise
|
* @returns true on success, false otherwise
|
||||||
*/
|
*/
|
||||||
bool Adafruit_BME280::begin(uint8_t addr, TwoWire *theWire) {
|
bool Adafruit_BME280::begin(uint8_t addr, TwoWire *theWire) {
|
||||||
|
|
@ -76,32 +76,6 @@ bool Adafruit_BME280::begin(uint8_t addr, TwoWire *theWire) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
* @brief Initialise sensor with given parameters / settings
|
|
||||||
* @param theWire the I2C object to use
|
|
||||||
* @returns true on success, false otherwise
|
|
||||||
*/
|
|
||||||
bool Adafruit_BME280::begin(TwoWire *theWire) {
|
|
||||||
return begin(BME280_ADDRESS, theWire);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* @brief Initialise sensor with given parameters / settings
|
|
||||||
* @param addr the I2C address the device can be found on
|
|
||||||
* @returns true on success, false otherwise
|
|
||||||
*/
|
|
||||||
bool Adafruit_BME280::begin(uint8_t addr) {
|
|
||||||
return begin(addr, &Wire);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* @brief Initialise sensor with given parameters / settings
|
|
||||||
* @returns true on success, false otherwise
|
|
||||||
*/
|
|
||||||
bool Adafruit_BME280::begin(void) {
|
|
||||||
return begin(BME280_ADDRESS, &Wire);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Initialise sensor with given parameters / settings
|
* @brief Initialise sensor with given parameters / settings
|
||||||
* @returns true on success, false otherwise
|
* @returns true on success, false otherwise
|
||||||
|
|
@ -135,11 +109,11 @@ bool Adafruit_BME280::init() {
|
||||||
write8(BME280_REGISTER_SOFTRESET, 0xB6);
|
write8(BME280_REGISTER_SOFTRESET, 0xB6);
|
||||||
|
|
||||||
// wait for chip to wake up.
|
// wait for chip to wake up.
|
||||||
delay(300);
|
delay(10);
|
||||||
|
|
||||||
// if chip is still reading calibration, delay
|
// if chip is still reading calibration, delay
|
||||||
while (isReadingCalibration())
|
while (isReadingCalibration())
|
||||||
delay(100);
|
delay(10);
|
||||||
|
|
||||||
readCoefficients(); // read trimming parameters, see DS 4.2.2
|
readCoefficients(); // read trimming parameters, see DS 4.2.2
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -190,13 +190,10 @@ public:
|
||||||
// constructors
|
// constructors
|
||||||
Adafruit_BME280();
|
Adafruit_BME280();
|
||||||
Adafruit_BME280(int8_t cspin, SPIClass *theSPI = &SPI);
|
Adafruit_BME280(int8_t cspin, SPIClass *theSPI = &SPI);
|
||||||
Adafruit_BME280(int8_t cspin, int8_t mosipin, int8_t misopin,
|
Adafruit_BME280(int8_t cspin, int8_t mosipin, int8_t misopin,
|
||||||
int8_t sckpin);
|
int8_t sckpin);
|
||||||
|
|
||||||
bool begin();
|
bool begin(uint8_t addr=BME280_ADDRESS, TwoWire *theWire=&Wire);
|
||||||
bool begin(TwoWire *theWire);
|
|
||||||
bool begin(uint8_t addr);
|
|
||||||
bool begin(uint8_t addr, TwoWire *theWire);
|
|
||||||
bool init();
|
bool init();
|
||||||
|
|
||||||
void setSampling(sensor_mode mode = MODE_NORMAL,
|
void setSampling(sensor_mode mode = MODE_NORMAL,
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,9 @@ void setup() {
|
||||||
unsigned status;
|
unsigned status;
|
||||||
|
|
||||||
// default settings
|
// default settings
|
||||||
// (you can also pass in a Wire library object like &Wire2)
|
|
||||||
status = bme.begin();
|
status = bme.begin();
|
||||||
|
// You can also pass in a Wire library object like &Wire2
|
||||||
|
// status = bme.begin(0x76, &Wire2)
|
||||||
if (!status) {
|
if (!status) {
|
||||||
Serial.println("Could not find a valid BME280 sensor, check wiring, address, sensor ID!");
|
Serial.println("Could not find a valid BME280 sensor, check wiring, address, sensor ID!");
|
||||||
Serial.print("SensorID was: 0x"); Serial.println(bme.sensorID(),16);
|
Serial.print("SensorID was: 0x"); Serial.println(bme.sensorID(),16);
|
||||||
|
|
@ -51,7 +52,7 @@ void setup() {
|
||||||
Serial.print(" ID of 0x56-0x58 represents a BMP 280,\n");
|
Serial.print(" ID of 0x56-0x58 represents a BMP 280,\n");
|
||||||
Serial.print(" ID of 0x60 represents a BME 280.\n");
|
Serial.print(" ID of 0x60 represents a BME 280.\n");
|
||||||
Serial.print(" ID of 0x61 represents a BME 680.\n");
|
Serial.print(" ID of 0x61 represents a BME 680.\n");
|
||||||
while (1);
|
while (1) delay(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
Serial.println("-- Default Test --");
|
Serial.println("-- Default Test --");
|
||||||
|
|
@ -86,4 +87,4 @@ void printValues() {
|
||||||
Serial.println(" %");
|
Serial.println(" %");
|
||||||
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue