I was trying the firmware on an Arduino nano: https://github.com/Duet3D/CNC-Pendant-Firmware/tree/master
After a few fast encoder rotations the detected pulses disalign resulting in two stray pulses after each detected movement:
pulse1
pulse2
pulse3
pulse4
MOVEMENT +1
... after some fast movements...
pulse3
pulse4
MOVEMENT +1
pulse 1
pulse 2
This behaviour is probably caused by some missed pulse but as result will ignore the first movement in the opposite direction.
After some tests I fixed the issue rewriting the encoder code using the arduino Encoder library:
RotaryEncoder.cpp
RotaryEncoder.h