Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gmoccapy - Patch for Combination M61 + G4 #2489 - Version 2 #2841

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions src/emc/usr_intf/gmoccapy/gmoccapy.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def __init__(self, argv):
self.distance = 0 # This global will hold the jog distance
self.tool_change = False # this is needed to get back to manual mode after a tool change
self.load_tool = False # We use this avoid mode switching on reloading the tool on start up of the GUI
self.automat_g43 = False # We use this to run automatic g43 after MDI_commands
self.macrobuttons = [] # The list of all macros defined in the INI file
self.fo_counts = 0 # need to calculate difference in counts to change the feed override slider
self.so_counts = 0 # need to calculate difference in counts to change the spindle override slider
Expand Down Expand Up @@ -2404,6 +2405,24 @@ def _periodic(self):

self.widgets.lbl_time.set_label(strftime("%H:%M:%S") + "\n" + strftime("%d.%m.%Y"))

# Automatic command G43 is activated by update_toolinfo
# this part code cant be in function on_hal_status_interp_idle
# it did not work well
if self.automat_g43:
if self.stat.interp_state == linuxcnc.INTERP_IDLE:
self.automat_g43 = False
self.command.mode(linuxcnc.MODE_MDI)
self.command.wait_complete()
self.command.mdi("G43")
self.command.wait_complete()
LOG.debug("Command G43 was executed")
# Returning to manual mode after M6, M61, number M6 buttons
if self.tool_change:
self.tool_change = False
self.command.mode(linuxcnc.MODE_MANUAL)
LOG.debug("MANUAL mode is returned")
self.command.wait_complete()

# keep the timer running
return True

Expand Down Expand Up @@ -2605,7 +2624,7 @@ def on_hal_status_interp_idle(self, widget):
self.widgets.btn_run.set_sensitive(True)
self.widgets.btn_stop.set_sensitive(False)

if self.tool_change:
if self.tool_change and ("G49" in self.active_gcodes):
self.command.mode(linuxcnc.MODE_MANUAL)
self.command.wait_complete()
self.tool_change = False
Expand Down Expand Up @@ -2740,7 +2759,7 @@ def on_hal_status_mode_manual(self, widget):
self.last_key_event = None, 0

def on_hal_status_mode_mdi(self, widget):
LOG.debug("MDI Mode {0}".format(self.tool_change))
LOG.debug("MDI Mode, tool_change = {0}".format(self.tool_change))

# if the edit offsets button is active, we do not want to change
# pages, as the user may want to edit several axis values
Expand Down Expand Up @@ -3534,10 +3553,7 @@ def _update_toolinfo(self, tool):
return

if "G43" in self.active_gcodes and self.stat.task_mode != linuxcnc.MODE_AUTO:
self.command.mode(linuxcnc.MODE_MDI)
self.command.wait_complete()
self.command.mdi("G43")
self.command.wait_complete()
self.automat_g43 = True

def _set_enable_tooltips(self, value):
LOG.debug("_set_enable_tooltips = {0}".format(value))
Expand Down Expand Up @@ -4868,6 +4884,7 @@ def on_cmb_mouse_button_mode_changed(self, widget):
# This is called from the all_homed_signal
def reload_tool(self):
tool_to_load = self.prefs.getpref("tool_in_spindle", 0, int)
LOG.debug("Reload tool {0}".format(tool_to_load))
if tool_to_load == 0:
return
self.load_tool = True
Expand All @@ -4879,6 +4896,8 @@ def reload_tool(self):
command = "M61 Q {0} G43".format(tool_to_load)
self.command.mdi(command)
self.command.wait_complete()

self.load_tool = False

def on_btn_tool_clicked(self, widget, data=None):
if self.widgets.tbtn_fullsize_preview0.get_active():
Expand Down
Loading