Skip to content

Commit 3cb0f30

Browse files
committed
Minor fixes
1 parent aada091 commit 3cb0f30

File tree

2 files changed

+36
-36
lines changed

2 files changed

+36
-36
lines changed

octoprint_ender3v2tempfix/__init__.py

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,42 @@
33
import octoprint.plugin
44
import re
55

6+
67
class Ender3V2TempFixPlugin(octoprint.plugin.OctoPrintPlugin):
8+
#
9+
# Recv: TT::27.7627.76 //0.000.00 BB::39.3539.35 //0.000.00 @@::00 BB@@::00
10+
# Recv: T:23.84 /0.00 B:24.05 /0.00 @:0 B@:0
11+
#
12+
parse_Ender3V2Temp = re.compile(
13+
'.*TT::(\d+)\.\d+\.(\d+).+\/\/(\d+)\.\d+\.(\d+).*BB::(\d+)\.\d+\.(\d+).+\/\/(\d+)\.\d+\.(\d+)')
14+
15+
def check_for_temp_report(self, comm_instance, line, *args, **kwargs):
16+
# Check to see if we received the broken temperature response and if so extract temperature for octoprint
17+
# self._logger.debug("Testing: %s" % line)
18+
if "TT::" not in line:
19+
return line
20+
self._logger.debug("Original: %s" % line)
21+
m = self.parse_Ender3V2Temp.search(line)
22+
new_line = (" T:%s.%s /%s.%s B:%s.%s /%s.%s" % (
23+
m.group(1), m.group(2), m.group(3), m.group(4), m.group(5), m.group(6), m.group(7), m.group(8)))
24+
self._logger.debug("Modified: %s" % new_line)
25+
return new_line
26+
27+
def TempReport(self, comm_instance, parsed_temperatures, *args, **kwargs):
28+
self._logger.debug("Before: %s" % parsed_temperatures)
29+
# self._logger.debug("After: %s" % parsed_temperatures)
30+
return parsed_temperatures
31+
732

8-
#
9-
# Recv: TT::27.7627.76 //0.000.00 BB::39.3539.35 //0.000.00 @@::00 BB@@::00
10-
# Recv: T:23.84 /0.00 B:24.05 /0.00 @:0 B@:0
11-
#
12-
parse_Ender3V2Temp = re.compile('.*TT::(\d+)\.\d+\.(\d+).+\/\/(\d+)\.\d+\.(\d+).*BB::(\d+)\.\d+\.(\d+).+\/\/(\d+)\.\d+\.(\d+)')
13-
14-
def check_for_temp_report(self, comm_instance, line, *args, **kwargs):
15-
# Check to see if we received the broken temperature response and if so extract temperature for octoprint
16-
# self._logger.debug("Testing: %s" % line)
17-
if "TT::" not in line:
18-
return line
19-
self._logger.debug("Original: %s" % line)
20-
m = self.parse_Ender3V2Temp.search(line)
21-
new_line = (" T:%s.%s /%s.%s B:%s.%s /%s.%s" % (m.group(1), m.group(2), m.group(3), m.group(4), m.group(5), m.group(6), m.group(7), m.group(8)))
22-
self._logger.debug("Modified: %s" % new_line)
23-
return new_line
24-
25-
def TempReport(self, comm_instance, parsed_temperatures, *args, **kwargs):
26-
self._logger.debug("Before: %s" % parsed_temperatures)
27-
# self._logger.debug("After: %s" % parsed_temperatures)
28-
return parsed_temperatures
29-
30-
__plugin_name__ = "Ender 3 V2 Temp Fix"
31-
__plugin_version__ = "1.0.4"
32-
__plugin_description__ = "This plugin modified the very broken temperature report from the Ender 3 V2 firmware"
33-
__plugin_author__ = "Brad Morgan"
34-
__plugin_license__ = "AGPLv3"
3533
__plugin_pythoncompat__ = ">=2.7,<4"
34+
35+
3636
def __plugin_load__():
37-
global __plugin_implementation__
38-
__plugin_implementation__ = Ender3V2TempFixPlugin()
39-
40-
global __plugin_hooks__
41-
__plugin_hooks__ = {
42-
"octoprint.comm.protocol.temperatures.received": __plugin_implementation__.TempReport,
43-
"octoprint.comm.protocol.gcode.received": __plugin_implementation__.check_for_temp_report
44-
}
37+
global __plugin_implementation__
38+
__plugin_implementation__ = Ender3V2TempFixPlugin()
39+
40+
global __plugin_hooks__
41+
__plugin_hooks__ = {
42+
"octoprint.comm.protocol.temperatures.received": __plugin_implementation__.TempReport,
43+
"octoprint.comm.protocol.gcode.received": __plugin_implementation__.check_for_temp_report
44+
}

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
plugin_description = "Fixes the temperature reporting from the Creality Ender-3 v2 printer"
2121

2222
# The plugin's author. Can be overwritten within OctoPrint's internal data via __plugin_author__ in the plugin module
23-
plugin_author = "SimplyPrint"
23+
plugin_author = "SimplyPrint & Brad Morgan"
2424

2525
# The plugin's author's mail address.
2626
plugin_author_email = "albert@simplyprint.dk"

0 commit comments

Comments
 (0)