Added unhome button on axis position popup., Ignore soft limits of max <= min., Fixed...
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Sun, 10 Jun 2018 23:20:51 +0000 (16:20 -0700)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Sun, 10 Jun 2018 23:20:51 +0000 (16:20 -0700)
CHANGELOG.md
scripts/ratpoisonrc [new file with mode: 0755]
scripts/setup_rpi.sh
scripts/xorg.conf [new file with mode: 0644]
src/jade/templates/control-view.jade
src/js/control-view.js
src/py/bbctrl/Mach.py
src/py/bbctrl/Planner.py
src/py/bbctrl/Web.py

index 57d76b917c5a72cf7c3397b4bd6ab83e5d0e9d77..0315dca3730cb6c6132b2aeb2f3c252d9aaf2977 100644 (file)
@@ -2,7 +2,9 @@ Buildbotics CNC Controller Firmware Changelog
 ==============================================
 
 ## v0.3.24
- -
+ - Added unhome button on axis position popup.
+ - Ignore soft limits of max <= min.
+ - Fixed problem with restarting program in imperial units mode.
 
 ## v0.3.23
  - Fix for modbus read operation.
diff --git a/scripts/ratpoisonrc b/scripts/ratpoisonrc
new file mode 100755 (executable)
index 0000000..3337674
--- /dev/null
@@ -0,0 +1 @@
+startup_message off
index f1530f138f273822ffd5a3467c3042024f3b10b5..e67266909b805fd414f3dc7c5d0935308eb0b7e7 100755 (executable)
@@ -77,6 +77,8 @@ sed -i 's/^PARTUUID=.*\//\/dev\/mmcblk0p2 \//' /etc/fstab
 sed -i 's/allowed_users=console/allowed_users=anybody/' /etc/X11/Xwrapper.config
 echo "sudo -u pi startx" >> /etc/rc.local
 cp /mnt/host/xinitrc /home/pi/.xinitrc
+cp /mnt/host/ratpoisonrc /home/pi/.ratpoisonrc
+cp /mnt/host/xorg.conf /etc/X11/
 
 # Set screen resolution
 sed -i 's/^#disable_overscan/disable_overscan/' /boot/config.txt
@@ -96,6 +98,9 @@ cd ..
 rm -rf $(basename bbctrl-*.tar.bz2 .tar.bz2)
 
 
+# Allow any user to shutdown
+chmod +s /sbin/{halt,reboot,shutdown,poweroff}
+
 # Clean up
 apt-get autoremove -y
 apt-get autoclean -y
diff --git a/scripts/xorg.conf b/scripts/xorg.conf
new file mode 100644 (file)
index 0000000..acbd369
--- /dev/null
@@ -0,0 +1,3 @@
+Section "ServerFlags"
+    Option "DontVTSwitch" "on"
+EndSection
index ee9f84e1809ef678dc615c635dc382c3888b9481..1eca81d1f2931236c9a73c548b37c4feffd3d961 100644 (file)
@@ -79,9 +79,13 @@ script#control-view-template(type="text/x-template")
                 button.pure-button(@click="position_msg['#{axis}'] = false")
                   | Cancel
 
+                button.pure-button(v-if="is_homed('#{axis}')",
+                  @click="unhome('#{axis}')") Unhome
+
                 button.pure-button.button-success(
                   @click="set_position('#{axis}', axis_position)") Set
 
+
             message(:show.sync="manual_home['#{axis}']")
               h3(slot="header") Manually home {{'#{axis}' | upper}} axis
 
index a8c10a14ce0728338d33415fa5d02bbcc9200dff..eb32f221768b1d4e1979f372b57db7259e6c2313 100644 (file)
@@ -280,6 +280,12 @@ module.exports = {
     },
 
 
+    unhome: function (axis) {
+      this.position_msg[axis] = false;
+      api.put('home/' + axis + '/clear');
+    },
+
+
     show_set_position: function (axis) {
       this.axis_position = 0;
       this.position_msg[axis] = true;
index 6c6d843e48403aea4e091a65ef074aeaafec2cf9..bd33dabf71e27d94a0ebccb82a44bd5e1a63fae2 100644 (file)
@@ -209,9 +209,7 @@ class Mach(Comm):
     def home(self, axis, position = None):
         state = self.ctrl.state
 
-        if position is not None:
-            self.mdi('G28.3 %c%f' % (axis, position))
-            super().resume()
+        if position is not None: self.mdi('G28.3 %c%f' % (axis, position))
 
         else:
             self._begin_cycle('homing')
@@ -238,7 +236,9 @@ class Mach(Comm):
                 # Home axis
                 log.info('Homing %s axis' % axis)
                 self.planner.mdi(axis_homing_procedure % {'axis': axis}, False)
-                super().resume()
+
+
+    def unhome(self, axis): self.mdi('G28.2 %c0' % axis)
 
 
     def estop(self): super().estop()
index bb08c9e4ba008511ef3dde2430b5c0ec5ded3e7e..fd9f01c523ec8c29974e77e9e842b68725efe147 100644 (file)
@@ -100,8 +100,16 @@ class Planner():
             }
 
         if with_limits:
-            config['min-soft-limit'] = self._get_soft_limit('tn', -math.inf)
-            config['max-soft-limit'] = self._get_soft_limit('tm', math.inf)
+            minLimit = self._get_soft_limit('tn', -math.inf)
+            maxLimit = self._get_soft_limit('tm', math.inf)
+
+            # If max <= min then no limit
+            for axis in 'xyzabc':
+                if maxLimit[axis] <= minLimit[axis]:
+                    minLimit[axis], maxLimit[axis] = -math.inf, math.inf
+
+            config['min-soft-limit'] = minLimit
+            config['max-soft-limit'] = maxLimit
 
         if not mdi:
             program_start = self.ctrl.config.get('program-start')
index cab3b13e5be336285d326e92a4af1ea538c80aa2..8e213cb585acb3d682082de90d275ee7c5bdef65 100644 (file)
@@ -232,15 +232,16 @@ class UpgradeHandler(bbctrl.APIHandler):
 
 
 class HomeHandler(bbctrl.APIHandler):
-    def put_ok(self, axis, set_home):
+    def put_ok(self, axis, action, *args):
         if axis is not None: axis = ord(axis[1:2].lower())
 
-        if set_home:
+        if action == '/set':
             if not 'position' in self.json:
                 raise HTTPError(400, 'Missing "position"')
 
             self.ctrl.mach.home(axis, self.json['position'])
 
+        elif action == '/clear': self.ctrl.mach.unhome(axis)
         else: self.ctrl.mach.home(axis)
 
 
@@ -386,7 +387,7 @@ class Web(tornado.web.Application):
             (r'/api/firmware/update', FirmwareUpdateHandler),
             (r'/api/upgrade', UpgradeHandler),
             (r'/api/file(/.+)?', bbctrl.FileHandler),
-            (r'/api/home(/[xyzabcXYZABC](/set)?)?', HomeHandler),
+            (r'/api/home(/[xyzabcXYZABC]((/set)|(/clear))?)?', HomeHandler),
             (r'/api/start', StartHandler),
             (r'/api/estop', EStopHandler),
             (r'/api/clear', ClearHandler),