On 04/25/2020 11:52 AM, andy pugh wrote:
So, swapping "long" for "int32_t" should make it work like it used to.
Actually, it has to be hal_s32_t.
The next question is whether you would prefer to store counts as 64
bits to be sure that nobody wraps an encoder while this universe
exists.
(the other encoder counters all use 64 bit accumulators)

Yes, this is a good thought. But, since the current version exports a signed 32-bit raw count, changing this to 64 would make the change visible outside the driver. I'm not sure if anybody is actually using the exported raw encoder counts, though,
so it might NOT make any difference.

Then, of course, I'd have to test it on a 32-bit system, as well.

32-bits signed allows the encoder count to reach _2 billion and - 2 billion counts, so for a 1 million count/inch encoder you'd still have a travel limit of 2000 inches or 166 feet each side of zero. Maybe this change to a full 64-bit implementation could be pushed off until somebody actually asks for it. Also, the count rate limits on the PPMC devices makes it a bit less useful to have insane range on these position counts as it will take a LONG
time to reach them.

Well, I'm open to comments, and will have to study the code a bit more to see how hard
this might be to implement.

I did just commit and push the small version of this change, after testing it.

Thanks for the help, guys!

Jon



_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to