Closed yoursunny closed 5 years ago
looks good, for measurement time please use uint32_t rather than 'long' also some returns were changed to 0, but the function returns bool type so turn those back :)
for measurement time please use uint32_t rather than 'long'
_meas_end
indicates the absolute time when the current measurement would end, so the type should match the return type of millis()
.
also some returns were changed to 0, but the function returns bool type so turn those back
beginMeasurement
returns the absolute time when the current measurement would end (i.e. _meas_end
). Its return type is not bool
, so return false
becomes return 0
.
ok got it - what hardware have you tested with?
I tested this with ESP32 Heltec_WiFi_Kit_32
and Adafruit BME680 breakout board. However, I haven't fully tested the async logic. Shall I add an example for async reading?
an example would be good - yeah! do you have an AVR or SAMD board to test with, arduino or feather?
an example would be good - yeah!
I'll try to create an example.
do you have an AVR or SAMD board to test with, arduino or feather?
I don't have any Arduino boards. Hopefully another user having them could help testing it once I upload the example.
ok if you can add an async demo, ill do the test!
Example is uploaded.
Reading started at 37859 and will finish at 38042
You can do other work during BME680 measurement.
Reading completed at 38177
Temperature = 24.18 *C
Pressure = 1003.87 hPa
Humidity = 54.90 %
Gas = 762.62 KOhms
Approx. Altitude = 78.22 m
There are still some delay()
s inside Bosch's library causing endReading
to take about 130ms, but I won't go into these.
The overall benefit of this change is gaining about 180ms during a measurement for parallel work.
awesome!
This Change adds a pair of
beginReading()
andendReading()
functions. It allows the microcontroller to perform other work, such as network operations, while the BME680 sensor is performing the reading.