Hi, I wanted to add my my .02. First the work here is really good especially for low speed. The fact that you were able to build a solution that works with all sorts of different HW is impressive. I understand you are dealing with a lot of random crappy hardware, I'm using some myself. I find that if I turn the rotary just fast enough to trigger the fast bit i.e. 3 vs 2. I will start to get bounces. The encoder always bounces with a high speed 1 in the other direction. I would think a small state machine on the last X values would help out here. If the last 2-3 values were high speed and then very next one is a high speed in reverse this should get dropped once. If it is a low speed in the reverse direction (0) take it. I'm turning at a rate to generate an event at 50-100ms which seems within reason.
20:04:39.044 -> 6,SR_TRIM,2;
20:04:39.091 -> 6,SR_TRIM,2;
20:04:39.185 -> 6,SR_TRIM,3;
20:04:39.278 -> 6,SR_TRIM,1;
20:04:39.325 -> 6,SR_TRIM,3;
20:04:39.372 -> 6,SR_TRIM,3;
20:04:39.467 -> 6,SR_TRIM,3;
20:04:39.511 -> 6,SR_TRIM,3;
20:04:39.558 -> 6,SR_TRIM,1;
20:04:39.652 -> 6,SR_TRIM,3;
20:04:39.699 -> 6,SR_TRIM,3;
20:04:39.792 -> 6,SR_TRIM,3;
20:04:39.839 -> 6,SR_TRIM,3;
20:04:39.933 -> 6,SR_TRIM,1;
20:04:39.981 -> 6,SR_TRIM,3;
20:04:40.075 -> 6,SR_TRIM,3;
20:04:40.122 -> 6,SR_TRIM,3;
20:04:40.215 -> 6,SR_TRIM,3;
20:04:40.309 -> 6,SR_TRIM,3;
20:04:40.356 -> 6,SR_TRIM,3;
20:04:40.450 -> 6,SR_TRIM,3;
20:04:40.495 -> 6,SR_TRIM,3;
20:04:40.588 -> 6,SR_TRIM,1;
20:04:40.635 -> 6,SR_TRIM,3;
20:04:40.682 -> 6,SR_TRIM,3;
20:04:40.776 -> 6,SR_TRIM,3;
20:04:40.823 -> 6,SR_TRIM,3;
20:04:40.917 -> 6,SR_TRIM,3;
20:04:40.963 -> 6,SR_TRIM,1;
20:04:41.044 -> 6,SR_TRIM,3;
20:04:41.091 -> 6,SR_TRIM,3;
20:04:41.185 -> 6,SR_TRIM,3;
20:04:41.232 -> 6,SR_TRIM,3;
20:04:41.325 -> 6,SR_TRIM,3;
20:04:41.372 -> 6,SR_TRIM,3;
20:04:41.467 -> 6,SR_TRIM,1;
20:04:41.557 -> 6,SR_TRIM,3;
20:04:41.604 -> 6,SR_TRIM,3;
20:04:41.698 -> 6,SR_TRIM,3;
20:04:41.792 -> 6,SR_TRIM,3;
20:04:41.839 -> 6,SR_TRIM,2;
20:04:41.886 -> 6,SR_TRIM,3;
20:04:41.981 -> 6,SR_TRIM,3;
20:04:42.028 -> 6,SR_TRIM,3;
20:04:42.121 -> 6,SR_TRIM,3;
20:04:42.168 -> 6,SR_TRIM,1;
20:04:42.262 -> 6,SR_TRIM,3;
20:04:42.356 -> 6,SR_TRIM,3;
20:04:42.403 -> 6,SR_TRIM,3;
20:04:42.496 -> 6,SR_TRIM,3;
20:04:42.578 -> 6,SR_TRIM,3;
20:04:42.671 -> 6,SR_TRIM,3;
20:04:42.718 -> 6,SR_TRIM,3;
20:04:42.812 -> 6,SR_TRIM,3;
20:04:42.859 -> 6,SR_TRIM,1;
20:04:42.989 -> 6,SR_TRIM,3;
20:04:43.083 -> 6,SR_TRIM,3;
20:04:43.130 -> 6,SR_TRIM,3;
20:04:43.224 -> 6,SR_TRIM,3;
20:04:43.270 -> 6,SR_TRIM,3;
20:04:43.317 -> 6,SR_TRIM,3;
20:04:43.364 -> 6,SR_TRIM,3;
20:04:43.411 -> 6,SR_TRIM,1;
20:04:43.467 -> 6,SR_TRIM,3;
20:04:43.561 -> 6,SR_TRIM,3;
20:04:43.607 -> 6,SR_TRIM,3;
20:04:43.701 -> 6,SR_TRIM,1;
20:04:43.748 -> 6,SR_TRIM,3;
20:04:43.842 -> 6,SR_TRIM,3;
20:04:43.889 -> 6,SR_TRIM,3;
20:04:43.988 -> 6,SR_TRIM,3;
20:04:44.035 -> 6,SR_TRIM,3;
20:04:44.081 -> 6,SR_TRIM,1;
20:04:44.175 -> 6,SR_TRIM,3;
20:04:44.269 -> 6,SR_TRIM,3;
20:04:44.316 -> 6,SR_TRIM,3;
20:04:44.410 -> 6,SR_TRIM,3;
20:04:44.496 -> 6,SR_TRIM,3;
20:04:44.590 -> 6,SR_TRIM,2;
20:04:44.637 -> 6,SR_TRIM,2;
20:04:44.731 -> 6,SR_TRIM,3;
20:04:44.778 -> 6,SR_TRIM,1;
20:04:44.871 -> 6,SR_TRIM,3;
20:04:44.918 -> 6,SR_TRIM,3;
20:04:45.012 -> 6,SR_TRIM,3;
20:04:45.059 -> 6,SR_TRIM,3;
20:04:45.152 -> 6,SR_TRIM,3;
20:04:45.246 -> 6,SR_TRIM,3;
20:04:45.293 -> 6,SR_TRIM,1;
All sort of documentation out there for software solutions (https://www.best-microcontroller-projects.com/rotary-encoder.html). I'm thinking I might look at building a few ICs with an ELM401 or something like this: https://hackaday.io/project/162207-hardware-debounced-rotary-encoder