Closed weiying-chen closed 6 days ago
I'm experiencing a similar issue in my project after the e-h-1 update. I have several sensors on the I2C bus (100 kHz) and all of them work but the BME280. I could not find the solution yet.
@crespum I created a repo with a working example plus instructions.
Try this patch from @RobinThrift. It seems to work for me.
diff --git a/Cargo.toml b/Cargo.toml
index 414e9d5..a0bc11b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -26,7 +26,8 @@ embassy = ["esp-idf-svc/embassy-sync", "esp-idf-svc/critical-section", "esp-idf-
[dependencies]
log = { version = "0.4", default-features = false }
esp-idf-svc = { version = "0.48", default-features = false }
-bme280 = "0.5.0"
+# bme280 = "0.5.0"
+bme280 = { git = "https://github.com/RobinThrift/bme280-rs.git", commit = "12d5e98253e0e8fadbd43895a608263f4a84884d"}
[build-dependencies]
embuild = "0.31.3"
Okay, I'll check it out. But my working example reads the sensor successfully.
I've run your example. Sometimes it works, sometimes it doesn't work.
Ah, that's strange. It runs every time for me. I'll keep an eye on that.
But if it sometimes run and sometimes it doesn't, I think it's more a hardware thing than a software thing?
Well. I'm not completely sure. I've never run into any similar issue with the previous version of the crate (using the same hardware).
To me, the bug is somehow related to the delay.
Yes, there was an issue with the delay. That's why I added a patch in Cargo.toml.
seems like this was introduced here when upgrading embedded-hal https://github.com/VersBinarii/bme280-rs/commit/960eaa76edcda97eb5224485499f4cb569f06acd#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759L590
I just merged the PR and published the new version.
With this code (to read the weather with esp32-c3 and bm280):
And I get this error:
It panics here:
It's strange because this almost identical code works:
What could be the issue with the first code?