Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Units in Grbl mode #3

Merged
merged 2 commits into from
Sep 18, 2017
Merged

Units in Grbl mode #3

merged 2 commits into from
Sep 18, 2017

Conversation

MitchBradley
Copy link
Collaborator

I tried to fix the mm/in problem in Grbl mode and mostly succeeded, after a lot of effort. The fundamental difficulty is that the units for Grbl's position reports depend on the $13 setting, and cncjs does not maintain up-to-date knowledge of that setting, nor does it synchronize that knowledge with its copy of that position state.

To make things work "mostly right", the pendant asks for the settings on startup and also tracks $13= commands that might be issued via the serial console. That works except in a rare circumstance. There is an additional complication that the pendant receives its initial state report prior to the settings response, which required some work to delay the handling of the initial state report.

There are still a couple of problems, which are related to one another:

  1. cncjs itself does not handle Grbl units correctly if $13=1 (inch reporting mode). It seems to assume implicitly that $13=0
  2. If you issue $13=1 in the serial console, then immediately restart the pendant, its initial DROs will be wrong because cncjs has a stale copy of the positions in mm units and that is what it tells the pendant.

One possible solution would be to disallow $13=1 when used with cncjs. That is a potential source of confusion for a user whose machine has that setting. It would be possible for cncjs to force the $13=0 setting, but that has its own problem in the case where you use both cncjs and other apps to drive the machine. But maybe that is okay considering how poorly most other Grbl senders handle units.

The best solution, from the standpoint of "just works", would be for the cncjs server app to keep track of $13 and synchronize its position state to the initial value of $13 and later changes.

Please feel free to reject this pull request if you think its too much of a can of worms. I'm submitting it as an example of the scope of the problem.

@cheton cheton merged commit 5fb7640 into cncjs:master Sep 18, 2017
@cheton
Copy link
Contributor

cheton commented Sep 18, 2017

Thank you for the PR. I think the $13 setting should be handled in CNCjs as well. Could you post an issue on https://github.com/cncjs/cncjs/issues so I can keep track of it?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants