Skip to content
Open
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
42 changes: 42 additions & 0 deletions src/emc/usr_intf/gmoccapy/gmoccapy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5858,6 +5858,38 @@ def _blockdelete(self, pin):
LOG.debug("Received a signal from pin {0} with state = {1}".format(pin.name, pin.get()))
self.command.set_optional_stop(pin.get())

def _program_start(self, pin):
LOG.debug("Received a signal from pin {0} with state = {1}".format(pin.name, pin.get()))
if not self.widgets.ntb_button.get_current_page() == _BB_AUTO:
return
button = self.builder.get_object("btn_run")
if button.get_sensitive() and pin.get():
self.on_btn_run_clicked(None)

def _program_stop(self, pin):
LOG.debug("Received a signal from pin {0} with state = {1}".format(pin.name, pin.get()))
if not self.widgets.ntb_button.get_current_page() == _BB_AUTO:
return
button = self.builder.get_object("btn_stop")
if button.get_sensitive() and pin.get():
self.on_btn_stop_clicked(None)

def _program_pause(self, pin):
LOG.debug("Received a signal from pin {0} with state = {1}".format(pin.name, pin.get()))
if not self.widgets.ntb_button.get_current_page() == _BB_AUTO:
return
button = self.builder.get_object("tbtn_pause")
if button.get_sensitive() and pin.get() and not button.get_active():
self.command.auto(linuxcnc.AUTO_PAUSE)

def _program_resume(self, pin):
LOG.debug("Received a signal from pin {0} with state = {1}".format(pin.name, pin.get()))
if not self.widgets.ntb_button.get_current_page() == _BB_AUTO:
return
button = self.builder.get_object("btn_stop")
if button.get_sensitive() and pin.get():
self.command.auto(linuxcnc.AUTO_RESUME)

# =========================================================
# The actions of the buttons
def _button_pin_changed(self, pin):
Expand Down Expand Up @@ -6075,6 +6107,16 @@ def _make_hal_pins(self):
pin = self.halcomp.newpin("blockdelete", hal.HAL_BIT, hal.HAL_IN)
hal_glib.GPin(pin).connect("value_changed", self._blockdelete)

# make pins to be used instead of halui pins
pin = self.halcomp.newpin("program.start", hal.HAL_BIT, hal.HAL_IN)
hal_glib.GPin(pin).connect("value_changed", self._program_start)
pin = self.halcomp.newpin("program.stop", hal.HAL_BIT, hal.HAL_IN)
hal_glib.GPin(pin).connect("value_changed", self._program_stop)
pin = self.halcomp.newpin("program.pause", hal.HAL_BIT, hal.HAL_IN)
hal_glib.GPin(pin).connect("value_changed", self._program_pause)
pin = self.halcomp.newpin("program.resume", hal.HAL_BIT, hal.HAL_IN)
hal_glib.GPin(pin).connect("value_changed", self._program_resume)


# Hal Pin Handling End
# =========================================================
Expand Down
Loading