fix for #3276
due to `if (strip.isUpdating()) return;` reading the encoder did not happen in time if the strip was active - with high number of LEDs, this means "always updating". Similar observation that we had with the audioreactive usermod, and similar solution.
This commit is contained in:
parent
c89f38f4f8
commit
45ac0d5dc6
@ -45,6 +45,10 @@
|
|||||||
#define ENCODER_SW_PIN 19
|
#define ENCODER_SW_PIN 19
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENCODER_MAX_DELAY_MS // max delay between polling encoder pins
|
||||||
|
#define ENCODER_MAX_DELAY_MS 8 // 8 milliseconds => max 120 change impulses in 1 second, for full turn of a 30/30 encoder (4 changes per segment, 30 segments for one turn)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef USERMOD_USE_PCF8574
|
#ifndef USERMOD_USE_PCF8574
|
||||||
#undef USE_PCF8574
|
#undef USE_PCF8574
|
||||||
#define USE_PCF8574 false
|
#define USE_PCF8574 false
|
||||||
@ -539,8 +543,9 @@ void RotaryEncoderUIUsermod::setup()
|
|||||||
*/
|
*/
|
||||||
void RotaryEncoderUIUsermod::loop()
|
void RotaryEncoderUIUsermod::loop()
|
||||||
{
|
{
|
||||||
if (!enabled || strip.isUpdating()) return;
|
if (!enabled) return;
|
||||||
unsigned long currentTime = millis(); // get the current elapsed time
|
unsigned long currentTime = millis(); // get the current elapsed time
|
||||||
|
if (strip.isUpdating() && ((currentTime - loopTime) < ENCODER_MAX_DELAY_MS)) return; // be nice, but not too nice
|
||||||
|
|
||||||
// Initialize effectCurrentIndex and effectPaletteIndex to
|
// Initialize effectCurrentIndex and effectPaletteIndex to
|
||||||
// current state. We do it here as (at least) effectCurrent
|
// current state. We do it here as (at least) effectCurrent
|
||||||
|
Loading…
Reference in New Issue
Block a user