Skip to content

motion: read the 64-bit axis jog-counts without truncating - #4804

Merged
BsAtHome merged 1 commit into
LinuxCNC:masterfrom
grandixximo:axis-jog-counts-sint
Nov 9, 2026
Merged

BsAtHome merged 1 commit into
LinuxCNC:masterfrom
grandixximo:axis-jog-counts-sint

Conversation

@grandixximo

Copy link
Copy Markdown
Contributor

axis.L.jog-counts is a SINT pin, but axis_handle_jogwheels() read it with hal_get_si32() while the previous count and the delta are 64-bit. When the counts cross 2^31 the delta comes out near -2^32 for one cycle: the target falls outside the limits and the jog is dropped (the break also skips the remaining axes that cycle), or with jog-vel-mode the axis runs back by its stopping distance. The joint wheel jog already reads its counts with hal_get_sint().

Found while looking at #4796: with ilowpass now 64-bit, its output can cross 2^31 like any other counts source.

The jogwheel-axis test now presets the counts to 2^31 - 2 with jog-enable off and jogs 4 counts across 2^31. It fails without the fix (x does not move) and passes with it, also under parallel load.

axis.L.jog-counts is a SINT pin, but the wheel jog read it with
hal_get_si32() while the previous count and the delta are 64-bit. When
the counts crossed 2^31 the delta came out near -2^32 for one cycle: the
target fell outside the limits and the jog was dropped, or with
jog-vel-mode the axis ran back by its stopping distance. The joint wheel
jog already reads its counts with hal_get_sint().

The jogwheel-axis test now jogs across 2^31.
@BsAtHome

BsAtHome commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Well, right then. This is just part of making the code 64-bit clean...

You sent a PR before I was able to write comment #4796 (comment)

@grandixximo

Copy link
Copy Markdown
Contributor Author

Yes I saw that, sorry, I can close, didn't know you had it ready

@grandixximo

Copy link
Copy Markdown
Contributor Author

Close if you'd prefer to send your own

@BsAtHome

BsAtHome commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

No, that is fine. It needs to be done regardless.

@BsAtHome
BsAtHome merged commit 9acc932 into LinuxCNC:master Nov 9, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants