bertmelis / esp32DHT

DHT library for ESP32 using the RMT peripheral
MIT License
27 stars 9 forks source link

Stopped working in the latest esp32 library #7

Closed htmltiger closed 2 years ago

htmltiger commented 2 years ago

Hi,

I have been using this for some time and working fine but since this commit https://github.com/espressif/arduino-esp32/pull/6259 or something around that time stopped working. the last known good working arduino-esp32 was downloaded on 13/02/2022 and is working fine but newer versions it don't get any temperature values. Please check if there is something that is stopping the show.

Thank you.

bertmelis commented 2 years ago

Willdo.

htmltiger commented 2 years ago

replaced the following 2 files from 13/02 version and it worked so its confirmed that 6259 is the one that affects this.

cores/esp32/esp32-hal-gpio.c
cores/esp32/esp32-hal-gpio.h
bertmelis commented 2 years ago

The problem is that on ESP32 the pin that is used for communicating with the DHT sensor has to be switched from "GPIO" to "RMT" and this takes a certain amount of time. Switching before the RMT is ready results in losing the first pulses. Switching too late obviously has the same result.

The actual switching is done here: https://github.com/bertmelis/esp32DHT/blob/master/src/esp32DHT.cpp#L111

Unfortunately I haven't found a reliable way to do this just in time. So whenever the underlying code (Arduino framework) changes, the timing might be off and the library stops working.

So I have to build my test setup again and do some trial and error with the logic analyzer.

htmltiger commented 2 years ago

thanks for the pointers, i have managed to track the changes and created the pull.