--- a/LPCBeremiz.py Thu Feb 16 15:13:05 2012 +0100
+++ b/LPCBeremiz.py Thu Feb 16 22:52:28 2012 +0100
@@ -60,13 +60,20 @@
from plugger import PluginsRoot, PlugTemplate, opjimg, connectors
-from plugins.canfestival import RootClass as CanOpenRootClass
-from plugins.canfestival.canfestival import _SlavePlug, _NodeListPlug, NodeManager
from plcopen.structures import LOCATIONDATATYPES
from PLCControler import LOCATION_PLUGIN, LOCATION_MODULE, LOCATION_GROUP,\
LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY
from PLCOpenEditor import IDEFrame, ProjectDialog
+ from plugins.canfestival import RootClass as CanOpenRootClass + from plugins.canfestival.canfestival import _SlavePlug, _NodeListPlug, NodeManager + havecanfestival = False #-------------------------------------------------------------------------------
# CANFESTIVAL PLUGIN HACK
#-------------------------------------------------------------------------------
@@ -363,87 +370,89 @@
# LPC CanFestival Plugin Class
#-------------------------------------------------------------------------------
- "CAN_Baudrate": "125K",
-class LPCCanOpenSlave(_SlavePlug):
- 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:string" 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"/>
+ "CAN_Baudrate": "125K",
- # 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())
+ class LPCCanOpenSlave(_SlavePlug): + 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:string" 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"/> + # 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()) + class LPCCanOpenMaster(_NodeListPlug): + 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:string" use="optional" default="%(Master_NodeId)d"/> + <xsd:attribute name="Sync_TPDOs" type="xsd:boolean" use="optional" default="true"/> -class LPCCanOpenMaster(_NodeListPlug):
- 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:string" use="optional" default="%(Master_NodeId)d"/>
- <xsd:attribute name="Sync_TPDOs" type="xsd:boolean" use="optional" default="true"/>
- def GetCanDevice(self):
- return str(self.BaseParams.getIEC_Channel())
-class LPCCanOpen(CanOpenRootClass):
- PlugChildsTypes = [("CanOpenNode",LPCCanOpenMaster, "CanOpen Master"),
- ("CanOpenSlave",LPCCanOpenSlave, "CanOpen Slave")]
+ def GetCanDevice(self): + return str(self.BaseParams.getIEC_Channel()) - def GetCanDriver(self):
- PlugTemplate.LoadChilds(self)
+ class LPCCanOpen(CanOpenRootClass): + PlugChildsTypes = [("CanOpenNode",LPCCanOpenMaster, "CanOpen Master"), + ("CanOpenSlave",LPCCanOpenSlave, "CanOpen Slave")] + def GetCanDriver(self): - if self.GetChildByName("Master") is None:
- master = self.PlugAddChild("Master", "CanOpenNode", 0)
- master.BaseParams.setEnabled(False)
- if self.GetChildByName("Slave") is None:
- slave = self.PlugAddChild("Slave", "CanOpenSlave", 1)
- slave.BaseParams.setEnabled(False)
+ PlugTemplate.LoadChilds(self) + if self.GetChildByName("Master") is None: + master = self.PlugAddChild("Master", "CanOpenNode", 0) + master.BaseParams.setEnabled(False) + if self.GetChildByName("Slave") is None: + slave = self.PlugAddChild("Slave", "CanOpenSlave", 1) + slave.BaseParams.setEnabled(False) #-------------------------------------------------------------------------------
@@ -503,7 +512,10 @@
PluginsRoot.__init__(self, frame, logger)
- self.PlugChildsTypes += [("LPCBus", LPCBus, "LPC bus"), ("CanOpen", LPCCanOpen, "CanOpen bus")]
+ self.PlugChildsTypes += [("LPCBus", LPCBus, "LPC bus"), ("CanOpen", LPCCanOpen, "CanOpen bus")] + self.PlugChildsTypes += [("LPCBus", LPCBus, "LPC bus")] @@ -682,7 +694,7 @@
#Load and init all the childs
- if self.GetChildByName("CanOpen") is None:
+ if havecanfestival and self.GetChildByName("CanOpen") is None: canopen = self.PlugAddChild("CanOpen", "CanOpen", 0)
canopen.BaseParams.setEnabled(False)
@@ -900,7 +912,7 @@
builder=self.GetBuilder()
- builder.ResetBinaryCodeMD5()
+ builder.ResetBinaryCodeMD5(self.OnlineMode) def GetLastBuildMD5(self):
builder=self.GetBuilder()
@@ -927,6 +939,9 @@
self.LPCConnector.ResetPLC()
self.AbortTransferTimer.Start(milliseconds=5000, oneShot=True)
+ self.CurrentMode = None self.logger.write(_("Start PLC transfer\n"))
@@ -1367,7 +1382,7 @@
new_properties["productVersion"] = productversion
new_properties["companyName"] = companyname
if new_properties != properties:
- self.PluginRoot.SetProjectProperties(properties=new_properties)
+ self.PluginRoot.SetProjectProperties(properties=new_properties, buffer=False) def SetOnlineMode(self, mode, path=None):
--- a/targets/LPC/__init__.py Thu Feb 16 15:13:05 2012 +0100
+++ b/targets/LPC/__init__.py Thu Feb 16 22:52:28 2012 +0100
@@ -40,6 +40,16 @@
+ def ResetBinaryCodeMD5(self, mode): + if mode == "BOOTLOADER": + os.remove(self._GetBinMD5FileName()) + return toolchain_makefile.ResetBinaryCodeMD5(self) def GetBinaryCodeMD5(self, mode):
return self._get_cached_md5_header()
@@ -48,16 +58,17 @@
res = toolchain_makefile.build(self)
- self.binmd5key = self._get_md5_header()
- f = open(self._GetBinMD5FileName(), "w")
- f.write(self.binmd5key)
- self.PluginsRootInstance.logger.write(
- _("Binary is %s bytes long\n")%
- os.path.join(self.buildpath, "ArmPLC_rom.bin"))))
+ self.binmd5key = self._get_md5_header() + f = open(self._GetBinMD5FileName(), "w") + f.write(self.binmd5key) + self.PluginsRootInstance.logger.write( + _("Binary is %s bytes long\n")% + os.path.join(self.buildpath, "ArmPLC_rom.bin")))) --- a/targets/toolchain_makefile.py Thu Feb 16 15:13:05 2012 +0100
+++ b/targets/toolchain_makefile.py Thu Feb 16 22:52:28 2012 +0100
@@ -98,7 +98,8 @@
status, result, err_result = ProcessLogger(self.PluginsRootInstance.logger,
- self.PluginsRootInstance.logger.write_error(_("C compilation of %s failed.\n"))
+ self.PluginsRootInstance.logger.write_error(_("C compilation failed.\n"))