Can we display custom M-Code in the "active M-Code display"?

More
20 Apr 2020 07:04 #164790 by Aciera
I use remapped M-Codes (M428, M429) to switch between two kinematics using the 2.9 switchkins version. Now I am wondering if it is possible to display in the active G-codes/ M-codes section of the GUI whether M428 or M429 is active.

Does anybody know it I can have my remapped M-codes displayed in the GUI?

Please Log in or Create an account to join the conversation.

More
20 Apr 2020 07:08 - 20 Apr 2020 07:22 #164792 by bbsr_5a
shure you can do this
what GUI are you using
for axis you can do this
W = root_window.tk.call
W('label','.pane.top.tabs.fmanual.jogf.zerohome.kins','-text','kinsoff')
W('grid','.pane.top.tabs.fmanual.jogf.zerohome.kins','-column','0','-row','2','-sticky','w')

def user_live_update():
    mymcodes = all_systems[o.last_mcodes].split()
    for mcode in mymcodes:
	if '428' in mcode:
    		W('.pane.top.tabs.fmanual.jogf.zerohome.kins','configure','-text','Kins:RTCP )
	else:
    		W('.pane.top.tabs.fmanual.jogf.zerohome.kins','configure','-text','Kins:TRIV )
Last edit: 20 Apr 2020 07:22 by bbsr_5a. Reason: code
The following user(s) said Thank You: nkp

Please Log in or Create an account to join the conversation.

More
20 Apr 2020 09:47 #164810 by Aciera
Thanks for the prompt reply!
I'm using gmoccapy. So where would I put this code? Does it need to be in the remap?

Please Log in or Create an account to join the conversation.

More
20 Apr 2020 17:41 #164876 by cmorley
I don't think that code will work.
In fact Gmoccy.py (probably AXIS too) is coded to display any G/M code that are in linuxcnc's status structure.
User M codes seem not to be added to the status structure automatically. And of course linuxcnc would not have any idea of a relationship of two M codes (ie mutually exclusive).
I'm not sure how to fix that in a neat way.

If your Mcodes set a HAL pin then you could use that to set your Mcode in gmoccapy.

The function to display m codes is in gmoccapy.py:
    def _update_active_mcodes(self):
        # M codes
        active_codes = []
        temp = []
        for code in sorted(self.stat.mcodes[1:]):
            if code == -1:
                continue
            temp.append("{0}".format(code))
        for code in (temp):
            active_codes.append("M" + code)
        self.active_mcodes = active_codes
        self.mcodes = self.stat.mcodes
        self.widgets.active_mcodes_label.set_label(" ".join(self.active_mcodes))
The following user(s) said Thank You: Aciera

Please Log in or Create an account to join the conversation.

Time to create page: 0.113 seconds
Powered by Kunena Forum