Skip to content

Commit 48fecb4

Browse files
committed
- refactor axis inversion (#74 & #61)
- reorganized Plugin Settings
1 parent 627c724 commit 48fecb4

File tree

4 files changed

+28
-12
lines changed

4 files changed

+28
-12
lines changed

octoprint_bettergrblsupport/__init__.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def __init__(self):
131131
self.invertZ = 1
132132

133133
self.settingsVersion = 5
134-
self.wizardVersion = 5
134+
self.wizardVersion = 6
135135

136136
# load up our item/value pairs for errors, warnings, and settings
137137
_bgs.load_grbl_descriptions(self)
@@ -190,7 +190,10 @@ def get_settings_defaults(self):
190190
autoSleep = False,
191191
autoSleepInterval = 20,
192192
zProbeConfirmActions = True,
193-
wizard_version = 1
193+
wizard_version = 1,
194+
invertX = False,
195+
invertY = False,
196+
invertZ = False
194197
)
195198

196199

@@ -263,6 +266,11 @@ def on_after_startup(self):
263266
self.autoSleep = self._settings.get_boolean(["autoSleep"])
264267
self.autoSleepInterval = round(float(self._settings.get(["autoSleepInterval"])))
265268

269+
self.invertX = -1 if self._settings.get_boolean(["invertX"]) else 1
270+
self.invertY = -1 if self._settings.get_boolean(["invertY"]) else 1
271+
self.invertZ = -1 if self._settings.get_boolean(["invertZ"]) else 1
272+
273+
self._logger.debug("axis inversion X=[{}] Y=[{}] Z=[{}]".format(self.invertX, self.invertY, self.invertZ))
266274

267275
if self.neverSendChecksum:
268276
self._settings.global_set(["serial", "checksumRequiringCommands"], [])
@@ -1124,12 +1132,6 @@ def hook_gcode_received(self, comm_instance, line, *args, **kwargs):
11241132
distance = float(min([self.xLimit, self.yLimit]))
11251133
self._settings.set(["control_distance"], distance)
11261134

1127-
# direction mask -- need to account for it when Jogging
1128-
self.invertX = -1 if 1 & int(float(self.grblSettings.get(3)[0])) > 0 else 1
1129-
self.invertY = -1 if 2 & int(float(self.grblSettings.get(3)[0])) > 1 else 1
1130-
self.invertZ = -1 if int(float(self.grblSettings.get(3)[0])) > 3 else 1
1131-
self._logger.debug("axis invert mask x=[%d] y=[%d] z=[%d]", self.invertX, self.invertY, self.invertZ)
1132-
11331135
self._settings.save()
11341136

11351137
return line

octoprint_bettergrblsupport/templates/bettergrblsupport_settings.jinja2

+12
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,18 @@
113113

114114
<br>
115115

116+
<div class="controls">
117+
<input type="checkbox" data-bind="checked: settings.plugins.bettergrblsupport.invertX"> Invert X Axis (jogging / framing / probing)
118+
</div>
119+
<div class="controls">
120+
<input type="checkbox" data-bind="checked: settings.plugins.bettergrblsupport.invertY"> Invert Y Axis (jogging / framing / probing)
121+
</div>
122+
<div class="controls">
123+
<input type="checkbox" data-bind="checked: settings.plugins.bettergrblsupport.invertZ"> Invert Z Axis (jogging / probing)
124+
</div>
125+
126+
<br>
127+
116128
<div class="controls">
117129
<input type="checkbox" data-bind="checked: settings.plugins.bettergrblsupport.autoSleep"> Sleep automatically
118130
</div>

octoprint_bettergrblsupport/templates/bettergrblsupport_wizard.jinja2

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
Please visit the <a href="https://www.apache.org/licenses/LICENSE-2.0.txt" target="_blank">Apache Software Foundation</a> website for more details.
1010
<br>
1111
<br>
12-
<h3>Release Notes (2.2.0 RC1)</h3>
12+
<h3>Release Notes (2.2.0 RC2)</h3>
1313
<ul>
14-
<li>X/Y Probing and the settings necessary to run it in Plugin Properties
15-
<li>Chained XYZ Probing when axis selector is "ALL"
14+
<li>X/Y Probing and the settings necessary to run it in Plugin Properties</li>
15+
<li>Chained XYZ Probing when axis selector is "ALL"</li>
16+
<li>Invert X/Y/Z via Invert Axis Jog Setting in Plugin Settings</li>
17+
<li>Rearranged / better organized Plugin Settings</li>
1618
</ul>
1719
<br>
1820
<h3>In Need of Help?</h3>

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
plugin_name = "Better Grbl Support"
1515

1616
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
17-
plugin_version = "2.2.0rc1"
17+
plugin_version = "2.2.0rc2"
1818

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

0 commit comments

Comments
 (0)