Sorry to follow up to my own post (I seem to be forming a habit!). My previous patches to add set-mdi-mode and a manual.mode pin in Axis works but... I just noticed that starting from scratch my customer_postgui.hal logic didn't match the initial state of Axis so you had to do a F3/F5 flip before the toggle button would work.
AFAICS, there's no way of setting the initial state of the toggles or inverting the sense of toggle2nist.N.is-on so I've tweaked (+2 lines) the mod to also provide a pin for mdi mode. I also took the opportunity of changing the names to mode.manual and mode.mdi as this seems to fit better with the existing naming schemes. ....then I got in a complete muddle with git (not really used it in anger before) and borked everything :-( So here's both patches again from scratch; or if it's easier here: http://ruffle.me.uk/0001-Add-pins-set-mdi-mode-mode.mdi-and-mode.manual-to-Ax.patch >From f22ddf43abd7b7a65c4a6243270f3b7e8beeffa1 Mon Sep 17 00:00:00 2001 From: RussellBrown <[email protected]> Date: Tue, 26 Nov 2013 13:56:38 +0000 Subject: [PATCH] Add pins set-mdi-mode, mode.mdi and mode.manual to Axisui. The set-mdi-mode pin complements the existing set-manual-mode pin. The mode.mdi and mode.manual allow the use of toggle2nist logic (which requires a current status pin) to flip the Axis mode. I've used these to provide a toggle button on my pendant to toggle axis between manual and MDI mode when jogging and calling a mdi based z-axis touchoff routine like so: net tog_mode xhc-hb04.button-mode => toggle.N.in net tog_mode_out toggle.N.out => toggle2nist.N.in net is_mode_mdi axisui.mode.mdi => toggle2nist.N.is-on net flip_to_mdi toggle2nist.N.on => axisui.set-mdi-mode net flip_to_manual toggle2nist.N.off => axisui.set-manual-mode Note: The set-mdi-mode bit is *not* my orginal work. It was taken from a post by Big John T in the following forum thread: http://www.linuxcnc.org/linuxcnc/index.php/forum/21-axis/24219 I did the mode.mdi/manual bit. --- src/emc/usr_intf/axis/scripts/axis.py | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/src/emc/usr_intf/axis/scripts/axis.py b/src/emc/usr_intf/axis/scripts/axis.py index 49b850e..23132e9 100755 --- a/src/emc/usr_intf/axis/scripts/axis.py +++ b/src/emc/usr_intf/axis/scripts/axis.py @@ -652,6 +652,7 @@ class LivePlotter: self.notifications_clear = False self.notifications_clear_info = False self.notifications_clear_error = False + self.set_mdi_mode = False def start(self): if self.running.get(): return @@ -761,6 +762,11 @@ class LivePlotter: self.set_manual_mode = set_manual_mode if self.set_manual_mode: root_window.tk.eval(pane_top + ".tabs raise manual") + set_mdi_mode = comp["set-mdi-mode"] + if self.set_mdi_mode != set_mdi_mode: + self.set_mdi_mode = set_mdi_mode + if self.set_mdi_mode: + root_window.tk.eval(pane_top + ".tabs raise mdi") notifications_clear = comp["notifications-clear"] if self.notifications_clear != notifications_clear: self.notifications_clear = notifications_clear @@ -2847,6 +2853,14 @@ else: root_window.tk.eval(u"${pane_top}.ajogspeed.l1 configure -text deg/min") homing_order_defined = inifile.find("AXIS_0", "HOME_SEQUENCE") is not None +def set_mode_hal_pin(val): + comp['mode.mdi'] = val + comp['mode.manual'] = not val + +if hal_present == 1 : + widgets.tabs.itemconfigure("mdi",raisecmd=lambda: set_mode_hal_pin(True)) + widgets.tabs.itemconfigure("manual",raisecmd=lambda: set_mode_hal_pin(False)) + if homing_order_defined: widgets.homebutton.configure(text=_("Home All"), command="home_all_axes") root_window.tk.call("DynamicHelp::add", widgets.homebutton, @@ -3091,7 +3105,10 @@ if hal_present == 1 : comp.newpin("jog.v", hal.HAL_BIT, hal.HAL_OUT) comp.newpin("jog.w", hal.HAL_BIT, hal.HAL_OUT) comp.newpin("jog.increment", hal.HAL_FLOAT, hal.HAL_OUT) + comp.newpin("set-mdi-mode",hal.HAL_BIT,hal.HAL_IN) comp.newpin("set-manual-mode",hal.HAL_BIT,hal.HAL_IN) + comp.newpin("mode.manual",hal.HAL_BIT,hal.HAL_OUT) + comp.newpin("mode.mdi",hal.HAL_BIT,hal.HAL_OUT) comp.newpin("notifications-clear",hal.HAL_BIT,hal.HAL_IN) comp.newpin("notifications-clear-info",hal.HAL_BIT,hal.HAL_IN) comp.newpin("notifications-clear-error",hal.HAL_BIT,hal.HAL_IN) -- 1.7.0.4 -- Regards, Russell -------------------------------------------------------------------- | Russell Brown | MAIL: [email protected] PHONE: 01780 471800 | | Lady Lodge Systems | WWW Work: http://www.lls.com | | Peterborough, England | WWW Play: http://www.ruffle.me.uk | -------------------------------------------------------------------- ------------------------------------------------------------------------------ Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk _______________________________________________ Emc-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-developers
