--- a/etherlab/CommonEtherCATFunction.py Fri Sep 28 18:00:50 2018 +0300
+++ b/etherlab/CommonEtherCATFunction.py Fri Sep 28 18:04:28 2018 +0300
@@ -13,6 +13,7 @@
mailbox_protocols = ["AoE", "EoE", "CoE", "FoE", "SoE", "VoE"]
def ExtractHexDecValue(value):
convert numerical value in string format into decimal or hex format.
@@ -29,6 +30,7 @@
raise ValueError, "Invalid value for HexDecValue \"%s\"" % value
def ExtractName(names, default=None):
Extract "name" field from XML entries.
@@ -136,6 +138,7 @@
# --------------------------------------------------
# Common Method For EtherCAT Management
# --------------------------------------------------
--- a/etherlab/ConfigEditor.py Fri Sep 28 18:00:50 2018 +0300
+++ b/etherlab/ConfigEditor.py Fri Sep 28 18:04:28 2018 +0300
@@ -30,12 +30,14 @@
[ETHERCAT_VENDOR, ETHERCAT_GROUP, ETHERCAT_DEVICE] = range(3)
def AppendMenu(parent, help, id, kind, text):
if wx.VERSION >= (2, 6, 0):
parent.Append(help=help, id=id, kind=kind, text=text)
parent.Append(helpString=help, id=id, kind=kind, item=text)
def GetVariablesTableColnames(position=False):
@@ -48,6 +50,7 @@
def GetAccessValue(access, pdo_mapping):
value = "SDO: %s" % ACCESS_TYPES.get(access, "")
@@ -66,6 +69,7 @@
ETHERCAT_SUBINDEX_MODEL = re.compile("#x([0-9a-fA-F]{0,2})$")
LOCATION_MODEL = re.compile("(?:%[IQM](?:[XBWLD]?([0-9]+(?:\.[0-9]+)*)))$")
class NodeVariablesSizer(wx.FlexGridSizer):
def __init__(self, parent, controler, position_column=False):
@@ -252,6 +256,7 @@
class NodeEditor(ConfTreeNodeEditor):
@@ -333,6 +338,7 @@
_("Write to (nodeid, index, subindex)"),
class ProcessVariablesTable(CustomTable):
def GetValue(self, row, col):
@@ -386,6 +392,7 @@
self.ResizeRow(grid, row)
class ProcessVariableDropTarget(wx.TextDropTarget):
def __init__(self, parent):
@@ -445,10 +452,12 @@
def GetStartupCommandsTableColnames():
return [_("Position"), _("Index"), _("Subindex"), _("Value"), _("Description")]
class StartupCommandDropTarget(wx.TextDropTarget):
def __init__(self, parent):
@@ -495,6 +504,7 @@
class StartupCommandsTable(CustomTable):
@@ -567,6 +577,7 @@
class MasterNodesVariablesSizer(NodeVariablesSizer):
def __init__(self, parent, controler):
@@ -586,6 +597,7 @@
NODE_POSITION_FILTER_FORMAT = _("Node Position: %d")
class MasterEditor(ConfTreeNodeEditor):
@@ -1081,6 +1093,7 @@
# self.FrameLoss2.SetValue(self.MasterState["frameloss2"])
# self.FrameLoss3.SetValue(self.MasterState["frameloss3"])
class LibraryEditorSizer(wx.FlexGridSizer):
def __init__(self, parent, module_library, buttons):
@@ -1316,6 +1329,7 @@
param_infos["description"])
class DatabaseManagementDialog(wx.Dialog):
def __init__(self, parent, database):
@@ -1347,6 +1361,7 @@
return self.DatabaseSizer.GetSelectedFilePath()
class LibraryEditor(ConfTreeNodeEditor):
--- a/etherlab/EtherCATManagementEditor.py Fri Sep 28 18:00:50 2018 +0300
+++ b/etherlab/EtherCATManagementEditor.py Fri Sep 28 18:04:28 2018 +0300
@@ -27,6 +27,7 @@
from xml.dom import minidom
# -------------------------------------------------------------
# ----------------------------- For Sync Manager Table -----------------------------------
def GetSyncManagersTableColnames():
@@ -35,6 +36,7 @@
return ["#", _("Name"), _("Start Address"), _("Default Size"), _("Control Byte"), _("Enable")]
# -------------------------------------------------------------------------------
# -------------------------------------------------------------------------------
@@ -45,6 +47,7 @@
return self.data[row].get(self.GetColLabelValue(col, False), "")
# -------------------------------------------------------------------------------
# EtherCAT Management Treebook
# -------------------------------------------------------------------------------
@@ -91,6 +94,7 @@
sel = event.GetSelection()
# -------------------------------------------------------------------------------
# -------------------------------------------------------------------------------
@@ -306,6 +310,7 @@
# -------------------------------------------------------------------------------
# For SDO Management Panel
# -------------------------------------------------------------------------------
@@ -518,6 +523,7 @@
sel = self.GetSelection()
# -------------------------------------------------------------------------------
# For SDO Grid (fill index, subindex, etc...)
# -------------------------------------------------------------------------------
--- a/etherlab/EthercatCFileGenerator.py Fri Sep 28 18:00:50 2018 +0300
+++ b/etherlab/EthercatCFileGenerator.py Fri Sep 28 18:04:28 2018 +0300
@@ -68,6 +68,7 @@
def ConfigureVariable(entry_infos, str_completion):
entry_infos["data_type"] = DATATYPECONVERSION.get(entry_infos["var_type"], None)
if entry_infos["data_type"] is None:
@@ -124,6 +125,7 @@
(" EC_WRITE_%(data_type)s(domain1_pd + slave%(slave)d_%(index).4x_%(subindex).2x, " +
"%(real_var)s);") % entry_infos)
def ExclusionSortFunction(x, y):
if x["matching"] == y["matching"]:
if x["assigned"] and not y["assigned"]:
@@ -133,6 +135,7 @@
return cmp(x["count"], y["count"])
return -cmp(x["matching"], y["matching"])
class _EthercatCFileGenerator:
def __init__(self, controler):
--- a/etherlab/EthercatCIA402Slave.py Fri Sep 28 18:00:50 2018 +0300
+++ b/etherlab/EthercatCIA402Slave.py Fri Sep 28 18:04:28 2018 +0300
@@ -93,6 +93,7 @@
# --------------------------------------------------
class _EthercatCIA402SlaveCTN(_EthercatSlaveCTN):
XSD = """<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
--- a/etherlab/EthercatMaster.py Fri Sep 28 18:00:50 2018 +0300
+++ b/etherlab/EthercatMaster.py Fri Sep 28 18:04:28 2018 +0300
@@ -68,9 +68,11 @@
# Etherlab Specific Blocks Library
# --------------------------------------------------
def GetLocalPath(filename):
return os.path.join(os.path.split(__file__)[0], filename)
class EtherlabLibrary(POULibrary):
def GetLibraryPath(self):
return GetLocalPath("pous.xml")
@@ -95,6 +97,7 @@
EtherCATConfigParser = GenerateParserFromXSD(os.path.join(os.path.dirname(__file__), "EtherCATConfig.xsd"))
if x["Index"] == y["Index"]:
return cmp(x["Subindex"], y["Subindex"])
@@ -220,6 +223,7 @@
ProcessVariablesParser = GenerateParserFromXSDstring(ProcessVariablesXSD)
CTNChildrenTypes = [("EthercatSlave", _EthercatSlaveCTN, "Ethercat Slave")]
--- a/etherlab/EthercatSlave.py Fri Sep 28 18:00:50 2018 +0300
+++ b/etherlab/EthercatSlave.py Fri Sep 28 18:04:28 2018 +0300
@@ -31,6 +31,7 @@
VARCLASSCONVERSION = {"T": LOCATION_VAR_INPUT, "R": LOCATION_VAR_OUTPUT, "RT": LOCATION_VAR_MEMORY}
def ExtractHexDecValue(value):
@@ -41,6 +42,7 @@
raise ValueError, "Invalid value for HexDecValue \"%s\"" % value
def GenerateHexDecValue(value, base=10):
@@ -49,6 +51,7 @@
raise ValueError, "Not supported base"
def ExtractName(names, default=None):
return names[0].getcontent()
--- a/etherlab/etherlab.py Fri Sep 28 18:00:50 2018 +0300
+++ b/etherlab/etherlab.py Fri Sep 28 18:04:28 2018 +0300
@@ -34,9 +34,11 @@
EtherCATInfoParser = GenerateParserFromXSD(os.path.join(os.path.dirname(__file__), "EtherCATInfo.xsd"))
EtherCATInfo_XPath = lambda xpath: etree.XPath(xpath)
def HexDecValue(context, *args):
return str(ExtractHexDecValue(args[0][0]))
def EntryName(context, *args):
return ExtractName(args[0],
args[1][0] if len(args) > 1 else None)
@@ -53,6 +55,7 @@
def __init__(self, entries):
@@ -128,6 +131,7 @@
setattr(cls, "GetSyncManagers", GetSyncManagers)
def GroupItemCompare(x, y):
if x["type"] == y["type"]:
if x["type"] == ETHERCAT_GROUP:
@@ -138,12 +142,14 @@
def SortGroupItems(group):
for item in group["children"]:
if item["type"] == ETHERCAT_GROUP:
group["children"].sort(GroupItemCompare)
@@ -384,6 +390,7 @@
ModulesDatabase = ModulesLibrary(
os.path.join(USERDATA_DIR, "ethercat_modules"))
CTNChildrenTypes = [("EthercatNode",_EthercatCTN,"Ethercat Master")]
--- a/etherlab/runtime_etherlab.py Fri Sep 28 18:00:50 2018 +0300
+++ b/etherlab/runtime_etherlab.py Fri Sep 28 18:04:28 2018 +0300
@@ -16,6 +16,7 @@
def SDOThreadProc(*params):
if params[0] == "upload":
@@ -48,22 +49,27 @@
LogLevelsDict["WARNING"],
"%s : %s" % (command,output))
def EthercatSDOUpload(pos, index, subindex, var_type):
SDOThread = Thread(target=SDOThreadProc, args=["upload", pos, var_type, index, subindex])
def EthercatSDODownload(pos, index, subindex, var_type, value):
SDOThread = Thread(target=SDOThreadProc, args=["download", pos, var_type, index, subindex, value])
def KMSGPollThreadProc():
Logs Kernel messages starting with EtherCAT
@@ -95,12 +101,14 @@
def _runtime_etherlab_init():
global KMSGPollThread, StopKMSGThread
KMSGPollThread = Thread(target = KMSGPollThreadProc)
def _runtime_etherlab_cleanup():
global KMSGPollThread, StopKMSGThread, SDOProc, SDOThread