adafruit / Adafruit_BME280_Library

Arduino Library for BME280 sensors
Other
333 stars 304 forks source link

ESP32 hangs after loading the lib #29

Closed micropet closed 4 years ago

micropet commented 6 years ago

The current version no longer works on an ESP32 board.

The code compiles without errors, the ESP hangs after the lib is loaded. version = 1.0.5 runs without problems.

AlexSwensen commented 6 years ago

@micropet posting some example code is helpful for us to reproduce and solve your issue. :-)

luckyhacky commented 6 years ago

I think i is caused either by line 103 or 343 of the source https://github.com/adafruit/Adafruit_BME280_Library/blob/master/Adafruit_BME280.cpp#L103

        while (isReadingCalibration())
        delay(100);

https://github.com/adafruit/Adafruit_BME280_Library/blob/master/Adafruit_BME280.cpp#L343

        while (read8(BME280_REGISTER_STATUS) & 0x08)
        delay(1)

Exceptions in reads, e.g. if read is not ack (I2C) or 0x00 is returned (SPI), there will be a neverending loop. Normally it should be limited or a timeout introduced.

Solution could be:

int timeout == 42;
while (isReadingCalibration() && timeout > 0)
{
        delay(100);
        timeout --;
}

Nevertheless please provide code snippet and check connections.

ladyada commented 4 years ago

closing due to lack of activity