Why including a line number and checksum into a gcode?

When using serial communication to a 3d printer, the gcode is sent by the firmware with a line number and a checksum included. What the purpose of these two values? What problems they solve?

Line numbers are necessary to keep track of the transmitted code lines.
The checksum is in need to check the correctness of the command line.
If an error occurred during transmission, the printer firmware requests that faulty line, it needs the line number to tell the server to resend that certain line.

These are only needed when the print command get over to the printer via USB.
When the gcode file is saved onto a SD card that goes into the printer, line numbers and checksums are not needed.

Here are some more informations on this topic.

1 Like