diff --git a/octoprint_bettergrblsupport/__init__.py b/octoprint_bettergrblsupport/__init__.py index affa677..573770e 100644 --- a/octoprint_bettergrblsupport/__init__.py +++ b/octoprint_bettergrblsupport/__init__.py @@ -1424,6 +1424,13 @@ def on_api_command(self, command, data): if command == "origin": axis = data.get("origin_axis") + hasA = self._settings.get(["hasA"]) + hasB = self._settings.get(["hasB"]) + extra_axes = "" + if hasA: + extra_axes = extra_axes+"A0 " + if hasB: + extra_axes = extra_axes+"B0" program = int(float(self.grblCoordinateSystem.replace("G", ""))) program = -53 + program @@ -1436,8 +1443,12 @@ def on_api_command(self, command, data): self._printer.commands("G91 G10 P{} L20 Z0".format(program)) elif axis == "XY": self._printer.commands("G91 G10 P{} L20 X0 Y0".format(program)) + elif axis == "A" and hasA: + self._printer.commands("G91 G10 P{} L20 A0".format(program)) + elif axis == "B" and hasB: + self._printer.commands("G91 G10 P{} L20 B0".format(program)) else: - self._printer.commands("G91 G10 P{} L20 X0 Y0 Z0".format(program)) + self._printer.commands("G91 G10 P{0} L20 X0 Y0 Z0 {1}".format(program, extra_axes)) _bgs.add_notifications(self, ["Coordinate system {} home for {} set".format(program, axis)]) return diff --git a/octoprint_bettergrblsupport/_bgs.py b/octoprint_bettergrblsupport/_bgs.py index 8eff1eb..dc0ebf1 100644 --- a/octoprint_bettergrblsupport/_bgs.py +++ b/octoprint_bettergrblsupport/_bgs.py @@ -591,7 +591,8 @@ def process_grbl_status_msg(_plugin, msg): hasA = _plugin._settings.get(["hasA"]) hasB = _plugin._settings.get(["hasB"]) match = re.search(r'<(-?[^,]+)[,|][WM]Pos:(-?[\d\.]+),(-?[\d\.]+),(-?[\d\.]+),?(-?[\d\.]+)?,?(-?[\d\.]+)?', msg) - response = 'X:{1} Y:{2} Z:{3} E:0 {original}'.format(*match.groups(), original=msg) + #response = 'X:{1} Y:{2} Z:{3} E:0 {original}'.format(*match.groups(), original=msg) + response = 'X:{1} Y:{2} Z:{3} E:0 '.format(*match.groups()) _plugin.grblMode = "MPos" if "MPos" in msg else "WPos" if "WPos" in msg else "N/A" _plugin.grblState = str(match.groups(1)[0]) _plugin.grblX = float(match.groups(1)[1]) @@ -601,24 +602,15 @@ def process_grbl_status_msg(_plugin, msg): if match.groups(1)[5]: _plugin.grblA = float(match.groups(1)[4]) _plugin.grblB = float(match.groups(1)[5]) - + response = response+'A:{0} B:{1} '.format(_plugin.grblA, _plugin.grblB) if match.groups(1)[4] and not match.groups(1)[5] and hasB: _plugin.grblB = float(match.groups(1)[4]) + reponse = response+'B:{0}'.format(_plugin.grblB) else: _plugin.grblA = float(match.groups(1)[4]) + response = response+'A:{0} '.format(_plugin.grblA) + response = response+msg - ''' - if hasA and hasB: - match = re.search(r'<(-?[^,]+)[,|][WM]Pos:(-?[\d\.]+),(-?[\d\.]+),(-?[\d\.]+),(-?[\d\.]+),(-?[\d\.]+)', msg) - response = 'X:{1} Y:{2} Z:{3} A:{4} B:{5} E:0 {original}'.format(*match.groups(), original=msg) - _plugin.grblMode = "MPos" if "MPos" in msg else "WPos" if "WPos" in msg else "N/A" - _plugin.grblState = str(match.groups(1)[0]) - _plugin.grblX = float(match.groups(1)[1]) - _plugin.grblY = float(match.groups(1)[2]) - _plugin.grblZ = float(match.groups(1)[3]) - _plugin.grblA = float(match.groups(1)[4]) - _plugin.grblB = float(match.groups(1)[5]) - ''' match = re.search(r'.*\|Pn:([XYZABPDHRS]+)', msg) if not match is None: _plugin.grblActivePins = match.groups(1)[0] diff --git a/octoprint_bettergrblsupport/static/txt/grbl_settings.txt b/octoprint_bettergrblsupport/static/txt/grbl_settings.txt index 00d944c..001afc7 100644 --- a/octoprint_bettergrblsupport/static/txt/grbl_settings.txt +++ b/octoprint_bettergrblsupport/static/txt/grbl_settings.txt @@ -106,12 +106,12 @@ 143 $A/Current/Run 144 $B/Current/Run 145 $C/Current/Run -150 $X/Current/Hold -151 $Y/Current/Hold -152 $Z/Current/Hold -153 $A/Current/Hold -154 $B/Current/Hold -155 $C/Current/Hold +150 $X/Microsteps +151 $Y/Microsteps +152 $Z/Microsteps +153 $A/Microsteps +154 $B/Microsteps +155 $C/Microsteps 160 $X/Microsteps 161 $Y/Microsteps 162 $Z/Microsteps