Closed enelson1001 closed 2 years ago
Hello, That was due to the new alpha version being released. I locked it down to the alpha.7 version in Cargo.toml. Please delete Cargo.lock file in your project and try latest version: https://crates.io/crates/bme280
I had another library that forced embedded-hal to be 1.0.0-alpha.8 so I ended up updating spi.rs to use alpha.8 Would you like me to submit a pull request? It could probably use some more updating - not sure if SPIError is needed anymore?
Now I am trying to figure out how to use shared_bus for i2c since I have 2 - i2c devices that share the same bus and eventually want to use threads.
Well. for the bme280 crate it would suffice for you to just upgrade to version 0.4.4 ;)
Tried using version 0.4.4 but this is the error I receive.
Updating crates.io index
error: failed to select a version for `embedded-hal`.
... required by package `esp-idf-hal v0.37.4`
... which satisfies dependency `esp-idf-hal = "^0.37.4"` of package `ttgo-bme280 v0.1.0 (/home/ed/esp-rust-projects/ttgo-bme280)`
versions that meet the requirements `=1.0.0-alpha.8` are: 1.0.0-alpha.8
all possible versions conflict with previously selected packages.
previously selected package `embedded-hal v1.0.0-alpha.7`
... which satisfies dependency `embedded-hal = "=1.0.0-alpha.7"` of package `bme280 v0.4.4`
... which satisfies dependency `bme280 = "^0.4.4"` of package `ttgo-bme280 v0.1.0 (/home/ed/esp-rust-projects/ttgo-bme280)`
failed to select a version for `embedded-hal` which could resolve this conflict
That error references ttgo-bme280. It is not this crate. Are you sure you're not mixing up crates in your project?
ttgo-bme280 is my project. my project Cargo.toml
[package]
name = "ttgo-bme280"
version = "0.1.0"
authors = ["enelson1001 <ednelson5080@gmail>"]
edition = "2018"
resolver = "2"
[profile.release]
opt-level = "s"
[profile.dev]
debug = true # Symbols are nice and they don't increase the size on Flash
opt-level = "z"
[features]
pio = ["esp-idf-sys/pio"]
[dependencies]
esp-idf-sys = { version = "0.31.5", features = ["binstart"] }
esp-idf-hal = "0.37.4"
esp-idf-svc = "0.41.3"
embedded-hal = "0.2.7"
anyhow = {version = "1", features = ["backtrace"]}
log = "0.4"
embedded-graphics = "0.7.1"
display-interface = "0.4"
ssd1306 = "0.7"
bme280 = { version = "0.4.4"}
shared-bus = {git = "https://github.com/Rahix/shared-bus.git", version = "0.2.3", branch = "i2c-eh-alpha", features = ["eh-alpha"]}
[build-dependencies]
embuild = "0.29"
anyhow = "1"
If I use my patched version of 0.4.1 of bme280-rs I do not receive this error. I also have added shared-bus which they have updated to use alpha.8. When I use my patched version of bme280-rs everything compiles and runs.
Not sure what I need to do, to get bme280-rs version 0.4.4 to compile without the above error. Any suggestions welcomed.
OK, i see now. I'm unsure what might be the issue in that case. I cant advise you much beyond deleteing the .lock file and cargo clean. Do you have this project on github somewhere? I could have a quick look at it to see what might be the issue.
I am still in the process of cleaning up the code. I will let you known when I have put on github.
I am new to rust but what I take from the error message is the following.
esp-idf-hal version 0.37.4 requires embedded-hal '=1.0.0-alpha.8'
bme280-rs requires embedded-hal '=1.0.0-alpha.7'
The rust compiler must chose one or the other but not both.
I'm having a similar issue, and am getting the following error:
error: failed to select a version for `embedded-hal`.
... required by package `esp-idf-hal v0.41.1`
... which satisfies dependency `esp-idf-hal = "^0.41"` of package `esp32-c3-playground v0.1.0 (/home/eli/Projects/esp_rust/esp32-c3-playground)`
versions that meet the requirements `=1.0.0-alpha.10` are: 1.0.0-alpha.10
all possible versions conflict with previously selected packages.
previously selected package `embedded-hal v1.0.0-alpha.7`
... which satisfies dependency `embedded-hal = "=1.0.0-alpha.7"` of package `bme280 v0.4.4`
... which satisfies dependency `bme280 = "^0.4.4"` of package `esp32-c3-playground v0.1.0 (/home/eli/Projects/esp_rust/esp32-c3-playground)`
failed to select a version for `embedded-hal` which could resolve this conflict
Here is my Cargo.toml, which was generated via cargo generate esp-rs/esp-idf-template cargo
:
[package]
name = "esp32-c3-playground"
version = "0.1.0"
authors = ["Eli Smith <eli@eliliam.com>"]
edition = "2021"
resolver = "2"
rust-version = "1.66"
[profile.release]
opt-level = "s"
[profile.dev]
debug = true # Symbols are nice and they don't increase the size on Flash
opt-level = "z"
[features]
default = ["std", "hal", "esp-idf-sys/native"]
pio = ["esp-idf-sys/pio"]
all = ["std", "nightly", "experimental", "embassy"]
hal = ["esp-idf-hal", "embedded-svc", "esp-idf-svc"]
std = [
"alloc",
"esp-idf-sys/std",
"esp-idf-sys/binstart",
"embedded-svc?/std",
"esp-idf-hal?/std",
"esp-idf-svc?/std",
]
alloc = ["embedded-svc?/alloc", "esp-idf-hal?/alloc", "esp-idf-svc?/alloc"]
nightly = [
"embedded-svc?/nightly",
"esp-idf-svc?/nightly",
] # Future: "esp-idf-hal?/nightly"
experimental = ["embedded-svc?/experimental", "esp-idf-svc?/experimental"]
embassy = [
"esp-idf-hal?/embassy-sync",
"esp-idf-hal?/critical-section",
"esp-idf-hal?/edge-executor",
"esp-idf-svc?/embassy-time-driver",
"esp-idf-svc?/embassy-time-isr-queue",
]
[dependencies]
log = { version = "0.4.17", default-features = false }
esp-idf-sys = { version = "0.33", default-features = false }
esp-idf-hal = { version = "0.41", optional = true, default-features = false }
esp-idf-svc = { version = "0.46", optional = true, default-features = false }
embedded-svc = { version = "0.25", optional = true, default-features = false }
bme280 = "0.4.4"
[patch.crates-io]
esp-idf-svc = { git = "https://github.com/esp-rs/esp-idf-svc" }
[build-dependencies]
embuild = "0.31.2"
The Cargo.toml file is entirely untouched from what was generated aside from the bme280 dependency.
@enelson1001, were you able to find a solution for your similar issue?
Edit: After finding @markus2330's comment which recommended reverting back to using bme280 version 0.3.0, things seem to be compiling just fine. After testing other versions, it appears that version 0.4.1 compiles fine as well, leading me to believe that there is an issue with version 0.4.4. @VersBinarii do you know what might have changed with version 0.4.4 to cause these issues?
While using version 0.4.1 and recreacting the Cargo.lock file as well as running cargo clean
, I am having issues building the library. My Cargo.lock now contains the following under the bme280 dependency:
[[package]]
name = "bme280"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afa0ec59ce7903e8f6678855e70140b78f2d7a047d5afadf7b14266b020799ae"
dependencies = [
"embedded-hal 1.0.0-alpha.10",
]
And here is the error I am getting while building:
error[E0432]: unresolved import `embedded_hal::delay::blocking`
--> /home/eli/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bme280-0.4.1/src/i2c.rs:3:26
|
3 | use embedded_hal::delay::blocking::DelayUs;
| ^^^^^^^^ could not find `blocking` in `delay`
error[E0432]: unresolved import `embedded_hal::i2c::blocking`
--> /home/eli/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bme280-0.4.1/src/i2c.rs:4:25
|
4 | use embedded_hal::i2c::{blocking::I2c, ErrorType};
| ^^^^^^^^ could not find `blocking` in `i2c`
error[E0432]: unresolved import `embedded_hal::delay::blocking`
--> /home/eli/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bme280-0.4.1/src/spi.rs:3:26
|
3 | use embedded_hal::delay::blocking::DelayUs;
| ^^^^^^^^ could not find `blocking` in `delay`
error[E0432]: unresolved import `embedded_hal::digital::blocking`
--> /home/eli/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bme280-0.4.1/src/spi.rs:4:28
|
4 | use embedded_hal::digital::blocking::OutputPin;
| ^^^^^^^^ could not find `blocking` in `digital`
error[E0432]: unresolved import `embedded_hal::spi::blocking`
--> /home/eli/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bme280-0.4.1/src/spi.rs:5:24
|
5 | use embedded_hal::spi::blocking::Transfer;
| ^^^^^^^^ could not find `blocking` in `spi`
error[E0432]: unresolved import `embedded_hal::delay::blocking`
--> /home/eli/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bme280-0.4.1/src/lib.rs:69:26
|
69 | use embedded_hal::delay::blocking::DelayUs;
| ^^^^^^^^ could not find `blocking` in `delay`
For more information about this error, try `rustc --explain E0432`.
error: could not compile `bme280` (lib) due to 6 previous errors
warning: build failed, waiting for other jobs to finish...
I ended up switching to bme280-rs maintained by Claudio Mattera to resolve the issue.
On Mon, Jul 24, 2023 at 4:30 PM Eli Smith @.***> wrote:
I'm having a similar issue, and am getting the following error:
error: failed to select a version for
embedded-hal
. ... required by packageesp-idf-hal v0.41.1
... which satisfies dependencyesp-idf-hal = "^0.41"
of packageesp32-c3-playground v0.1.0 (/home/eli/Projects/esp_rust/esp32-c3-playground)
versions that meet the requirements=1.0.0-alpha.10
are: 1.0.0-alpha.10all possible versions conflict with previously selected packages.
previously selected package
embedded-hal v1.0.0-alpha.7
... which satisfies dependencyembedded-hal = "=1.0.0-alpha.7"
of packagebme280 v0.4.4
... which satisfies dependencybme280 = "^0.4.4"
of packageesp32-c3-playground v0.1.0 (/home/eli/Projects/esp_rust/esp32-c3-playground)
failed to select a version for
embedded-hal
which could resolve this conflictHere is my Cargo.toml, which was generated via cargo generate esp-rs/esp-idf-template cargo:
[package] name = "esp32-c3-playground" version = "0.1.0" authors = ["Eli Smith @.***>"] edition = "2021" resolver = "2" rust-version = "1.66"
[profile.release] opt-level = "s"
[profile.dev] debug = true # Symbols are nice and they don't increase the size on Flash opt-level = "z"
[features]
default = ["std", "hal", "esp-idf-sys/native"]
pio = ["esp-idf-sys/pio"] all = ["std", "nightly", "experimental", "embassy"] hal = ["esp-idf-hal", "embedded-svc", "esp-idf-svc"] std = [ "alloc", "esp-idf-sys/std", "esp-idf-sys/binstart", "embedded-svc?/std", "esp-idf-hal?/std", "esp-idf-svc?/std", ] alloc = ["embedded-svc?/alloc", "esp-idf-hal?/alloc", "esp-idf-svc?/alloc"] nightly = [ "embedded-svc?/nightly", "esp-idf-svc?/nightly", ] # Future: "esp-idf-hal?/nightly" experimental = ["embedded-svc?/experimental", "esp-idf-svc?/experimental"] embassy = [ "esp-idf-hal?/embassy-sync", "esp-idf-hal?/critical-section", "esp-idf-hal?/edge-executor", "esp-idf-svc?/embassy-time-driver", "esp-idf-svc?/embassy-time-isr-queue", ]
[dependencies] log = { version = "0.4.17", default-features = false } esp-idf-sys = { version = "0.33", default-features = false } esp-idf-hal = { version = "0.41", optional = true, default-features = false } esp-idf-svc = { version = "0.46", optional = true, default-features = false } embedded-svc = { version = "0.25", optional = true, default-features = false } bme280 = "0.4.4"
[patch.crates-io] esp-idf-svc = { git = "https://github.com/esp-rs/esp-idf-svc" }
[build-dependencies] embuild = "0.31.2"
The Cargo.toml file is entirely untouched from what was generated aside from the bme280 dependency.
@enelson1001 https://github.com/enelson1001, were you able to find a solution for your similar issue?
— Reply to this email directly, view it on GitHub https://github.com/VersBinarii/bme280-rs/issues/21#issuecomment-1648712290, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKLXR7YAQRPHQLZJUZJ5MDDXR3ZRFANCNFSM5XS4JF5A . You are receiving this because you were mentioned.Message ID: @.***>
Trying to build (use) bme280-rs with my project. The build fails with the following error.
When I look at my cargo.lock file I see the following.
For my project I am using I2c and not spi for the bme280 device.