Sending ctrl-x / clearing buffer of grbl

Discussion about the arduino based g-code interpreter, grbl
Post Reply
Luke
Posts: 3
Joined: Tue May 03, 2016 6:21 am

Sending ctrl-x / clearing buffer of grbl

Post by Luke » Tue May 03, 2016 12:45 pm

Hello everybody,

I have two questions regarding to GRBL that I couldn't solve myself.

1. I couldn't send the soft reset command ctrl-x / ^X succesfully to trigger a reset. Until now I send $C (check gcode mode) two times as a compromise. I use Java and jSSC 2.7.0 for serial connection.

2. Is there any possibility to clear the buffer of grbl? I would like to cancel all remaining g-code commands in buffer of grbl from my interface to start a new job.

chamnit
Posts: 376
Joined: Tue Aug 12, 2014 2:16 pm
Location: Albuquerque NM, USA
Contact:

Re: Sending ctrl-x / clearing buffer of grbl

Post by chamnit » Tue May 03, 2016 3:27 pm

The ctrl-x command is the way to do it. Not sure why you are having problems. If you can't get it to work, you can always alter the command key for the soft reset to something that is type able (but not a character used by gcode).

aam
Posts: 38
Joined: Sat Aug 30, 2014 6:17 pm

Re: Sending ctrl-x / clearing buffer of grbl

Post by aam » Tue May 03, 2016 3:41 pm

chant wrote:...you can always alter the command key for the soft reset to something that is type able...
Can you explain how to do that, please? Had some problems with ctrl-x too.

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: Sending ctrl-x / clearing buffer of grbl

Post by cvoinescu » Tue May 03, 2016 3:54 pm

Luke wrote:1. I couldn't send the soft reset command ctrl-x / ^X succesfully to trigger a reset.
So you send the character 0x18, and what happens? How exactly do you send it (code)?
Luke wrote:2. Is there any possibility to clear the buffer of grbl?
Ctrl-X does that. There isn't another way that I know of.
aam wrote:Can you explain how to do that, please? Had some problems with ctrl-x too.
In config.h, change #define CMD_RESET from 0x18 to whatever character you prefer to use (it must not occur in G-code at all, not even in comments). Compile, flash.

However, if you're writing a G-code sender that you hope other people may use, you won't find any takers if it requires users to change GRBL configuration and rebuild (unless it's truly brilliant in other ways). Even for my own use, I find that a little effort to make my stuff work with stock GRBL pays off in convenience down the road, when it's upgrade time.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

Luke
Posts: 3
Joined: Tue May 03, 2016 6:21 am

Re: Sending ctrl-x / clearing buffer of grbl

Post by Luke » Tue May 03, 2016 4:00 pm

pic.JPG
pic.JPG (12.43 KiB) Viewed 3367 times
Doesn't work with arduino command line and my programm.

Send: ctrl-x
Answer: error: Bad number format

Send: 0x18
Answer: error: Expected command letter

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: Sending ctrl-x / clearing buffer of grbl

Post by cvoinescu » Tue May 03, 2016 4:27 pm

You need to hold down the Ctrl key and press the X key. Not type C, t, r, l, -, X, nor 0, x, 1, 8. If your program does not accept non-printable characters, that's between you (the programmer) and that edit control... The easiest way around that is to add a button that simply writes a byte of value 0x18 (that's 24 decimal) to the serial port.

If this is not your program but a serial console, then use a different program -- one that allows you to type control characters. CoolTerm, for instance, or even PuTTY.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

Luke
Posts: 3
Joined: Tue May 03, 2016 6:21 am

Re: Sending ctrl-x / clearing buffer of grbl

Post by Luke » Tue May 03, 2016 4:57 pm

Thank you. Works fine with jSSC writeByte() methode and 0x18.

Post Reply