Skip to content

Commit

Permalink
Merge pull request #3163 from phillc54/pncconf
Browse files Browse the repository at this point in the history
pncconf: add qtplasmac external hal pins
  • Loading branch information
c-morley authored Oct 24, 2024
2 parents 125a11d + 6e90e52 commit 33d8807
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 15 deletions.
56 changes: 50 additions & 6 deletions src/emc/usr_intf/pncconf/build_HAL.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ def writebackup(origname):
self.qtplasmac_connections(file, base)
prefsfile = os.path.join(base, self.d.machinename + ".prefs")
self.qtplasmac_prefs(prefsfile)
self.qtplasmacpostgui = []

print(file=file)
self.connect_output(file)
Expand Down Expand Up @@ -970,6 +971,14 @@ def writebackup(origname):
if os.path.exists(pyfilename):
os.remove(pyfilename)

# add a postgui halfile for qtplasmac
if self.d.frontend == _PD._QTPLASMAC:
postgui = os.path.join(base, "qtplasmac_postgui.hal")
f1 = open(postgui, "w")
for line in self.qtplasmacpostgui:
print(line, file=f1)
f1.close

# pncconf adds a custom.hal and custom_postgui.hal file if one is not present
if self.d.frontend != _PD._QTPLASMAC:
customfiles = "custom","custom_postgui","shutdown","custom_gvcp"
Expand Down Expand Up @@ -1578,19 +1587,29 @@ def get(s): return self.d[let + s]

def connect_input(self, file):
print(_("# external input signals"), file=file)
# comments for qtplasmac external pins are saved for a postgui hal file
if self.d.frontend == _PD._QTPLASMAC:
self.qtplasmacpostgui.append("\n# external input signals")

def write_pins(pname,p,i,t):
# for input pins
if t in (_PD.GPIOI, _PD.INM0):
if not p == "unused-input":
pinname = self.a.make_pinname(pname, substitution = self.d.useinisubstitution)
print("\n# ---",p.upper(),"---", file=file)
# write comments if not a qtplasmac external pin
if not (self.d.frontend == _PD._QTPLASMAC and "ext_" in p):
print("\n# ---",p.upper(),"---", file=file)
if "parport" in pinname:
if i: print("net %s <= %s-not" % (p, pinname), file=file)
else: print("net %s <= %s" % (p, pinname), file=file)
elif "sserial" in pname or t == _PD.INM0:
if i: print("net %s <= "% (p)+pinname +"-not", file=file)
else: print("net %s <= "% (p)+pinname, file=file)
# qtplasmac external pins are saved for a postgui hal file
elif self.d.frontend == _PD._QTPLASMAC and "ext_" in p:
invert = "_not" if i else " "
self.qtplasmacpostgui.append(f"net {p} {pinname}.in{invert} => {p.replace('plasmac:', 'qtplasmac.')}")
# all others are written to the hal file
else:
if i: print("net %s <= "% (p)+pinname +".in_not", file=file)
else: print("net %s <= "% (p)+pinname +".in", file=file)
Expand Down Expand Up @@ -1673,13 +1692,18 @@ def write_pins(pname,p,i,t):

def connect_output(self, file):
print(_("# external output signals"), file=file)
# comments for qtplasmac external pins are saved for a postgui hal file
if self.d.frontend == _PD._QTPLASMAC:
self.qtplasmacpostgui.append("\n# external output signals")

def write_pins(pname,p,i,t,boardnum,connector,port,channel,pin):
# for output /open drain pins
if t in (_PD.GPIOO,_PD.GPIOD,_PD.SSR0,_PD.OUTM0):
if not p == "unused-output":
pinname = self.a.make_pinname(pname, substitution = self.d.useinisubstitution)
print("\n# ---",p.upper(),"---", file=file)
# write comments if not a qtplasmac external pin
if not (self.d.frontend == _PD._QTPLASMAC and "plasmac:ext_" in p):
print("\n# ---",p.upper(),"---", file=file)
if "parport" in pinname:
if p == "force-pin-true":
print("setp %s true"% (pinname), file=file)
Expand All @@ -1698,21 +1722,41 @@ def write_pins(pname,p,i,t,boardnum,connector,port,channel,pin):
temp = pinname + ".out"
# set pin true if force-pin-true otherwise connect to a signal
if p == "force-pin-true":
print("setp %s true"% (temp), file=file)
# qtplasmac external pins are saved for a postgui hal file
if self.d.frontend == _PD._QTPLASMAC and "plasmac:ext_" in p:
self.qtplasmacpostgui.append(f"setp {temp} true")
# all others are written to the hal file
else:
print("setp %s true"% (temp), file=file)
else:
comment = ""
if self.d.frontend == _PD._QTPLASMAC and p in ['dout-01','dout-02','dout-03']:
comment = "#qtplasmac uses digital output %s:\n#" % p
print("%snet %s => %s"% (comment,p,temp), file=file)
# qtplasmac external pins are saved for a postgui hal file
if self.d.frontend == _PD._QTPLASMAC and "plasmac:ext_" in p:
self.qtplasmacpostgui.append(f"net {p} {p} => {temp}")# => {p.replace('plasmac:', 'qtplasmac.')}")
# all others are written to the hal file
else:
print("%snet %s => %s"% (comment,p,temp), file=file)
if i: # invert pin
if t in (_PD.SSR0,_PD.OUTM0):
print("setp %s true"% (pinname.replace('.out-', '.invert-')), file=file)
# qtplasmac external pins are saved for a postgui hal file
if self.d.frontend == _PD._QTPLASMAC and "plasmac:ext_" in p:
self.qtplasmacpostgui.append(f"setp {pinname.replace('.out-', '.invert-')} true")
# all others are written to the hal file
else:
print("setp %s true"% (pinname.replace('.out-', '.invert-')), file=file)
else:
if "sserial" in pname:
ending = "-invert"
elif "parport" in pinname: ending = "-invert"
else: ending = ".invert_output"
print("setp %s true"% (pinname + ending ), file=file)
# qtplasmac external pins are saved for a postgui hal file
if self.d.frontend == _PD._QTPLASMAC and "plasmac:ext_" in p:
self.qtplasmacpostgui.append(f"setp {pinname + ending}")
# all others are written to the hal file
else:
print("setp %s true"% (pinname + ending ), file=file)

# for pwm pins
elif t in (_PD.PWMP,_PD.PDMP,_PD.UDMU):
Expand Down
3 changes: 3 additions & 0 deletions src/emc/usr_intf/pncconf/build_INI.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ def write_inifile(self, base):
print("POSTGUI_HALFILE = qtvcp_postgui.hal", file=file)
elif self.d.frontend == _PD._GMOCCAPY:
print("POSTGUI_HALFILE = gmoccapy_postgui.hal", file=file)
# qtplasmac always has a postgui hal fil
if self.d.frontend == _PD._QTPLASMAC:
print("POSTGUI_HALFILE = qtplasmac_postgui.hal", file=file)
print("POSTGUI_HALFILE = custom_postgui.hal", file=file)
print("SHUTDOWN = shutdown.hal", file=file)
print(file=file)
Expand Down
2 changes: 1 addition & 1 deletion src/emc/usr_intf/pncconf/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def __init__(self, app, private_data_instance,base_dir, linuxcnc_version):
self.qtplasmacbase = _BASE
self.increments_metric_qtplasmac = "10mm 1mm .1mm .01mm .001mm"
self.increments_imperial_qtplasmac= "1in .1in .01in .001in .0001in"
self.qtplasmac_bnames = ["OHMIC\TEST","PROBE\TEST","SINGLE\CUT","NORMAL\CUT","TORCH\PULSE","FRAMING", "USER\MANUAL", \
self.qtplasmac_bnames = [r"OHMIC\TEST",r"PROBE\TEST",r"SINGLE\CUT",r"NORMAL\CUT",r"TORCH\PULSE",r"FRAMING", r"USER\MANUAL", \
"","","","","","","","","","","","",""]
self.qtplasmac_bcodes = ["ohmic-test","probe-test 10","single-cut","cut-type","torch-pulse 0.5","framing", "user-manual", \
"","","","","","","","","","","","",""]
Expand Down
58 changes: 51 additions & 7 deletions src/emc/usr_intf/pncconf/private_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ def __init__(self,app,bin_dir,base_dir):
S.Z_HALL1_OUT,S.Z_HALL2_OUT,S.Z_HALL3_OUT,S.Z_C1_OUT,S.Z_C2_OUT,S.Z_C4_OUT,S.Z_C8_OUT,
S.A_HALL1_OUT,S.A_HALL2_OUT,S.A_HALL3_OUT,S.A_C1_OUT,S.A_C2_OUT,S.A_C4_OUT,S.A_C8_OUT,
S.S_HALL1_OUT,S.S_HALL2_OUT,S.S_HALL3_OUT,S.S_C1_OUT,S.S_C2_OUT,S.S_C4_OUT,S.S_C8_OUT,
S.OHMIC_ENABLE,S.SCRIBE_ARM,S.SCRIBE_ON,S.TORCH_ON,S.LASER_ON
S.OHMIC_ENABLE,S.SCRIBE_ARM,S.SCRIBE_ON,S.TORCH_ON,S.LASER_ON,
S.EXT_OUT_0, S.EXT_OUT_1, S.EXT_OUT_2
) = self.hal_output_names = [
"unused-output",
"spindle-enable", "spindle-cw", "spindle-ccw", "spindle-brake",
Expand All @@ -194,7 +195,8 @@ def __init__(self,app,bin_dir,base_dir):
"z-hall1-out","z-hall2-out","z-hall3-out","z-gray-c1-out","z-gray-c2-out","z-gray-C4-out","z-gray-C8-out",
"a-hall1-out","a-hall2-out","a-hall3-out","a-gray-c1-out","a-gray-c2-out","a-gray-C4-out","a-gray-C8-out",
"s-hall1-out","s-hall2-out","s-hall3-out","s-gray-c1-out","s-gray-c2-out","s-gray-C4-out","s-gray-C8-out",
"plasmac:ohmic-enable", "plasmac:scribe-arm", "plasmac:scribe-on", "plasmac:torch-on", "plasmac:laser-on"]
"plasmac:ohmic-enable", "plasmac:scribe-arm", "plasmac:scribe-on", "plasmac:torch-on", "plasmac:laser-on",
"plasmac:ext_out_0", "plasmac:ext_out_1", "plasmac:ext_out_2"]

###
( S.UNUSED_INPUT,
Expand Down Expand Up @@ -226,7 +228,19 @@ def __init__(self,app,bin_dir,base_dir):
S.MIN_HOME_X2,S.MIN_HOME_Y2,S.MIN_HOME_Z2,S.MIN_HOME_A2,
S.MAX_HOME_X2,S.MAX_HOME_Y2,S.MAX_HOME_Z2,S.MAX_HOME_A2,
S.BOTH_HOME_X2,S.BOTH_HOME_Y2,S.BOTH_HOME_Z2,S.BOTH_HOME_A2,
S.ARC_OK,S.OHMIC_SENSE,S.FLOAT_SWITCH,S.BREAKAWAY,S.MOVE_UP,S.MOVE_DOWN
S.ARC_OK,S.OHMIC_SENSE,S.FLOAT_SWITCH,S.BREAKAWAY,S.MOVE_UP,S.MOVE_DOWN,
S.EXT_POWER, S.EXT_RUN, S.EXT_PAUSE, S.EXT_PAUSE_ONLY, S.EXT_RESUME,
S.EXT_RUN_PAUSE, S.EXT_ABORT, S.EXT_TOUCHOFF, S.EXT_LASER_TOUCHOFF,
S.EXT_LASER_TOGGLE, S.EXT_HEIGHT_OVR_PLUS, S.EXT_HEIGHT_OVR_MINUS,
S.EXT_HEIGHT_OVR_RESET, S.EXT_HEIGHT_OVR_SCALE, S.EXT_JOG_SLOW,
S.EXT_THC_ENABLE, S.EXT_TORCH_ENABLE, S.EXT_CORNERLOCK_ENABLE,
S.EXT_VOIDLOCK_ENABLE, S.EXT_AUTO_VOLTS_ENABLE, S.EXT_OHMIC_PROBE_ENABLE,
S.EXT_MESH_MODE, S.EXT_IGNORE_ARC_OK, S.EXT_CUTREC_FWD,
S.EXT_CUTREC_REV, S.EXT_CUTREC_CANCEL, S.EXT_CUTREC_N, S.EXT_CUTREC_S,
S.EXT_CUTREC_E, S.EXT_CUTREC_W, S.EXT_CUTREC_NE, S.EXT_CUTREC_NW,
S.EXT_CUTREC_SE, S.EXT_CUTREC_SW, S.EXT_HEIGHT_OVR_COUNT_ENABLE,
S.EXT_HEIGHT_OVR_COUNTS, S.EXT_PROBE, S.EXT_PULSE, S.EXT_OHMIC,
S.EXT_CONSUMABLES, S.EXT_FRAME_JOB,
) = self.hal_input_names = [
"unused-input",
"min-x", "min-y", "min-z", "min-a",
Expand Down Expand Up @@ -258,8 +272,20 @@ def __init__(self,app,bin_dir,base_dir):
"min-home-x2", "min-home-y2", "min-home-z2", "min-home-a2",
"max-home-x2", "max-home-y2", "max-home-z2", "max-home-a2",
"both-home-x2", "both-home-y2", "both-home-z2", "both-home-a2",
"plasmac:arc-ok-in", "plasmac:ohmic-sense-in", "plasmac:float-switch",
"plasmac:breakaway", "plasmac:move-up", "plasmac:move-down"]
"plasmac:arc-ok-in", "plasmac:ohmic-sense-in", "plasmac:float-switch", "plasmac:breakaway",
"plasmac:move-up", "plasmac:move-down",
"plasmac:ext_power", "plasmac:ext_run", "plasmac:ext_pause", "plasmac:ext_pause_only",
"plasmac:ext_resume", "plasmac:ext_run_pause", "plasmac:ext_abort", "plasmac:ext_touchoff",
"plasmac:ext_laser_touchoff", "plasmac:ext_laser_toggle", "plasmac:ext_height_ovr_plus",
"plasmac:ext_height_ovr_minus", "plasmac:ext_height_ovr_reset", "plasmac:ext_height_ovr_scale",
"plasmac:ext_jog_slow", "plasmac:ext_thc_enable", "plasmac:ext_torch_enable",
"plasmac:ext_cornerlock_enable", "plasmac:ext_voidlock_enable", "plasmac:ext_auto_volts_enable",
"plasmac:ext_ohmic_probe_enable", "plasmac:ext_mesh_mode", "plasmac:ext_ignore_arc_ok",
"plasmac:ext_cutrec_fwd", "plasmac:ext_cutrec_rev", "plasmac:ext_cutrec_cancel",
"plasmac:ext_cutrec_n", "plasmac:ext_cutrec_s", "plasmac:ext_cutrec_e", "plasmac:ext_cutrec_w",
"plasmac:ext_cutrec_ne", "plasmac:ext_cutrec_nw", "plasmac:ext_cutrec_se", "plasmac:ext_cutrec_sw",
"plasmac:ext_height_ovr_count_enable", "plasmac:ext_height_ovr_counts", "plasmac:ext_probe",
"plasmac:ext_pulse", "plasmac:ext_ohmic", "plasmac:ext_consumables", "plasmac:ext_frame_job"]

( S.UNUSED_PWM,
S.X_PWM_PULSE,S.X_PWM_DIR,S.X_PWM_ENABLE, S.Y_PWM_PULSE,S.Y_PWM_DIR,S.Y_PWM_ENABLE,
Expand Down Expand Up @@ -462,8 +488,25 @@ def __init__(self,app,bin_dir,base_dir):
blimits = [[_("Main Axis"),limit],[_("Tandem Axis"),limit2]]
bhome = [[_("Main Axis"),home],[_("Tandem Axis"),home2]]
bshared = [[_("Main Axis"),home_limits_shared],[_("Tandem Axis"),home_limits_shared2]]
plasma_in_ext_gui = [ [_("Power"),S.EXT_POWER], [_("Cycle Start"),S.EXT_RUN], [_("Pause/Resume"),S.EXT_PAUSE], [_("Pause Only"),S.EXT_PAUSE_ONLY],
[_("Resume Only"),S.EXT_PAUSE], [_("Run/Pause/Resume"),S.EXT_RUN_PAUSE], [_("Cycle Stop"),S.EXT_ABORT], [_("Touchoff"),S.EXT_TOUCHOFF],
[_("Laser Touchoff"),S.EXT_LASER_TOUCHOFF], [_("Laser Toggle"),S.EXT_LASER_TOGGLE], [_("Jog Slow"),S.EXT_JOG_SLOW],
[_("THC Enable"),S.EXT_THC_ENABLE], [_("Torch Enable"),S.EXT_TORCH_ENABLE], [_("VAD Enable"),S.EXT_CORNERLOCK_ENABLE],
[_("Voidlock Enable"),S.EXT_VOIDLOCK_ENABLE], [_("Auto Volts Enable"),S.EXT_AUTO_VOLTS_ENABLE], [_("Ohmic Probe Enable"),S.EXT_OHMIC_PROBE_ENABLE],
[_("Mesh Mode"),S.EXT_MESH_MODE], [_("Ignore Arc OK"),S.EXT_IGNORE_ARC_OK] ]
plasma_in_ext_button = [ [_("Probe Test"),S.EXT_PROBE], [_("Pulse Torch"),S.EXT_PULSE], [_("Ohmic Test"),S.EXT_OHMIC],
[_("Change Consumables"),S.EXT_CONSUMABLES], [_("Frame Job"),S.EXT_FRAME_JOB] ]
plasma_in_ext_height = [ [_("Plus"),S.EXT_HEIGHT_OVR_PLUS], [_("Minus"),S.EXT_HEIGHT_OVR_MINUS], [_("Reset"),S.EXT_HEIGHT_OVR_RESET],
[_("Scale"),S.EXT_HEIGHT_OVR_SCALE], [_("MPG Enable"),S.EXT_HEIGHT_OVR_COUNT_ENABLE], [_("MPG Counts"),S.EXT_HEIGHT_OVR_COUNTS] ]
plasma_in_ext_recovery = [ [_("Forward"),S.EXT_CUTREC_FWD], [_("Reverse"),S.EXT_CUTREC_REV], [_("Cancel"),S.EXT_CUTREC_CANCEL],
[_("North"),S.EXT_CUTREC_N], [_("South"),S.EXT_CUTREC_S], [_("East"),S.EXT_CUTREC_E], [_("West"),S.EXT_CUTREC_W],
[_("NorthEast"),S.EXT_CUTREC_NE], [_("NorthWest"),S.EXT_CUTREC_NW],[_("SouthEast"),S.EXT_CUTREC_SE], [_("SouthWest"),S.EXT_CUTREC_SW] ]
plasma_in = [[_("Arc OK"),S.ARC_OK ], [_("Ohmic Contact"),S.OHMIC_SENSE ], [_("Float Switch"),S.FLOAT_SWITCH ],
[_("Breakaway"),S.BREAKAWAY ], [_("Move Up"),S.MOVE_UP ], [_("Move Down"),S.MOVE_DOWN ] ]
[_("Breakaway"),S.BREAKAWAY ], [_("Move Up"),S.MOVE_UP ], [_("Move Down"),S.MOVE_DOWN ],
[_("External GUI Functions"), plasma_in_ext_gui],
[_("External User Buttons"), plasma_in_ext_button],
[_("External Height Override"), plasma_in_ext_height],
[_("External Cut Recovery"), plasma_in_ext_recovery]]

self.human_input_names = [ [_("Unused Input"),S.UNUSED_INPUT],[_("Limits"),blimits],
[_("home"),bhome],[_("Limits/Home Shared"),bshared],
Expand Down Expand Up @@ -527,7 +570,8 @@ def __init__(self,app,bin_dir,base_dir):
_("A Gray C1"),_("A Gray C2"),_("A Gray C4"),_("A Gray C8")]
smotor_control = [_("S HALL 1"),_("S HALL 2"),_("S HALL 3"),
_("S Gray C1"),_("S Gray C2"),_("S Gray C4"),_("S Gray C8")]
plasma_out = [_("Ohmic Enable"), _("Scribe Arm"), _("Scribe On"), _("Torch On"), _("Laser On")]
plasma_out = [_("Ohmic Enable"), _("Scribe Arm"), _("Scribe On"), _("Torch On"), _("Laser On"),
_("External Output 0"), _("External Output 1"), _("External Output 2")]

self.human_output_names = [ [_("Unused Output"),[]],[_("Spindle"),spindle_output],
[_("Coolant"),coolant_output],[_("Control"),control_output],
Expand Down
2 changes: 1 addition & 1 deletion src/emc/usr_intf/stepconf/stepconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def __init__(self,SIG):
self.qtplasmacstop = 0
self.qtplasmacpmx = ""
self.qtplasmacbase = BASE
self.qtplasmac_bnames = ["OHMIC\TEST","PROBE\TEST","SINGLE\CUT","NORMAL\CUT","TORCH\PULSE","FRAMING", "USER\MANUAL", \
self.qtplasmac_bnames = [r"OHMIC\TEST",r"PROBE\TEST",r"SINGLE\CUT",r"NORMAL\CUT",r"TORCH\PULSE",r"FRAMING", r"USER\MANUAL", \
"","","","","","","","","","","","",""]
self.qtplasmac_bcodes = ["ohmic-test","probe-test 10","single-cut","cut-type","torch-pulse 0.5","framing", "user-manual", \
"","","","","","","","","","","","",""]
Expand Down

0 comments on commit 33d8807

Please sign in to comment.