Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

dead spot at max and min boundaries when wrap set to false #5

Closed
Cat30Mk3 opened this issue Feb 23, 2024 · 5 comments
Closed

dead spot at max and min boundaries when wrap set to false #5

Cat30Mk3 opened this issue Feb 23, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@Cat30Mk3
Copy link

Using your example "BasicRotaryEncoder.ino", with wrap set to false, when counter reaches max or min boundary, the first step in opposite direction does not generate an interrupt. This applies to both max and min boundaries.

@Cat30Mk3
Copy link
Author

Cat30Mk3 commented Feb 23, 2024

Hi Mathew, I just discovered your "LeftOrRight.ino" example, and confirmed it presents the same issue:
stepping the encoder clockwise functions correctly, (continuously raising interrupts and reporting "Right ->") but the first step counterclockwise IS LOST EVERY TIME. Then, as I continue counterclockwise it functions correctly raising interrupts and reporting "<- Left". Then the first step clockwise IS LOST EVERY TIME. I'm using a basic encoder without VCC pin, and an ESP32-WROOM-32E. EncoderType::FLOATING

@cwkowalski
Copy link

I just setup this library to test an EC11J rotary encoder (a 5-pin with a switch) on an ESP32-S3. I have a similar, but not identical issue-- it only counts every other rotation of the encoder. Otherwise, it's a brilliantly easy and lightweight library. Perhaps this is because of the encoder type, I'll investigate further.

@MaffooClock
Copy link
Owner

@Cat30Mk3: Interesting observation.

I've got a couple of commits to push, and there's a chance that this would be fixed in those (I haven't investigated thoroughly), so I'll take care of those and then test for this...

@MaffooClock
Copy link
Owner

@Cat30Mk3:

I was able to observe exactly what you reported: the first turn in the opposite direction of the previous turn was being ignored. But before I could begin investigating, I noticed that a proposed change in issue #4, which turned out to be invalid, seemed to magically resolve this issue.

I didn't take the time to understand why it fixed the problem, though. But as I mentioned in my comment, the resolution was repeatable: the "dead spot" behavior returned after reverting the change, and resolved again after re-applying the fix. Of course, I'd like to know why this seems to have fixed it, but I'll just take the win 😎

@cwkowalski:

I looked at the EC11J rotary encoder datasheet and compared it to the KY-040 I've been using. Other than physical form, the only difference seemed to be the number of detents/pulses, which wouldn't matter to this library (it only cares about the transition from one detent to the next).

If you have the raw encoder instead of a pre-built module, I assume you added the pull-up resistors to the A and B pins (to 3v3) and C is grounded. So I wouldn't have any idea why it would behave in the way you describe.

Regardless, I'm going to assert that the problem you are experiencing is not the same as what was originally reported in this issue.

@Cat30Mk3
Copy link
Author

Cat30Mk3 commented Jan 31, 2025 via email

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants