Skip to content

Commit

Permalink
initial lerdge firmware support, #167
Browse files Browse the repository at this point in the history
  • Loading branch information
jneilliii committed Jan 27, 2024
1 parent 9188cbd commit 69cc31d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions octoprint_bedlevelvisualizer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(self):
self.makergear = False
self.old_marlin_offset = 0
self.repetier_firmware = False
self.lerdge_firmware = False
self.mesh = []
self.bed = {}
self.bed_type = None
Expand All @@ -48,8 +49,7 @@ def __init__(self):
"octoprint.plugins.bedlevelvisualizer.debug"
)
self.regex_mesh_data = re.compile(
r"^((G33.+)|(Bed.+)|(Llit.+)|(\d+\s)|(\|\s*)|(\s*\[\s+)|(\[?\s?\+?-?\d+?\.\d+\]?\s*,?)|(\s?\.\s*)|(NAN,"
r"?)|(nan\s?,?)|(=======\s?,?)|(;-?\+?\d?.?\d+))+(\s+\],?)?$"
r"^((G33.+)|(Bed.+)|(Llit.+)|(\d+\s)|(\|\s*)|(\s*\[\s+)|(\[?\s?\+?-?\d+?\.\d+\]?\s*,?)|(\s?\.\s*)|(NAN,?)|(nan\s?,?)|(=======\s?,?)|(;-?\+?\d?.?\d+)|(?:\d\(\d+\.\d+,\d+\.\d+,(-?\d+\.\d+)\)\s?)+)+(\s+\],?)?$"
)
self.regex_bed_level_correction = re.compile(
r"^(Mesh )?Bed Level (Correction Matrix|data):.*$"
Expand All @@ -61,6 +61,7 @@ def __init__(self):
self.regex_makergear = re.compile(
r"^(\s=\s\[)(\s*,?\s*\[(\s?-?\d+.\d+,?)+\])+\];?$"
)
self.regex_lerdge_extraction = re.compile(r"\d\(\d+\.\d+,\d+\.\d+,(-?\d+\.\d+)\)\s?")
self.regex_repetier = re.compile(r"^G33 X.+$")
self.regex_nan = re.compile(r"(nan)")
self.regex_catmull = re.compile(
Expand Down Expand Up @@ -250,6 +251,10 @@ def process_gcode(self, comm, line, *args, **kwargs):
line = self.regex_equal_signs.sub("0.0", line)

new_line = self.regex_mesh_data_extraction.findall(line)

if self.lerdge_firmware:
new_line = self.regex_lerdge_extraction.findall(line)

self._bedlevelvisualizer_logger.debug(new_line)

if self.regex_old_marlin.match(line.strip()):
Expand Down Expand Up @@ -284,6 +289,9 @@ def process_gcode(self, comm, line, *args, **kwargs):
if self.box[0][1] > self.box[3][1]:
self.flip_y = True

elif line.strip() == "echo: The system starts to level automatically, please wait for finishing the leveling":
self.lerdge_firmware = True

elif self.regex_additional_mesh_data.findall(line.strip()):
self.additional_mesh_data.append(line.strip())

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
plugin_name = "Bed Visualizer"

# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
plugin_version = "1.1.2rc7"
plugin_version = "1.1.2rc8"

# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module
Expand Down

0 comments on commit 69cc31d

Please sign in to comment.