-
-
Notifications
You must be signed in to change notification settings - Fork 565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a Grbl jogCancel command #512
Conversation
This is needed- however, I'm finding scenarios where it isn't cancelling.
.. still experimenting. |
364a7fc
to
6325234
Compare
I updated the pull request with a version that makes the jogCancel command reliable by waiting for unacked feeder commands before sending the 0x85 command. |
6325234
to
274fcf2
Compare
The latest version fixes a typo when running the feeder onEmpty callbacks and a bug when calling onEmpty while the feeder queue was empty. I also added a second patch that pretty prints hex characters, so the jog cancel command prints |
Any chance of getting this merged in? If there's something blocking it, I'm willing to help contribute if @colincross isn't available. The change to make 0x85 display in the console is worth it in and of itself:
|
This looks really useful, I was just about to look into some jogging with a pendant, so a jog cancel is a requirement to get a smooth implementation. Would like to see this merged. |
I've been using this extensively since I uploaded it without any issues. |
8dcb264
to
e063ed6
Compare
This is just an FYI that while studying the CNCjs code, I discovered another way to get the jog command to work without the need to patch CNCjs. It may be true that the "gcode" command sent via socket.io won't handle the special 0x85 character, but CNCjs does have a "write raw bytes" command that can be used to send arbitrary bytes directly to the serial port, bypassing the feeder, sender, etc:
It is important to note that the jog stop command byte will be sent to the serial port immediately upon receipt by the CNCjs server. If there is a jog command queued up in the feeder that has not yet been sent, then things will get out of sequence (i.e. you'll cancel the command before it has been issued). For that reason, I'd still recommend using this PR submitted by @colincross if it works for you. It seems to address many of the sequencing issues one might run into. That being said, if your use case does not allow for a patched version of CNCjs and you'd prefer to work with the code that is out in the wild, the above is another approach. |
75cb584
to
9d31b76
Compare
@colincross any chance you could rebase this? |
274fcf2
to
83253f3
Compare
Thank you @colincross , works nicely in my setup. What would be the next step to merge this? |
@cheton @MitchBradley would it be possible to merge this one? |
I'm also interested in this for a pendant controller using touch hold-to-jog and it'd be great to have merged! |
0c2fce0
to
0469fe0
Compare
40ba20c
to
d22c17f
Compare
Grbl v1.1 controllers support additional Extended Ascii Realtime Comands: https://github.com/gnea/grbl/wiki/Grbl-v1.1-Commands#extended-ascii-realtime-command-descriptions The jogCancel command is sent as the character 0x85, and is useful for implementing Grbl v1.1 jogging: https://github.com/gnea/grbl/wiki/Grbl-v1.1-Jogging The 0x85 character cannot be sent over socket.io as an argument to the gcode command because it does not form a valid UTF8 byte sequence. Add a jogCancel command that causes CNCjs to send the 0x85 character to the Grbl controller. Since the GRBL jog cancel command (0x85) is a realtime command, it will be handled by GRBL as soon as it enters the serial buffer. If there are any unparsed jog commands ($J=) in GRBL's serial buffer the cancel command will skip ahead of them and cancel any parsed commands, but then the unparsed jog command will be parsed and one more time. Make the feeder keep tracked of unacked commands, and Wait until all the commands sent by the feeder have been acked when sending the jog cancel command to ensure all pending jog commands have been parsed.
56b05ca
to
146277d
Compare
Grbl v1.1 controllers support additional Extended Ascii Realtime
Comands:
https://github.com/gnea/grbl/wiki/Grbl-v1.1-Commands#extended-ascii-realtime-command-descriptions
The jogCancel command is sent as the character 0x85, and is useful
for implementing Grbl v1.1 jogging:
https://github.com/gnea/grbl/wiki/Grbl-v1.1-Jogging
The 0x85 character cannot be sent over socket.io as an argument to
the gcode command because it does not form a valid UTF8 byte
sequence. Add a jogCancel command that causes CNCjs to send
the 0x85 character to the Grbl controller.