Closed tiziano88 closed 3 years ago
I'm seeing the same effect.
The example from the documentation is missing a sleep to wait for the sensor data being ready. You can get the necessary sleep duration like this:
let profile_duration = dev.get_profile_dur(&settings.0).map_err(Bme680Error)?;
and then you do a sleep in-between setting the forced power mode and reading the sensor data:
std::thread::sleep(profile_duration);
First of all, thanks for making this crate available!
I am trying to use it to retrieve sensor data, but it seems that I need to set forced power mode no less than three times in order to be able to get a valid read.
My code looks as follows:
If I remove even just one of the 3 calls to
set_sensor_mode
, I get consistently wrong results, e.g.:Could it be some race condition, or am I doing something wrong?