Skip to content

Encoder is not responsive with long tasks in loop #431

Open
@leelx78

Description

@leelx78

Hi @davetcc I open a card here because it looks like the issue is with the encoder class.

This is on ESP32-S3.

let's consider a case where there is a function in the main loop which takes a set amount of time (5.5ms in my case), e.g.

void loop()
{
  taskManager.runLoop();
 
  DEVICE.loopFunction(); // this function takes 5.5ms
}

In this case if I use a third party library for the encoder I can simply flag an "ENCODER_ROTATED_CW" event into an ISR whenever the encoder transition happens and then react to it at the next loop. Works well but unfortunately if I use this approach I would need to manually pass these events into MenuManager which is not ideal.

If I use your rotary encoder implementation (either polling or via interrupts) it seems to miss most of the events. From what I see if the transition happens during DEVICE.loopFunction() it is just ignored, while the other library correctly flags it down.

I had a look at your RotaryEncoder classes but I couldn't see the issue so far. Do you have any suggestions?

Thanks as always!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions