Skip to content

Colon ":" interpreted as command separator, bug or feature? #1568

Closed
@foosel

Description

@foosel

Just noticed an unexpected behaviour by pure accident...

Including a colon in a command will cause the command to be split into two commands at the colon. So far, so interesting (not according to protocol though!). However, there is no way to escape this colon so it's impossible to use it in messages send from the host to the display.

Example:

>>> M117 Hello :)
<<< ok
<<< echo:Unknown command: ")"
<<< ok

Could we get some way to escape this? E.g. by tracking if last read character was a \ and if so not interpret this as a command separator? Also: this stuff needs to be documented!

Alternatively it might be that it is a simple typo, like already mentioned in #1035 and the : here should in fact be a ; (which would definitely make more sense given the following && comment_mode == false check and the spec for comments in GCODE):

void get_command()
{
  if(drain_queued_commands_P()) // priority is given to non-serial commands
    return;

  while( MYSERIAL.available() > 0  && buflen < BUFSIZE) {
    serial_char = MYSERIAL.read();
    if(serial_char == '\n' ||
       serial_char == '\r' ||
       (serial_char == ':' && comment_mode == false) ||
       serial_count >= (MAX_CMD_SIZE - 1) )
    {

(link to line in Marlin_main.cpp - specific version to make sure link stays valid)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions