Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIFI Example does not compile with the esp_idf_svc crate recommended in the esp-rs book #242

Open
juliankrieger opened this issue Mar 18, 2024 · 6 comments

Comments

@juliankrieger
Copy link
Contributor

juliankrieger commented Mar 18, 2024

When running a project templated by esp-idf-template and adding wifi.rs from common, I can not successfully run cargo build.

I must admit, I'm a bit confused on the use of heapless in the esp_idf_svf::wifi Component. I thought the whole point of using the std feature flag was to enable the use of std::String.

Note that I am aware of #233 and the usage of heapless:v.08, however, since the esp-rs book links to std-training and std-training uses esp_idf_svc:v.0.47.3 and neither crate uses Semver past 1.0, users (like me) could be rightfully confused on compilation errors when using the esp-idf-template instead of the provided workshop repository.

I think we should consider moving from .into to try_from, as the documentation of heapless suggests.

Error:

error[E0277]: the trait bound `heapless::string::String<64>: From<&str>` is not satisfied
  --> src/wifi.rs:59:24
   |
59 |         password: pass.into(),
   |                        ^^^^ the trait `From<&str>` is not implemented for `heapless::string::String<64>`, which is required by `&str: Into<_>`
   |
   = note: required for `&str` to implement `Into<heapless::string::String<64>>`
@juliankrieger juliankrieger changed the title WIFI Example does not compile: 'static str is not convertible to heapless::string::String<32> WIFI Example does not compile with the esp_idf_svc crate recommended in the esp-rs book Mar 18, 2024
@Vollbrecht
Copy link
Contributor

Yeah that is not ideal. The overall correct way would be to update the training to the latest esp-idf-svc release. Thanks for bringing up the issue.

@juliankrieger
Copy link
Contributor Author

@Vollbrecht I wouldn't mind helping out.

@Vollbrecht
Copy link
Contributor

Feel free to create a PR, it probably would be enough to update every occurrence of esp-idf-svc in the Cargo.toml and test if all solution examples still work. Besides the mention wifi problem the esp-idf-svc API that is used in the training should not have changed much.

@juliankrieger
Copy link
Contributor Author

juliankrieger commented Mar 18, 2024

On it. What's to determine is if using .try_into.unwrap() is sufficient. Alternatively, one would need to implement error handling in the style of anyhow for conversion errors.

@Vollbrecht
Copy link
Contributor

Vollbrecht commented Mar 18, 2024

I think the training is using anyhow, so an context() with a panic massage would be ok here

@juliankrieger
Copy link
Contributor Author

Done. Works on my machine. #243

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

2 participants