igorantolic / ai-esp32-rotary-encoder

Easy implement rotary encoder to your application using microcontroler like ESP32
GNU General Public License v2.0
284 stars 70 forks source link

For ESP32 - Issue with the "Circling" Option #40

Closed VonHirsch closed 1 year ago

VonHirsch commented 2 years ago

This library is a great idea (boundaries & acceleration) and thank you! However on ESP32 there are bugs when using the "circleValues" feature (when max go to min and vice versa.) I would like to try and debug and fix, but when looking at the code, my opinion it needs a whole re-write, and I'm not up to that at the moment unfortunately.

I'm switching to something like this, and adding the other features as needed: https://github.com/buxtronix/arduino/tree/master/libraries/Rotary

igorantolic commented 2 years ago

Not šute what was the issue with Circle values but as I remember example worked

Have you checked all examples using this?

Circle calues should be very simple and usually used on menu selections

In some other use cases that are not covered we should first wrote use cases and then do the fix to Match the expectations

I understand that many features cause many scenarios so some might not be tested when using some combinations

sub, 28. svi 2022. u 15:20 VonHirsch @.***> napisao je:

This library is a great idea (boundaries & acceleration) and thank you! However on ESP32 there are bugs when using the "circleValues" feature (when max go to min and vice versa.) I would like to try and debug and fix, but when looking at the code, my opinion it needs a whole re-write, and I'm not up to that at the moment unfortunately.

I'm switching to something like this, and adding the other features as needed: https://github.com/buxtronix/arduino/tree/master/libraries/Rotary

— Reply to this email directly, view it on GitHub https://github.com/igorantolic/ai-esp32-rotary-encoder/issues/40, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMDZQASJ7I3N3FWJXTKSADVMIMQHANCNFSM5XGUQ4RA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

VonHirsch commented 2 years ago

Sure, happy to provide output from the examples. The only thing I changed in the examples was PIN B to 19 and Encoder Steps to 2 for my circuit and hardware:

#define ROTARY_ENCODER_B_PIN 19
#define ROTARY_ENCODER_STEPS 2

Details:

Here's the output of the "Esp32RotaryEncoderBasics.ino" sketch. Everything working perfectly, Notice I get only one change in value per click of the encoder:

One Line = One Encoder Click image

Now here's the output of "Multi-select.ino" on the same exact hardware and encoder setup. I've enabled "Show Timestamp" in the Arduino output and put a red box around those with the same timestamp where I get more than one change when turning the encoder one click:

Multiple Changes per Encoder Click (In Red Squares) image

Conclusion: When the "Circling" option is enabled there are often multiple changes per click of the encoder.

igorantolic commented 2 years ago

is it the same when using

define ROTARY_ENCODER_STEPS 4

does the change of this parameter to values 1,2 and 4 does any difference?

It sounds like doubling the param should help

On Sun, May 29, 2022 at 2:53 PM VonHirsch @.***> wrote:

Sure, happy to provide output from the examples. The only thing I changed in the examples was PIN B to 19 and Encoder Steps to 2 for my circuit and hardware.

define ROTARY_ENCODER_B_PIN 19

define ROTARY_ENCODER_STEPS 2

Here's the output of the "Esp32RotaryEncoderBasics.ino" sketch. Everything working perfectly, Notice I get only one change in value per click of the encoder:

One Line = One Encoder Click [image: image] https://user-images.githubusercontent.com/3280180/170869208-372c35c7-5c7e-4d13-b584-2828c827948f.png

Now here's the output of "Multi-select.ino" on the same exact hardware and encoder setup. I've enabled "Show Timestamp" in the Arduino output and put a red box around those with the same timestamp. Those are the places where I get more than one change when turning the encoder one click:

Multiple Changes per Encoder Click (In Red Squares) [image: image] https://user-images.githubusercontent.com/3280180/170869433-71b43597-af48-44f6-8d1b-b6c001a88d4a.png

Conclusion: When the "Circling" option is enabed there are multiple changes per click of the encoder.

— Reply to this email directly, view it on GitHub https://github.com/igorantolic/ai-esp32-rotary-encoder/issues/40#issuecomment-1140443379, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMDZQHR6VZO4AHK6YIUTSDVMNSDDANCNFSM5XGUQ4RA . You are receiving this because you commented.Message ID: @.***>

VonHirsch commented 2 years ago

If I define steps as 4 then the encoder only changes value every other click

igorantolic commented 2 years ago

ok so for you the best. value is 2

try setAcceleration(0) or (1) using rotaryEncoder.setAcceleration(acceletation);

On Mon, May 30, 2022 at 2:37 PM VonHirsch @.***> wrote:

If I define steps as 4 then the encoder only changes value every other click

— Reply to this email directly, view it on GitHub https://github.com/igorantolic/ai-esp32-rotary-encoder/issues/40#issuecomment-1141108734, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMDZQG4DUSEACY5YERNMZTVMSZB7ANCNFSM5XGUQ4RA . You are receiving this because you commented.Message ID: @.***>

VonHirsch commented 2 years ago

I thought acceleration might be causing the issue, but when I disable it with setAcceleration(0) still the same issue.

igorantolic commented 2 years ago

I am on a vacation and unable to try this If you find a solution let me know It is not expected that if numeric value changes normally that it will behave differently in this example

On Mon, May 30, 2022 at 3:06 PM VonHirsch @.***> wrote:

I thought acceleration might be causing the issue, but when I disable it with setAcceleration(0) still the same issue.

— Reply to this email directly, view it on GitHub https://github.com/igorantolic/ai-esp32-rotary-encoder/issues/40#issuecomment-1141136475, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMDZQHF727DRWBMHOLKWRLVMS4NXANCNFSM5XGUQ4RA . You are receiving this because you commented.Message ID: @.***>

VonHirsch commented 2 years ago

sure no problem. I looked for an obvious bug in the code but couldn't find it but I hope you can! Thanks again for the library.

VonHirsch commented 2 years ago

sure no problem. I looked for an obvious bug in the code but couldn't find it but I hope you can! Thanks again for the library.

On Mon, May 30, 2022 at 9:22 AM Igor @.***> wrote:

I am on a vacation and unable to try this If you find a solution let me know It is not expected that if numeric value changes normally that it will behave differently in this example

On Mon, May 30, 2022 at 3:06 PM VonHirsch @.***> wrote:

I thought acceleration might be causing the issue, but when I disable it with setAcceleration(0) still the same issue.

— Reply to this email directly, view it on GitHub < https://github.com/igorantolic/ai-esp32-rotary-encoder/issues/40#issuecomment-1141136475 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ABMDZQHF727DRWBMHOLKWRLVMS4NXANCNFSM5XGUQ4RA

. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/igorantolic/ai-esp32-rotary-encoder/issues/40#issuecomment-1141155416, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZA2NHAQF5CVBFJUKFO273VMS6KXANCNFSM5XGUQ4RA . You are receiving this because you authored the thread.Message ID: @.***>

igorantolic commented 1 year ago

Fixed. (Was a bit complex due to the logic)