From ec3729f5cde309367f6b236414b82da37b42bb31 Mon Sep 17 00:00:00 2001 From: robert-hh Date: Thu, 21 Dec 2017 17:52:48 +0100 Subject: [PATCH] modpycom.c/pulses_get(): prevent lock-up at long pulses The longest pulse with was set to 20ms. The were some observations that pulses_get() kind of locked up at longer pulses. Setting the maximal pulse width to 0xffff avoids this situation. Even it the pulse width is longer than 65ms, the device recovers at shorter pulses. This value is also used by espressif's examples. --- esp32/mods/modpycom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esp32/mods/modpycom.c b/esp32/mods/modpycom.c index 8eca82ea9d..7b505933c0 100644 --- a/esp32/mods/modpycom.c +++ b/esp32/mods/modpycom.c @@ -110,7 +110,7 @@ STATIC mp_obj_t mod_pycom_pulses_get (mp_obj_t gpio, mp_obj_t timeout) { rmt_rx.rmt_mode = RMT_MODE_RX; rmt_rx.rx_config.filter_en = true; rmt_rx.rx_config.filter_ticks_thresh = 100; - rmt_rx.rx_config.idle_threshold = 20000; + rmt_rx.rx_config.idle_threshold = 0xffff; rmt_config(&rmt_rx); RingbufHandle_t rb = NULL;