Limit counter in rotary encoder

:relaxed:
Hi homies
I am using this encoder: Encoder Library, for Measuring Quadarature Encoded Position or Rotation Signals
My rotary encoder increases/decreases a byte from 1 up to 255, and then starts from 1 if I continue to turn the knob, like this: ...254 - 255 -1 -2 -3...etc...

How can I make it stop at 255 and not just start from 1?
I assume the tricky part is happening in the header file, and it's really too advanced for me right now.

It would help if you actually posted the code or a link of where it is. The link you provided did not show what code you were using. The only code did not have the restrictions you obeserve.

How can I make it stop at 255 and not just start from 1?

Before you increment you test the value and only increment if the number is less than 255.

Yes that would be a good solution.
But I have looked in the header file, and I can't find the place where the counter is incremented

That's because code typically isn't place in header files. Look for the .cpp file in the library folder and modify that.

Be careful modifying library files, as you will cause them to be inconsistent with the released version, and then if you should update the library some day, all of your programs that rely on your modified version will break. It might be better to use the library function to read the value of the rotary encoder, then, within your program, check the value and compare it to a previous value and correct if it has rolled over.