FluidNC processes serial data a character at a time. With some special characters like ? (status) and CTRL+X (reset) it will act extremely fast. We call those immediate characters. With other characters, it stores them in a buffer until it sees a line end character. The line ending can be a carriage return (CR) or a line feed (LF). When it sees the line end character it processes the whole line. This is used for things like gcode, commands or settings.
Immediate characters get processed as soon as they are seen even if they are in the middle of a command. Example: if you try to set the AP SSID to "Hello?world", you will have trouble. It will strip out the ? (status command), send the status and then set the value to "Helloworld". See below. As soon as FluidNC saw the ?, it returned the status.
$AP/SSID=Hello<Idle|WPos:-26.000,-51.000,0.000|FS:0.000,0>
world
ok
$AP/SSID
$AP/SSID=Helloworld
There are only three immediate characters that are standard printable characters. This limits the the number of characters that cause the problem listed above. These are ones you cannot send from the serial port for any other purpose. If you must use them in a WiFi password, etc, you should do that via the WebUI. That handles sending strings a little differently.
The rest are non printing characters. They are usually sent by senders using the key code for that characters. There is a list of them in Serial.h. The character for Reset can be sent with many serial terminals with the CTRL-X from the keyboard.
Immediate characters do not respond with an ok. You can send them at any time. We recommend 10Hz as the max rate to send ? for status.
These are sent a line at a time with a line end. FluidNC will process them when it can. FluidNC will respond with an "ok" when it is ready to receive another command. There is a buffer for gcode lines. If you send a command for a slow, long move, it will say 'ok' right away even though the move has not finished. It can store several commands. Eventually it will need the earlier commands to complete before it will send an 'ok'. You should wait for the OK to send another command. Advanced gcode senders can internally count characters and track buffers, but that is beyond this scope of this wiki page.
Note: If you send both a carriage return and a line end (CR+LF) with the command, you will get 2 'ok's. The first is for the actual command. The second 'ok' is for the empty command between the line end characters. It is sloppy, but fine to operate this way.
There are many types of serial terminal. some are stand alone programs and some are built into programs, like programming IDEs and gcode senders. Most stand alone serial terminals send characters as soon as you type them. The ones built in to other programs often have you type the characters into a text box, then click the send button. The enter key also usually sends that line. It sends the whole line and adds a line ending.
The Arduino IDE serial port monitor works this way and most gcode senders work this way. If you send the immediate the ? character with these, you will get an 'ok'. This is because FluidNC sees this as an immediate character plus an empty command with a line end. The 'ok' is for the empty command. In most cases you cannot send special characters, like CTRL-X with this type of terminal. GCode senders will often have a dedicated button for reset.
On some terminals like this the line ending is configurable. We recommend using CR as the line ending.
These terminal send each character at a time and can also send compound keys like CTRL-X. The line ending that is send with the enter key is usually configurable. This should be CR.
Local Echo FluidNC does not normally echo characters characters back to the sender. You need to set the local echo on your terminal. This is the way Grbl and Grbl_ESP32 work. We wanted compatibility with those, so that is the default way it works. See the advanced mode below for an alternate method.
Note: Some of these do not send all keys. It might use the tab key, arrow keys or CTRL-X for features of the host program and not send the character. The serial terminal built into platform.IO with VSCode blocks a few characters.
A good serial terminal looks like a shell terminal of an operating system. Shell terminals have some nice features we tried to emulate with FluidNC. Things like arrow up/down to scroll through the history of commands you have sent is a basic example. This requires FluidNC to echo the characters. You will want to turn the local echo off, if you use this mode. The advanced mode is not enabled by default. This is to preserve Grbl compatibility. You can trigger the mode by sending one of the special editing keys.
CTRL+L turns off local echo.
Below are the special keys for the advanced editing mode. Send one of the keys to enter the mode. The backspace key is probably the best key to start this mode. If you reboot, you must restart the mode. FluidTerm tries to automatically turn on the mode under some conditions, but sometimes does not succeed.
Terminals like the one in VSCode do not send all of the non printing keys listed below. It can only partially use the advanced mode features. FluidTerm supports them all.
## Line Editing Keys (the caret ^ symbol means hold the control key)
Left Arrow or ^B - backward character
Right Arrow or ^F - forward character
Up Arrow or ^P - recall previous line from history
Down Arrow or ^N - recall next line from history
Home or ^A - beginning of line
End or ^E - end of line
Delete or ^D - delete character under cursor (forward)
Backspace or ^H - delete character backward
ESC then b - move backward to word boundary
ESC then f - move forward to word boundary
^W - delete backward to word boundary
^U - erase entire line
^K - delete rest of line after cursor and save
^Y - insert previously saved text from last ^K
Tab - Completes words for commands and settings
Words are delimited by space, /, =, or comma
If you see 2 of the same character each time you press a key, it means you you probably have a local echo on in your terminal and FluidNC is in the advanced editing mode. Turn your local echo off. In Fluidterm and miniterm (vscode) send Ctrl+T and Ctrl+E to toggle the echo mode)