From 6a4aec9e9640ed1a4e8b41566c4f8be50a91e6f3 Mon Sep 17 00:00:00 2001 From: UncleRus Date: Sun, 4 Feb 2024 19:30:35 +0500 Subject: [PATCH] fix: fixes #587 --- components/encoder/Kconfig | 3 ++- components/encoder/encoder.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/components/encoder/Kconfig b/components/encoder/Kconfig index 5ef2a56c..d1990a0b 100644 --- a/components/encoder/Kconfig +++ b/components/encoder/Kconfig @@ -6,7 +6,8 @@ menu "Rotary encoders" config RE_INTERVAL_US int "Polling interval, us" - default 1000 + default 10000 if IDF_TARGET_ESP8266 + default 1000 if !IDF_TARGET_ESP8266 config RE_BTN_DEAD_TIME_US int "Button dead time, us" diff --git a/components/encoder/encoder.c b/components/encoder/encoder.c index 06b64e83..4be63aa4 100644 --- a/components/encoder/encoder.c +++ b/components/encoder/encoder.c @@ -48,6 +48,10 @@ #define BTN_PRESSED_LEVEL 1 #endif +#if defined(CONFIG_IDF_TARGET_ESP8266) && CONFIG_RE_INTERVAL_US < 10000 +#error Too small CONFIG_RE_INTERVAL_US! For ESP8266 it should be >= 10000 +#endif + static const char *TAG = "encoder"; static rotary_encoder_t *encs[CONFIG_RE_MAX] = { 0 }; static const int8_t valid_states[] = { 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 };