Skip to content
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

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

Closed
foosel opened this issue Mar 5, 2015 · 4 comments
Closed

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

foosel opened this issue Mar 5, 2015 · 4 comments

Comments

@foosel
Copy link
Contributor

foosel commented Mar 5, 2015

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)

@foosel foosel changed the title Colon ":" interpreted as command separator, no means to escape it, limits M117 Colon ":" interpreted as command separator, bug or feature? Mar 5, 2015
C-o-r-E added a commit to C-o-r-E/Marlin that referenced this issue Mar 5, 2015
@foosel
Copy link
Contributor Author

foosel commented Mar 5, 2015

On second, third, ..., n-th look, this is a bug causing comments, especially in-line comments, to not work at all. Push proposed by @C-o-r-E solves everything.

@daid
Copy link
Contributor

daid commented Mar 6, 2015

I always thought this was some odd backwards compatibility thing. (I'm pretty sure I had a talk with someone about it a few years ago)

Anyhow, I think this indeed can go. None of the current generation GCode senders depend on this odd behaviour, and it's causing more problems then it's fixing.

@thinkyhead
Copy link
Member

Good to see those weird assumptions getting scrubbed out. We recently fixed another one where the SD file reader was ignoring names beginning with underscore. The original author probably thought it was needed to filter OS X custom files, or something.

#1570 looks like a winner!

avluis added a commit to avluis/Marlin that referenced this issue Mar 7, 2015
* feature-request:
  Make sure a ROM is selected for ULTRA_LCD
  Remove M48 credits also
  Fix compile error in gcode_G29
  Minor typos in the README
  Undubble MSG_MIN &MSG MAX
  Fixed in-line comments and escaping
  Attempt to resolve MarlinFirmware#1568 and add basic escape character support
avluis added a commit to avluis/Marlin that referenced this issue Mar 7, 2015
* Marlin_phoenix:
  Make sure a ROM is selected for ULTRA_LCD
  Remove M48 credits also
  Fix compile error in gcode_G29
  Minor typos in the README
  Undubble MSG_MIN &MSG MAX
  Fixed in-line comments and escaping
  Attempt to resolve MarlinFirmware#1568 and add basic escape character support
avluis added a commit to avluis/Marlin that referenced this issue Mar 7, 2015
* feature-request:
  Make sure a ROM is selected for ULTRA_LCD
  Remove M48 credits also
  Fix compile error in gcode_G29
  Minor typos in the README
  Undubble MSG_MIN &MSG MAX
  Fixed in-line comments and escaping
  Attempt to resolve MarlinFirmware#1568 and add basic escape character support
joaquin-herrero pushed a commit to bq/Marlin that referenced this issue Nov 27, 2015
…e character support MarlinFirmware#1570 from upstream Marlin.

Related commits:

	'99fb1bc' by C-o-r-E
	'63b62d8' by foosel
	'ba27f90' by C-o-r-E
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants