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

if checksum == NL or CR, false NOCHECKSUM generated? #4166

Closed
i-make-robots opened this issue Jun 28, 2016 · 12 comments
Closed

if checksum == NL or CR, false NOCHECKSUM generated? #4166

i-make-robots opened this issue Jun 28, 2016 · 12 comments

Comments

@i-make-robots
Copy link
Contributor

get_serial_commands() reads each line off the serial buffer until it hits a \r (13) or a \n (10) character.
commands follow the format

N[line number] [gocde];*[single byte checksum][CR and/or NL]

if the checksum of the line is equal to 10 or 13, the line would be truncated prematurely and a NOCHECKSUM error would be generated. If the PC software sends the exact same line again, an infinite loop would result.

A possible fix is to treat * as an escape character for the \n or \r check.

@Blue-Marlin
Copy link
Contributor

Blue-Marlin commented Jun 29, 2016

The assumption the checksum is a single byte is wrong - it's the ASCII representation of a single byte.

@i-make-robots
Copy link
Contributor Author

Ah. Ok then. Sorry!

@Blue-Marlin
Copy link
Contributor

Blue-Marlin commented Jun 29, 2016

I admit this is a bit hidden

        if (apos) {
          byte checksum = 0, count = 0;
          while (command[count] != '*') checksum ^= command[count++];

          if (strtol(apos + 1, NULL, 10) != checksum) { //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            gcode_line_error(PSTR(MSG_ERR_CHECKSUM_MISMATCH));
            return;
          }
          // if no errors, continue parsing
        }

And somewhere is a misleading comment.

    /**
     * '#' stops reading from SD to the buffer prematurely, so procedural
     * macro calls are possible. If it occurs, stop_buffering is triggered
     * and the buffer is run dry; this character _can_ occur in serial com
     * due to checksums, however, no checksums are used in SD printing.
     */

That's wrong. '#' can't appear in the checksum.

Repetie Host:

02:48:02.791 : N39909 M105*45
                           ^^

@spilz87
Copy link

spilz87 commented Mar 5, 2020

hello

can someone explain to me what is wrong when i try to send it after a M28 command
N1 ;TIME:10052*125
I receive :
Error:No Checksum with line number, Last Line: 0 Resend: 1 ok
I don't understand, there is the line number N1 ther is the '*' and the checksum

why it seems to don't find the checksum ??

@ellensp
Copy link
Contributor

ellensp commented Mar 5, 2020

A) This is a closed bug report not a support forum.
B) everything after the ; character is a comment. and is dropped. Should not be sent to controller.

@spilz87
Copy link

spilz87 commented Mar 5, 2020

Thank for your very quick reply

A) I know it’s not a support forum but there is no information in documentation about this function. As I worked 2 days to find why it doesn’t work, I could think there is an issue and open a new one. Before doing that I prefer asking somewhere people maybe know if it’s or not an issue.

B) it’s not obvious : the documentation explain M28 command is to send a file and the example is a .txt file. So the transfer shouldn’t care about what is in the file. You can want to send a config file or to keep comments in gcode file to use them later. I don’t really understand this choice.

Anyway thanks a lot, I will not find it alone

@AnHardt
Copy link
Contributor

AnHardt commented Mar 5, 2020

I'd start with a search for the problem by reverting #16840.

@thinkyhead
Copy link
Member

@spilz87 — Here are the resources you should use instead of hijacking our issue queue:

@github-actions
Copy link

github-actions bot commented Jul 3, 2020

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.

3 similar comments
@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
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
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 Mar 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants