Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a and b to origin_axis #109

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion octoprint_bettergrblsupport/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
20 changes: 6 additions & 14 deletions octoprint_bettergrblsupport/_bgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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]
Expand Down
12 changes: 6 additions & 6 deletions octoprint_bettergrblsupport/static/txt/grbl_settings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down