Add axis bounds GCode variables #<_x_min>, #<_x_max>, etc. re #235
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Thu, 30 Jan 2020 21:38:07 +0000 (13:38 -0800)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Thu, 30 Jan 2020 21:39:07 +0000 (13:39 -0800)
CHANGELOG.md
src/py/bbctrl/State.py
src/py/bbctrl/Web.py

index 2cc78dead4ac52678060373be1719e96048f5e1b..4d279029a81c239f2958dda31e0413073aa97609 100644 (file)
@@ -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.
index bbfbbf8be197648148c05d33aefe8fd096e94a52..614660dd656414d0af0da8dcd0cdadf44dbb6a31 100644 (file)
@@ -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']
index d90f0638e316ecfe691df5b5e8ef977b57123164..2112608f33b9aea88436f9f8593058cbdab565b0 100644 (file)
@@ -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: