From: Joseph Coffland Date: Thu, 30 Jan 2020 21:38:07 +0000 (-0800) Subject: Add axis bounds GCode variables #<_x_min>, #<_x_max>, etc. re #235 X-Git-Url: https://git.buildbotics.com/?a=commitdiff_plain;h=ff1a810db3cc6d262420f22a531b62fd5abc6af9;p=bbctrl-firmware Add axis bounds GCode variables #<_x_min>, #<_x_max>, etc. re #235 --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cc78de..4d27902 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Buildbotics CNC Controller Firmware Changelog - Better error handling in WiFi configuration. - Fix open WiFi access. - Fixes for MJPEG video format. Should help with video on iPhone. + - Add axis bounds GCode variables ``#<_x_min>``, ``#<_x_max>``, etc. ## v0.4.12 - Segments straddle arc in linearization. diff --git a/src/py/bbctrl/State.py b/src/py/bbctrl/State.py index bbfbbf8..614660d 100644 --- a/src/py/bbctrl/State.py +++ b/src/py/bbctrl/State.py @@ -145,6 +145,14 @@ class State(object): self.set('selected_time', time) + def set_bounds(self, bounds): + for axis in 'xyzabc': + for name in ('min', 'max'): + var = '%s_%s' % (axis, name) + value = bounds[name][axis] if axis in bounds[name] else 0 + self.set(var, value) + + def ack_message(self, id): self.log.info('Message %d acknowledged' % id) msgs = self.vars['messages'] diff --git a/src/py/bbctrl/Web.py b/src/py/bbctrl/Web.py index d90f063..2112608 100644 --- a/src/py/bbctrl/Web.py +++ b/src/py/bbctrl/Web.py @@ -301,6 +301,8 @@ class PathHandler(bbctrl.APIHandler): if data is None: return meta, positions, speeds = data + self.get_ctrl().state.set_bounds(meta['bounds']) + if dataType == '/positions': data = positions elif dataType == '/speeds': data = speeds else: