michaelbeaumont / dht-sensor

Rust embedded-hal based driver for the DHT11/DHT22 sensor
MIT License
26 stars 16 forks source link

When in debug mode, the implementation is (presumably) too slow and returns a Timeout (ESP32C3) #26

Closed reivilibre closed 8 months ago

reivilibre commented 8 months ago

It might be nice to include a note in the readme alerting people to the fact that you should try the library in --release mode.

In my case (on an ESP32C3), in debug mode, the library does not work. I think this is because the timings are messed up due to poor code performance, but I'm not sure as I didn't research much further. (I already spent a long time wondering if my open-drain config was wrong on this board for some reason; another HAL for it has a dedicated open drain in-out mode which this HAL does not, so I was wondering if it was a shortcoming of this HAL).

(as a note: I think there is a way to override the compilation level for a single dependency crate, so we can do that in our top-level projects if we still want debug mode for some reason. But beware that it's possible that the Delay or Pin implementations could be to blame, rather than just this crate)

michaelbeaumont commented 8 months ago

Sure, do you want to open a PR?

reivilibre commented 8 months ago

I have opened one.

Thanks for the crate, by the way!