try changing line 38 from:
out = (int)(rtapi_s64)(value * scale);
to
out = (int)(rtapi_s64)((value * scale)+0.5);
This looks like a case where the floating point 'value' might be 3.999, but
the conversion to integer results in 3
Adding 0.5 makes it round to the nearest integer.
Gentlemen,
Having the problem on 4 mpg's (three single and on diff) I am relatively
sure the problem isn't hardware.
Halshow (watch) shows the encoder counts accurate and ilowpass counts are
incorrect I suspect ilowpass.
ilowpass is so simple it is almost impossible to see how it could be
On Friday 31 March 2017 11:32:53 Kenneth Lerman wrote:
> Up the thread a ways, Gene commented that the MPG generates one count
> per detent.
>
It does not, the encoder scale is set to 4, so at the encoder out,
one "click" is 4, but later I mult2 that by .250, and this is what
is fed to
Up the thread a ways, Gene commented that the MPG generates one count per
detent.
I thought that the encoder in the MPG generates one *cycle* per detent. A
cycle is represents four quadrature edges which means that you get four
counts per cycle. So that's four counts per detent.
There is a