Octoprint still sending M110 with checksum

No matter which setting I change, OctoPrint is still sending the "Hello " it's still sending the checksum. Even the next command M115 is being sent with the *125 checksum.

How do I turn checksums off altogether?

Hello Kurt!

Goto OctoPrint settings -> Serial Connection -> Firmware & Protocol -> Protocol Fine Tuning -> Advanced Options -> Commands that always require a checksum.
Usually M110 is listed there. Also note the "Hello" command option above.

1 Like

Oh, right I forgot to mention what I tried:

  • I removed the M110 command from the part that says always send checksum for these commands
  • I set the option to remove checksums.
  • I can see the value in config.yaml that says alwaysSendChecksum : false

The problem still persists.

Since we're on the topic, how does this checksum work anyways? Is it the sum of the utf8 char values of the text without the star or does it include the star. Is the sum + the trailing integer supposed to be 255 or some other value?

XORing of all characters in N<linenumber> <command>. Checksum is then appended with * as the delimiter.

ASCII. Communication with the printer is defined as ASCII (though a lot of firmware doesn't appear to give a flying f... about that, especially those outdated forks of Marlin out there which still happily translate protocol messages on the serial interface into whatever display language is chosen :roll_eyes:).

Hm... Have you reconnected in between? If yes, that might be a bug.

Yes, I have reconnected in between. I keep a terminal window with octoprint open to see the log messages as I develop. As I continue to develop the parser and test GCodes, I'm noticing that it's still sending all the commands with the checksum. For now I've swallowed the checksum in the parser, but my parser supports the mathematical calculations aspect of CNC g-codes so * means multiply!

I guess into the python script I go.

What does that parameter "neverSendChecksum" do?

It feels like... command_allowing_checksum wants to be True if it's not a comment from my amateur reading of this. If this is correct then it would compress down into a very truthy function.

	def _needs_checksum(self, gcode=None):
		command_requiring_checksum = gcode is not None and gcode in self._checksum_requiring_commands
		command_allowing_checksum = gcode is not None or self._sendChecksumWithUnknownCommands
		return command_requiring_checksum or (command_allowing_checksum and self._checksum_enabled)

Does it need to be something a bit like:

	def _needs_checksum(self, gcode=None):
		command_requiring_checksum = gcode is not None and gcode in self._checksum_requiring_commands
		command_allowing_checksum = False
		if some_kind_of_check_to_determine_if_it_is_unknown():
			command_allowing_checksum = gcode is not None or self._sendChecksumWithUnknownCommands
		return command_requiring_checksum or (command_allowing_checksum and self._checksum_enabled)

Does the * get XORed as well? (I'm assuming not).

Nope. As I said, N<linenumber> <command> is what gets checksummed.

Cool.

Let's say the firmware received a corrupt command. How should it let octoprint know?

The RepRap GCODE Wiki gives a good explanation how this works:
https://reprap.org/wiki/G-code#Replies_from_the_RepRap_machine_to_the_host_computer
https://reprap.org/wiki/G-code#Example_of_a_communication_error_with_resend_request

2 Likes

Thanks, good thing I documented that stuff then :sweat_smile:

Good Stuff. I've been looking for information like that for a while.