Temperature info not parsed correctly

the firmware which the ender 3 uses wants arduino 1.0.5

which was released 19 Sep 2013

I would update to stock marlin ...
Could be something arround Marlin 1.0.1

Let me correct you here - your printer vendor broken the firmware or rather the M105 output format in the new release. I suggest to scream a bit at your printer vendor, they can't just start changing output formats if they feel like it, they have to adhere to the established protocol if they expect interoperability with existing solutions on the market.

1 Like

First of all, I think it seems like Octoprint is working correctly, and the Creality 3D CR-X is breaking the protocol.

When I compare Creality 3D's firmware to the original Marlin firmware, it seems like they have changed a lot in the Marlin 1.1.0 code, and it seems like line number 7445 in marlin_main.cpp should be deleted:
SERIAL_PROTOCOLCHAR(" ==");
(sourcecode available here: https://www.creality3donline.com/blog/download-b0034.html)

That being said, and due to the fact that I am a CR-X owner, I need a solution while Creality 3D and Octoprint fights about the protocol, and I'm not very keen to change firmware on my newly bought printer at the moment.

My very dirty solution is to add the following 4 lines between the "##~~ busy protocol handling" and "##~~ debugging output handling" sections of the /home/pi/oprint/lib/python2.7/site-packages/octoprint/util/comm.py on my octopi (line number 1559).

                            ## Fix Creality 3D CR-X breaking with standards
                            findBadTempReply = re.search(r"^((ok)*)\ ==(T|B):([0-9\.]*)\ /([0-9\.]*)\ .*$",line)
                            if findBadTempReply:
                                    line = line.replace(" =="," ")

I'm no python programmer, and might just have broken every rule in all the good the books, but hey - now I got a temperature readig. :slight_smile:
(The fix will most likely be overwritten whenever I update Octoprint)

Maybe someone could translate this to a plugin called "Fix very broken CR-X firmware replies" or something like that, so we can move on with our lives while Creality fixes their broken firmware?

Best regards
Tobias

I think it would be more convenient by uploading a proper firmware...

@rapotjau Think of 3D printing as the wild, wild west. Foosel is the local sheriff in town and the printer manufacturer is like that traveling guy who sells snake oil remedies and you bought one of them.

Sometimes this isn't easy. I get that you'd like to not re-flash your new printer's firmware but some of these vendors truly don't know what they're doing. I contracted for a big manufacturer here in San Diego and their understanding of the software would just make you shake your head. How could they be so utterly clueless? And yet, few of these manufacturers know the software side of the business like they (hopefully) do understand the hardware.

Fast-forward a year from now and you'll probably agree with me. It wouldn't hurt to learn how to re-flash your printer's firmware. Learn how to do it and you can re-flash it back to Creality's compiled firmware if you didn't like the experience.

1 Like

Fyi, same issue discussed here

And branch supporting these machines with the touchscreen that doesn't have a protocol issue

1 Like

I don't have much time to understand how to publish a plugin to the repository, but here is one that does the job.

Create the file /home/pi/.octoprint/plugins/CrealityTemperature.py with this content

# coding=utf-8

import octoprint.plugin
import re

class CrealityTemperatureFixPlugin(octoprint.plugin.OctoPrintPlugin):
	def log(self, comm_instance, line, *args, **kwargs):
		if re.match("^(ok)?\s*==T", line):
			fix = re.sub("==", "", line)
			return fix
		return line

__plugin_name__ = "Creality Temperature Fix"
def __plugin_load__():
	global __plugin_implementation__
	__plugin_implementation__ = CrealityTemperatureFixPlugin()

	global __plugin_hooks__
	__plugin_hooks__ = {
		"octoprint.comm.protocol.gcode.received": __plugin_implementation__.log
	}
2 Likes

I put the CrealityTemperature.py file in the correct location ( /home/pi/.octoprint/plugins/) but I don't see it listed in the installed plugins side-bar location...

Is there another step needed to actually activate the plugin or will it simply run in the background as long as the plugin file is in the plugins directory?

According to this tutorial, simply placing the Python file into the correct spot and restarting OctoPrint is all it takes.

I did get the plugin to work - what threw me for a loop was that there is no indication in OctoPrint that the plugin was installed. However, it did make the temperature graph work again!

Thanks everyone - and thanks jcheger for the plugin/fix!

1 Like

It helps to add a logger line in there to self-announce that's it's been loaded. (See the tutorial.) Glad to hear it's working for you.

Sorry I have looked at the tutorial but still don't understand how to add this to get my CR-X working. Can someone please write a step by step process to do this.

  • Use ssh pi@octopi.local or the equivalent command in PuTTY to remote into your Raspberry Pi computer (noting that the default password is "raspberry").
  • Run the command touch /home/pi/.octoprint/plugins/CrealityTemperature.py
  • Run the command nano /home/pi/.octoprint/plugins/CrealityTemperature.py
  • Copy and paste the content as provided above for the Python code, making sure to add an extra Enter (hard return) at the end of the file. Press Ctl-X and follow the prompts to save the content to the same file.
  • Run sudo reboot to reboot your Raspberry Pi computer.

When OctoPrint is again available, give it a test to see if this fixes the temperature.

1 Like

OutsourcedGuru,

You are the man, Thanks that worked and I'm seeing temps.
Thanks again

1 Like

do you know what modification I have to make to the code if I am running multiple session of Octoprint in the same Pi?

"Do I know what modification I have to make to the code...?" No. What I'd do is dedicate one Raspi per printer.

Seriously, I intimately know how much processing OctoPrint and printing takes on a Raspberry Pi 3B computer. I've written an interface to monitor its performance, even. It is unwise to try to run more than one printer from one OctoPrint install, (in my humble opinion).

1 Like

thanks for the feedback. I can do that. could you point me to a tutorial on how to run multiple ones on the same network? just install and follow each ID? change the host name to something different from default?

It sounds like you have the right idea already: each needs its own hostname. You can change it by running sudo raspi-config, it's under "Network Options".

You could go with a Star Wars theme or almost anything for a naming convention. Just remember that they can be referenced as hostname.local where "hostname" was originally octopi.

1 Like

Can you explain what board and firmware this is supposed to help with?
Does this affect CR-10S3/4 users with the Arduino 2560 upgrade board as well?
Is this for the bed or hot end temp?
When you stated you compared it to the old CR-10 output what firmware version were you comparing to?

This solution worked for me very well, until the Phyton Update. Now it does not show temp graph again :frowning: