adafruit / Adafruit_BME280_Library

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

change loop to delay so ESP8266 can do Wi-Fi tasks #19

Closed pm73 closed 7 years ago

pm73 commented 7 years ago

delay(1) allows ESP8266 to do Wi-Fi tasks. It is recommended to not make any code that blocks this for more than 20/50 miliseconds. Tested on ESP8266.

Simple test: long test=millis(); bme.takeForcedMeasurement(); Serial.println(millis()-test); shows that with X16 oversampling, bme.takeForceMeasurement can block for 70ms (and even over 100ms for first measurement after reset).

https://github.com/esp8266/Arduino/issues/2021 https://github.com/esp8266/Arduino/blob/master/doc/reference.md#timing-and-delays