Skip to content

Commit

Permalink
0.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
jneilliii committed Sep 6, 2018
2 parents 7227f7d + 98766f9 commit 396f9cb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ or manually using this URL:

## Changelog

**[0.1.6]** (09/06/2018)

**Added**
- Repetier firmware support thanks to @gztproject.

**[0.1.5]** (09/03/2018)

**Added**
Expand Down Expand Up @@ -180,6 +185,7 @@ or manually using this URL:

**Initial Release**

[0.1.6]: https://github.com/jneilliii/OctoPrint-BedLevelVisualizer/tree/0.1.6
[0.1.5]: https://github.com/jneilliii/OctoPrint-BedLevelVisualizer/tree/0.1.5
[0.1.4]: https://github.com/jneilliii/OctoPrint-BedLevelVisualizer/tree/0.1.4
[0.1.3]: https://github.com/jneilliii/OctoPrint-BedLevelVisualizer/tree/0.1.3
Expand Down
19 changes: 13 additions & 6 deletions octoprint_bedlevelvisualizer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def __init__(self):
self.processing = False
self.old_marlin = False
self.old_marlin_offset = 0
self.repetier_firmware = False
self.mesh = []

##~~ SettingsPlugin
Expand Down Expand Up @@ -65,7 +66,7 @@ def flagMeshCollection(self, comm_instance, phase, cmd, cmd_type, gcode, *args,
return

def processGCODE(self, comm, line, *args, **kwargs):
if self.processing and "ok" not in line and re.match(r"^((Bed.+)|(\d+\s)|(\|\s+)|(\[?\s?\+?\-?\d?\.\d+\]?\s*\,?)|(\s?\.\s*)|(NAN\,?))+$", line.strip()):
if self.processing and "ok" not in line and re.match(r"^((G33.+)|(Bed.+)|(\d+\s)|(\|\s+)|(\[?\s?\+?\-?\d?\.\d+\]?\s*\,?)|(\s?\.\s*)|(NAN\,?))+$", line.strip()):
# new_line = re.sub(r"(\[ ?)+","",line.strip())
# new_line = re.sub(r"[\]NA\)\(]","",new_line)
# new_line = re.sub(r"( +)|\,","\t",new_line)
Expand All @@ -77,6 +78,9 @@ def processGCODE(self, comm, line, *args, **kwargs):

if re.match(r"^Bed x:.+$", line.strip()):
self.old_marlin = True

if re.match(r"^G33 X.+$", line.strip()):
self.repetier_firmware = True

if self._settings.get(["stripFirst"]):
new_line.pop(0)
Expand All @@ -88,13 +92,13 @@ def processGCODE(self, comm, line, *args, **kwargs):

if self.processing and self.old_marlin and re.match(r"^Eqn coefficients:.+$", line.strip()):
self.old_marlin_offset = re.sub("^(Eqn coefficients:.+)(\d+.\d+)$",r"\2", line.strip())

if self.processing and "Home XYZ first" in line:
self._plugin_manager.send_plugin_message(self._identifier, dict(error=line.strip()))
self.processing = False
return line

if self.processing and "ok" in line and len(self.mesh) > 0:
if self.processing and ("ok" in line or (self.repetier_firmware and "T:" in line)) and len(self.mesh) > 0:
octoprint_printer_profile = self._printer_profile_manager.get_current()
volume = octoprint_printer_profile["volume"]
bed_type = volume["formFactor"]
Expand All @@ -117,7 +121,7 @@ def processGCODE(self, comm, line, *args, **kwargs):

bed = dict(type=bed_type,x_min=min_x,x_max=max_x,y_min=min_y,y_max=max_y,z_min=min_z,z_max=max_z)

if self.old_marlin:
if self.old_marlin or self.repetier_firmware:
a = np.swapaxes(self.mesh,1,0)
x = np.unique(a[0]).astype(np.float)
y = np.unique(a[1]).astype(np.float)
Expand All @@ -126,8 +130,11 @@ def processGCODE(self, comm, line, *args, **kwargs):
self._logger.debug(x)
self._logger.debug(y)
self._logger.debug(z)
self._logger.debug(self.old_marlin_offset)
self.mesh = np.subtract(z, [self.old_marlin_offset], dtype=np.float, casting='unsafe').tolist()
offset = 0
if self.old_marlin:
offset = self.old_marlin_offset
self._logger.debug(offset)
self.mesh = np.subtract(z, [offset], dtype=np.float, casting='unsafe').tolist()
self._logger.debug(self.mesh)

self.processing = False
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 = "0.1.5"
plugin_version = "0.1.6"

# 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 396f9cb

Please sign in to comment.