From d07257e615a6da7728f136432b5a48d306c7667a Mon Sep 17 00:00:00 2001 From: paukstelis Date: Thu, 29 Dec 2022 20:12:42 -0500 Subject: [PATCH 01/16] add a and b axes --- octoprint_bettergrblsupport/__init__.py | 12 ++++++++++ .../templates/bettergrblsupport_tab.jinja2 | 24 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/octoprint_bettergrblsupport/__init__.py b/octoprint_bettergrblsupport/__init__.py index 710c751..94fadfd 100644 --- a/octoprint_bettergrblsupport/__init__.py +++ b/octoprint_bettergrblsupport/__init__.py @@ -1390,6 +1390,18 @@ def on_api_command(self, command, data): if direction == "down": self._printer.commands("{}G91 G21 Z{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1 * self.invertZ, zf)) + + if direction == "a-right": + self._printer.commands("{}G91 G21 A{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1 * self.invertZ, zf)) + + if direction == "a-left": + self._printer.commands("{}G91 G21 A-{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1 * self.invertZ, zf)) + + if direction == "b-right": + self._printer.commands("{}G91 G21 B{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1 * self.invertZ, zf)) + + if direction == "b-left": + self._printer.commands("{}G91 G21 B-{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1 * self.invertZ, zf)) return diff --git a/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 b/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 index 50ecd3b..2083116 100644 --- a/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 +++ b/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 @@ -164,6 +164,30 @@ + + A-axis: + + + + + + + B-axis: + + + + + + + From 075d4e9435ed4c5b9d666631cdc12aad79ad20d7 Mon Sep 17 00:00:00 2001 From: paukstelis Date: Thu, 29 Dec 2022 20:17:07 -0500 Subject: [PATCH 02/16] playing --- .../templates/bettergrblsupport_tab.jinja2 | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 b/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 index 2083116..100f3f8 100644 --- a/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 +++ b/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 @@ -165,26 +165,24 @@ - A-axis: - + - + - B-axis: - + - + From 0f16075f01b19b53e0f27111ac58c5e9729b37ad Mon Sep 17 00:00:00 2001 From: paukstelis Date: Thu, 29 Dec 2022 20:21:42 -0500 Subject: [PATCH 03/16] format --- .../templates/bettergrblsupport_tab.jinja2 | 6 ------ 1 file changed, 6 deletions(-) diff --git a/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 b/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 index 100f3f8..e3975d7 100644 --- a/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 +++ b/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 @@ -169,18 +169,12 @@ - - - - - - From df17c1ee43f65a718327c8b2be4d47c1d41530c6 Mon Sep 17 00:00:00 2001 From: paukstelis Date: Thu, 29 Dec 2022 20:26:05 -0500 Subject: [PATCH 04/16] double minus? --- octoprint_bettergrblsupport/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/octoprint_bettergrblsupport/__init__.py b/octoprint_bettergrblsupport/__init__.py index 94fadfd..8ccbe75 100644 --- a/octoprint_bettergrblsupport/__init__.py +++ b/octoprint_bettergrblsupport/__init__.py @@ -1395,13 +1395,13 @@ def on_api_command(self, command, data): self._printer.commands("{}G91 G21 A{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1 * self.invertZ, zf)) if direction == "a-left": - self._printer.commands("{}G91 G21 A-{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1 * self.invertZ, zf)) + self._printer.commands("{}G91 G21 A{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1 * self.invertZ, zf)) if direction == "b-right": self._printer.commands("{}G91 G21 B{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1 * self.invertZ, zf)) if direction == "b-left": - self._printer.commands("{}G91 G21 B-{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1 * self.invertZ, zf)) + self._printer.commands("{}G91 G21 B{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1 * self.invertZ, zf)) return From 217db8acb19bb55aab28e30f3e3fac54108e6ec4 Mon Sep 17 00:00:00 2001 From: paukstelis Date: Thu, 29 Dec 2022 20:28:54 -0500 Subject: [PATCH 05/16] too many minus --- octoprint_bettergrblsupport/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/octoprint_bettergrblsupport/__init__.py b/octoprint_bettergrblsupport/__init__.py index 8ccbe75..712ef54 100644 --- a/octoprint_bettergrblsupport/__init__.py +++ b/octoprint_bettergrblsupport/__init__.py @@ -1398,10 +1398,10 @@ def on_api_command(self, command, data): self._printer.commands("{}G91 G21 A{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1 * self.invertZ, zf)) if direction == "b-right": - self._printer.commands("{}G91 G21 B{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1 * self.invertZ, zf)) + self._printer.commands("{}G91 G21 B{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance, zf)) if direction == "b-left": - self._printer.commands("{}G91 G21 B{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1 * self.invertZ, zf)) + self._printer.commands("{}G91 G21 B{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1, zf)) return From 2ec9fb5a363702c241f3a745fa427293cf454e08 Mon Sep 17 00:00:00 2001 From: paukstelis Date: Thu, 29 Dec 2022 20:33:44 -0500 Subject: [PATCH 06/16] mind boggle --- octoprint_bettergrblsupport/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/octoprint_bettergrblsupport/__init__.py b/octoprint_bettergrblsupport/__init__.py index 712ef54..7c632d0 100644 --- a/octoprint_bettergrblsupport/__init__.py +++ b/octoprint_bettergrblsupport/__init__.py @@ -1392,13 +1392,13 @@ def on_api_command(self, command, data): self._printer.commands("{}G91 G21 Z{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1 * self.invertZ, zf)) if direction == "a-right": - self._printer.commands("{}G91 G21 A{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1 * self.invertZ, zf)) + self._printer.commands("{}G91 G21 A{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance, zf)) if direction == "a-left": - self._printer.commands("{}G91 G21 A{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1 * self.invertZ, zf)) + self._printer.commands("{}G91 G21 A{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1, zf)) if direction == "b-right": - self._printer.commands("{}G91 G21 B{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance, zf)) + self._printer.commands("{}G91 G21 B{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1, zf)) if direction == "b-left": self._printer.commands("{}G91 G21 B{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1, zf)) From ccc0fc361f3abf41dad3ccb7daf487933a3031ec Mon Sep 17 00:00:00 2001 From: paukstelis Date: Thu, 29 Dec 2022 20:36:30 -0500 Subject: [PATCH 07/16] formating --- octoprint_bettergrblsupport/__init__.py | 2 +- .../templates/bettergrblsupport_tab.jinja2 | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/octoprint_bettergrblsupport/__init__.py b/octoprint_bettergrblsupport/__init__.py index 7c632d0..9171e6d 100644 --- a/octoprint_bettergrblsupport/__init__.py +++ b/octoprint_bettergrblsupport/__init__.py @@ -1398,7 +1398,7 @@ def on_api_command(self, command, data): self._printer.commands("{}G91 G21 A{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1, zf)) if direction == "b-right": - self._printer.commands("{}G91 G21 B{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1, zf)) + self._printer.commands("{}G91 G21 B{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance, zf)) if direction == "b-left": self._printer.commands("{}G91 G21 B{:f} F{}".format("$J=" if _bgs.is_grbl_one_dot_one(self) else "G1 ", distance * -1, zf)) diff --git a/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 b/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 index e3975d7..1e44e55 100644 --- a/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 +++ b/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 @@ -172,6 +172,8 @@ + + From bba0446b85ed46af4b321600baa1fb67a3955b89 Mon Sep 17 00:00:00 2001 From: paukstelis Date: Thu, 29 Dec 2022 21:04:45 -0500 Subject: [PATCH 08/16] trying kos --- octoprint_bettergrblsupport/__init__.py | 4 +++- .../templates/bettergrblsupport_settings.jinja2 | 6 ++++++ .../templates/bettergrblsupport_tab.jinja2 | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/octoprint_bettergrblsupport/__init__.py b/octoprint_bettergrblsupport/__init__.py index 9171e6d..95bd2e9 100644 --- a/octoprint_bettergrblsupport/__init__.py +++ b/octoprint_bettergrblsupport/__init__.py @@ -260,7 +260,9 @@ def get_settings_defaults(self): bgsFilters = self.bgs_filters, activeFilters = [], fluidYaml = None, - fluidSettings = {} + fluidSettings = {}, + hasA = False, + hasB = False ) diff --git a/octoprint_bettergrblsupport/templates/bettergrblsupport_settings.jinja2 b/octoprint_bettergrblsupport/templates/bettergrblsupport_settings.jinja2 index 8549201..14d64fa 100644 --- a/octoprint_bettergrblsupport/templates/bettergrblsupport_settings.jinja2 +++ b/octoprint_bettergrblsupport/templates/bettergrblsupport_settings.jinja2 @@ -156,6 +156,12 @@ + +
diff --git a/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 b/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 index 1e44e55..41afce9 100644 --- a/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 +++ b/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 @@ -165,6 +165,7 @@ + + + + From 6dc2de296b62c34f718a20a12e5bf6b81d2179f2 Mon Sep 17 00:00:00 2001 From: paukstelis Date: Thu, 29 Dec 2022 21:13:49 -0500 Subject: [PATCH 09/16] adding a and b kos --- .../static/js/bettergrblsupport.js | 5 +++++ .../templates/bettergrblsupport_tab.jinja2 | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/octoprint_bettergrblsupport/static/js/bettergrblsupport.js b/octoprint_bettergrblsupport/static/js/bettergrblsupport.js index 2b0e0f5..c92d528 100644 --- a/octoprint_bettergrblsupport/static/js/bettergrblsupport.js +++ b/octoprint_bettergrblsupport/static/js/bettergrblsupport.js @@ -50,6 +50,8 @@ $(function() { self.xPos = ko.observable("N/A"); self.yPos = ko.observable("N/A"); self.zPos = ko.observable("N/A"); + self.aPos = ko.observable("N/A"); + self.bPos = ko.observable("N/A"); self.power = ko.observable("N/A"); self.speed = ko.observable("N/A"); self.pins = ko.observable("N/A") @@ -496,6 +498,9 @@ $(function() { if (data.x != undefined) self.xPos(Number.parseFloat(data.x).toFixed(2)); if (data.y != undefined) self.yPos(Number.parseFloat(data.y).toFixed(2)); if (data.z != undefined) self.zPos(Number.parseFloat(data.z).toFixed(2)); + if (data.a != undefined) self.aPos(Number.parseFloat(data.a).toFixed(2)); + if (data.b != undefined) self.bPos(Number.parseFloat(data.b).toFixed(2)); + if (data.speed != undefined) self.speed(Number.parseFloat(data.speed).toFixed(2)); if (data.pins != undefined) self.pins(data.pins); diff --git a/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 b/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 index 41afce9..825a9a7 100644 --- a/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 +++ b/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 @@ -53,6 +53,18 @@ Z + + + A + + + + + + B + + + Power From c056cf8831a1fc39354bb00bb6feeb7aa6e86c89 Mon Sep 17 00:00:00 2001 From: paukstelis Date: Thu, 29 Dec 2022 21:33:01 -0500 Subject: [PATCH 10/16] try to get a and b positions --- octoprint_bettergrblsupport/_bgs.py | 34 +++++++++++++++++++---------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/octoprint_bettergrblsupport/_bgs.py b/octoprint_bettergrblsupport/_bgs.py index f207d79..9c3170b 100644 --- a/octoprint_bettergrblsupport/_bgs.py +++ b/octoprint_bettergrblsupport/_bgs.py @@ -587,18 +587,28 @@ def toggle_weak(_plugin): def process_grbl_status_msg(_plugin, msg): - match = re.search(r'<(-?[^,]+)[,|][WM]Pos:(-?[\d\.]+),(-?[\d\.]+),(-?[\d\.]+)', msg) - if match is None: - _plugin._logger.warning('Bad data %s', msg.rstrip()) - return None - - response = 'X:{1} Y:{2} Z:{3} 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]) + #need to redefine much of this if we have more axes + hasA = _plugin._settings.get(["hasA"]) + hasB = _plugin._settings.get(["hasB"]) + if not hasA and not hasB: + match = re.search(r'<(-?[^,]+)[,|][WM]Pos:(-?[\d\.]+),(-?[\d\.]+),(-?[\d\.]+)', msg) + response = 'X:{1} Y:{2} Z:{3} 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]) + + 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:([XYZPDHRS]+)', msg) if not match is None: From 2d3b9d0c0c65ba9ab33d8136ce73c7c2df514add Mon Sep 17 00:00:00 2001 From: paukstelis Date: Thu, 29 Dec 2022 22:04:27 -0500 Subject: [PATCH 11/16] labels --- octoprint_bettergrblsupport/__init__.py | 4 ++++ .../templates/bettergrblsupport_tab.jinja2 | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/octoprint_bettergrblsupport/__init__.py b/octoprint_bettergrblsupport/__init__.py index 95bd2e9..d565464 100644 --- a/octoprint_bettergrblsupport/__init__.py +++ b/octoprint_bettergrblsupport/__init__.py @@ -92,6 +92,8 @@ def __init__(self): self.grblX = float(0) self.grblY = float(0) self.grblZ = float(0) + self.grblA = float(0) + self.grblB = float(0) self.grblActivePins = "" self.grblSpeed = float(0) self.grblPowerLevel = float(0) @@ -949,6 +951,8 @@ def hook_gcode_sending(self, comm_instance, phase, cmd, cmd_type, gcode, *args, found = True foundZ = True + #ADD A and B here + # match = re.search(r"^[GM]([0][01234]|[01234])(\D.*[Ff]|[Ff])\ *(-?[\d.]+).*", command) match = re.search(r".*[Ff]\ *(-?[\d.]+).*", cmd) if not match is None: diff --git a/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 b/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 index 825a9a7..425bd34 100644 --- a/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 +++ b/octoprint_bettergrblsupport/templates/bettergrblsupport_tab.jinja2 @@ -176,6 +176,18 @@ + + + + + + + + + + + + From 96184f0a37e8c2ea7a1baa1b717f78446b8be282 Mon Sep 17 00:00:00 2001 From: paukstelis Date: Fri, 30 Dec 2022 10:00:42 -0500 Subject: [PATCH 12/16] try to get A and B messages --- octoprint_bettergrblsupport/__init__.py | 9 +++++++++ octoprint_bettergrblsupport/_bgs.py | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/octoprint_bettergrblsupport/__init__.py b/octoprint_bettergrblsupport/__init__.py index d565464..251a9c5 100644 --- a/octoprint_bettergrblsupport/__init__.py +++ b/octoprint_bettergrblsupport/__init__.py @@ -952,6 +952,15 @@ def hook_gcode_sending(self, comm_instance, phase, cmd, cmd_type, gcode, *args, foundZ = True #ADD A and B here + match = re.search(r".*[Aa]\ *(-?[\d.]+).*", cmd) + if not match is None: + self.grblA = float(match.groups(1)[0]) if self.positioning == 0 else self.grblA + float(match.groups(1)[0]) + found = True + + match = re.search(r".*[Bb]\ *(-?[\d.]+).*", cmd) + if not match is None: + self.grblB = float(match.groups(1)[0]) if self.positioning == 0 else self.grblB + float(match.groups(1)[0]) + found = True # match = re.search(r"^[GM]([0][01234]|[01234])(\D.*[Ff]|[Ff])\ *(-?[\d.]+).*", command) match = re.search(r".*[Ff]\ *(-?[\d.]+).*", cmd) diff --git a/octoprint_bettergrblsupport/_bgs.py b/octoprint_bettergrblsupport/_bgs.py index 9c3170b..bb8b1cc 100644 --- a/octoprint_bettergrblsupport/_bgs.py +++ b/octoprint_bettergrblsupport/_bgs.py @@ -610,7 +610,7 @@ def process_grbl_status_msg(_plugin, msg): _plugin.grblA = float(match.groups(1)[4]) _plugin.grblB = float(match.groups(1)[5]) - match = re.search(r'.*\|Pn:([XYZPDHRS]+)', msg) + match = re.search(r'.*\|Pn:([XYZABPDHRS]+)', msg) if not match is None: _plugin.grblActivePins = match.groups(1)[0] else: @@ -627,6 +627,8 @@ def process_grbl_status_msg(_plugin, msg): x=_plugin.grblX, y=_plugin.grblY, z=_plugin.grblZ, + a=_plugin.grblA, + b=_plugin.grblB, pins=_plugin.grblActivePins, speed=_plugin.grblSpeed, power=_plugin.grblPowerLevel, From 49717b0bb972efd73b8d43a8bff8a97e84ffc2eb Mon Sep 17 00:00:00 2001 From: paukstelis Date: Fri, 30 Dec 2022 19:08:08 -0500 Subject: [PATCH 13/16] include a and b in message --- octoprint_bettergrblsupport/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/octoprint_bettergrblsupport/__init__.py b/octoprint_bettergrblsupport/__init__.py index 251a9c5..affa677 100644 --- a/octoprint_bettergrblsupport/__init__.py +++ b/octoprint_bettergrblsupport/__init__.py @@ -1017,6 +1017,8 @@ def hook_gcode_sending(self, comm_instance, phase, cmd, cmd_type, gcode, *args, x=self.grblX, y=self.grblY, z=self.grblZ, + a=self.grblA, + b=self.grblB, speed=self.grblSpeed, power=self.grblPowerLevel, positioning=self.positioning, From e9ce0ab85cb44b28e2558787f8c3dbc40ffa507e Mon Sep 17 00:00:00 2001 From: paukstelis Date: Sat, 31 Dec 2022 09:30:16 -0500 Subject: [PATCH 14/16] msg regex --- octoprint_bettergrblsupport/_bgs.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/octoprint_bettergrblsupport/_bgs.py b/octoprint_bettergrblsupport/_bgs.py index bb8b1cc..8eff1eb 100644 --- a/octoprint_bettergrblsupport/_bgs.py +++ b/octoprint_bettergrblsupport/_bgs.py @@ -590,15 +590,24 @@ def process_grbl_status_msg(_plugin, msg): #need to redefine much of this if we have more axes hasA = _plugin._settings.get(["hasA"]) hasB = _plugin._settings.get(["hasB"]) - if not hasA and not hasB: - match = re.search(r'<(-?[^,]+)[,|][WM]Pos:(-?[\d\.]+),(-?[\d\.]+),(-?[\d\.]+)', msg) - response = 'X:{1} Y:{2} Z:{3} 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]) + 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) + _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]) + + if match.groups(1)[5]: + _plugin.grblA = float(match.groups(1)[4]) + _plugin.grblB = float(match.groups(1)[5]) + if match.groups(1)[4] and not match.groups(1)[5] and hasB: + _plugin.grblB = float(match.groups(1)[4]) + else: + _plugin.grblA = float(match.groups(1)[4]) + + ''' 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) @@ -609,7 +618,7 @@ def process_grbl_status_msg(_plugin, msg): _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] From c90be0b462df0f8ab7372217b17ce1a455917d61 Mon Sep 17 00:00:00 2001 From: paukstelis Date: Wed, 4 Jan 2023 07:33:48 -0500 Subject: [PATCH 15/16] add a and b to origin_axes conditionally --- octoprint_bettergrblsupport/static/js/bettergrblsupport.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/octoprint_bettergrblsupport/static/js/bettergrblsupport.js b/octoprint_bettergrblsupport/static/js/bettergrblsupport.js index c92d528..d88a780 100644 --- a/octoprint_bettergrblsupport/static/js/bettergrblsupport.js +++ b/octoprint_bettergrblsupport/static/js/bettergrblsupport.js @@ -32,6 +32,8 @@ $(function() { self.webcamError = ko.observable(false); self.origin_axes = ko.observableArray(["Z", "Y", "X", "XY", "ALL"]); + if (self.settings.hasA() == true) { self.origin_axes.push("A"); } + if (self.settings.hasB() == true) { self.origin_axes.push("B"); } self.origin_axis = ko.observable("XY"); self.coordinate_systems = ko.observableArray(["G54", "G55", "G56", "G57", "G58", "G59"]); From 863eafc4f86e559edb239f6c9be97e1977cf0bed Mon Sep 17 00:00:00 2001 From: paukstelis Date: Wed, 4 Jan 2023 07:33:51 -0500 Subject: [PATCH 16/16] origin_axes --- .vscode/settings.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..29819fc --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,20 @@ +{ + "MicroPython.executeButton": [ + { + "text": "▶", + "tooltip": "Run", + "alignment": "left", + "command": "extension.executeFile", + "priority": 3.5 + } + ], + "MicroPython.syncButton": [ + { + "text": "$(sync)", + "tooltip": "sync", + "alignment": "left", + "command": "extension.execute", + "priority": 4 + } + ] +} \ No newline at end of file