--- a/LPCManager.py Mon Feb 05 15:47:22 2018 +0100
+++ b/LPCManager.py Mon Feb 05 15:48:38 2018 +0100
@@ -822,36 +822,6 @@
PLCControler.GenerateNewName = newGenerateNewName
-from canfestival import RootClass as CanOpenRootClass
-from canfestival.canfestival import _SlaveCTN, _NodeListCTN, NodeManager
-from canfestival.NetworkEditor import NetworkEditor
-from canfestival.SlaveEditor import SlaveEditor
-# havecanfestival = False
-# ConfTreeNodeEditor.SHOW_BASE_PARAMS = False
-# -------------------------------------------------------------------------------
-# CANFESTIVAL CONFNODE HACK
-# -------------------------------------------------------------------------------
-from canfestival import canfestival
-defaultGetCFLAGS = canfestival.local_canfestival_config.getCFLAGS
-defaultGetLDFLAGS = canfestival.local_canfestival_config.getLDFLAGS
- return str(defaultGetCFLAGS(*args))
- return str(defaultGetLDFLAGS(*args))
-canfestival.local_canfestival_config.getCFLAGS = getCFLAGS
-canfestival.local_canfestival_config.getLDFLAGS = getLDFLAGS
import LPCBus as LPCBus_mod
@@ -861,128 +831,6 @@
LPCBus_mod.LPCarch = arch
-# -------------------------------------------------------------------------------
-# LPC CanFestival ConfNode Class
-# -------------------------------------------------------------------------------
- "CAN_Baudrate": "125K",
-class LPCSlaveEditor(SlaveEditor):
- # SHOW_BASE_PARAMS = False
-class LPCCanOpenSlave(_SlaveCTN):
- XSD = """<?xml version="1.0" encoding="ISO-8859-1" ?>
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <xsd:element name="CanFestivalSlaveNode">
- <xsd:attribute name="CAN_Baudrate" type="xsd:string" use="optional" default="%(CAN_Baudrate)s"/>
- <xsd:attribute name="NodeId" type="xsd:integer" use="optional" default="%(Slave_NodeId)d"/>
- <xsd:attribute name="Sync_Align" type="xsd:integer" use="optional" default="0"/>
- <xsd:attribute name="Sync_Align_Ratio" use="optional" default="50">
- <xsd:restriction base="xsd:integer">
- <xsd:minInclusive value="1"/>
- <xsd:maxInclusive value="99"/>
- EditorType = LPCSlaveEditor
- # TODO change netname when name change
- NodeManager.__init__(self)
- odfilepath = self.GetSlaveODPath()
- if (os.path.isfile(odfilepath)):
- self.OpenFileInCurrent(odfilepath)
- self.CreateNewNode("SlaveNode", # Name - will be changed at build time
- 0x00, # NodeID - will be changed at build time
- def GetCanDevice(self):
- return str(self.BaseParams.getIEC_Channel())
- {"bitmap": "NetworkEdit",
- "name": _("Edit slave"),
- "tooltip": _("Edit CanOpen slave with ObjdictEdit"),
- "method": "_OpenView"},
- ] + _SlaveCTN.ConfNodeMethods
-class LPCNetworkEditor(NetworkEditor):
- # SHOW_BASE_PARAMS = False
-class LPCCanOpenMaster(_NodeListCTN):
- XSD = """<?xml version="1.0" encoding="ISO-8859-1" ?>
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <xsd:element name="CanFestivalNode">
- <xsd:attribute name="CAN_Baudrate" type="xsd:string" use="optional" default="%(CAN_Baudrate)s"/>
- <xsd:attribute name="NodeId" type="xsd:integer" use="optional" default="%(Master_NodeId)d"/>
- <xsd:attribute name="Sync_TPDOs" type="xsd:boolean" use="optional" default="true"/>
- EditorType = LPCNetworkEditor
- def GetCanDevice(self):
- return str(self.BaseParams.getIEC_Channel())
- {"bitmap": "NetworkEdit",
- "name": _("Edit network"),
- "tooltip": _("Edit CanOpen Network with NetworkEdit"),
- "method": "_OpenView"},
- ] + _NodeListCTN.ConfNodeMethods
-class LPCCanOpen(CanOpenRootClass):
- CTNChildrenTypes = [("CanOpenNode", LPCCanOpenMaster, "CanOpen Master"),
- ("CanOpenSlave", LPCCanOpenSlave, "CanOpen Slave")]
- def GetCanDriver(self):
- def LoadChildren(self):
- ConfigTreeNode.LoadChildren(self)
- if self.GetChildByName("Master") is None:
- master = self.CTNAddChild("Master", "CanOpenNode", 0)
- # master.BaseParams.setEnabled(False)
- master.CTNRequestSave()
- if self.GetChildByName("Slave") is None:
- slave = self.CTNAddChild("Slave", "CanOpenSlave", 1)
- # slave.BaseParams.setEnabled(False)
if __name__ == '__main__':
--- a/LPCProjectController.py Mon Feb 05 15:47:22 2018 +0100
+++ b/LPCProjectController.py Mon Feb 05 15:48:38 2018 +0100
@@ -130,10 +130,7 @@
ProjectController.__init__(self, frame, logger)
- self.CTNChildrenTypes += [("LPCBus", LPCBus, "LPC bus"), ("CanOpen", LPCCanOpen, "CanOpen bus")]
- self.CTNChildrenTypes += [("LPCBus", LPCBus, "LPC bus")]
+ self.CTNChildrenTypes += [("LPCBus", LPCBus, "LPC bus"), ("CanOpen", LPCCanOpen, "CanOpen bus")] self.OnlineMode = "NORMAL" if arch in PLC_module else "OFF"
@@ -361,14 +358,11 @@
canopen_child = self.GetChildByName("CanOpen")
- if havecanfestival and canopen_child is None:
+ if canopen_child is None: canopen = self.CTNAddChild("CanOpen", "CanOpen", 0)
- elif not havecanfestival and canopen_child is not None:
- canopen_child.CTNRemove()
if self.CTNTestModified():