From: Joseph Coffland Date: Sun, 10 Jun 2018 23:20:51 +0000 (-0700) Subject: Added unhome button on axis position popup., Ignore soft limits of max <= min., Fixed... X-Git-Url: https://git.buildbotics.com/?a=commitdiff_plain;h=b918f1d34a5682655ea4a100edfe09ed5a457735;p=bbctrl-firmware Added unhome button on axis position popup., Ignore soft limits of max <= min., Fixed problem with restarting program in imperial units mode. --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 57d76b9..0315dca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 index 0000000..3337674 --- /dev/null +++ b/scripts/ratpoisonrc @@ -0,0 +1 @@ +startup_message off diff --git a/scripts/setup_rpi.sh b/scripts/setup_rpi.sh index f1530f1..e672669 100755 --- a/scripts/setup_rpi.sh +++ b/scripts/setup_rpi.sh @@ -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 index 0000000..acbd369 --- /dev/null +++ b/scripts/xorg.conf @@ -0,0 +1,3 @@ +Section "ServerFlags" + Option "DontVTSwitch" "on" +EndSection diff --git a/src/jade/templates/control-view.jade b/src/jade/templates/control-view.jade index ee9f84e..1eca81d 100644 --- a/src/jade/templates/control-view.jade +++ b/src/jade/templates/control-view.jade @@ -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 diff --git a/src/js/control-view.js b/src/js/control-view.js index a8c10a1..eb32f22 100644 --- a/src/js/control-view.js +++ b/src/js/control-view.js @@ -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; diff --git a/src/py/bbctrl/Mach.py b/src/py/bbctrl/Mach.py index 6c6d843..bd33dab 100644 --- a/src/py/bbctrl/Mach.py +++ b/src/py/bbctrl/Mach.py @@ -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() diff --git a/src/py/bbctrl/Planner.py b/src/py/bbctrl/Planner.py index bb08c9e..fd9f01c 100644 --- a/src/py/bbctrl/Planner.py +++ b/src/py/bbctrl/Planner.py @@ -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') diff --git a/src/py/bbctrl/Web.py b/src/py/bbctrl/Web.py index cab3b13..8e213cb 100644 --- a/src/py/bbctrl/Web.py +++ b/src/py/bbctrl/Web.py @@ -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),