CNC pendant encoder skipping step
-
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 -
@morgoth90 Thanks for your 'input'! I've added a note on the Pendant wiki instructions referencing this thread, here: https://docs.duet3d.com/en/User_manual/Connecting_hardware/IO_CNC_Pendant#programming-the-arduino-pro-micro
Ian
-
-
@morgoth90 Your RotaryEncoder.h file has:
#include <Arduino.h> #include <Encoder.h>
Can you link to the source of these files? I think Arduino.h is okay (I think it's included in the Arduino IDE), but a link to the correct Encoder.h file is needed.
See the post in this thread: https://forum.duet3d.com/post/346952
Ian
-
@droftarts
Right, probably was included in the available libraries because time ago i was sperimenting with a teensy controller.
The encoder library is from here:
https://github.com/PaulStoffregen/Encoder