LPC transfer tested, added PLCInfo along MD5 checksum while invoking makefile
--- a/LPCBeremiz.py Tue Dec 15 16:04:28 2009 +0100
+++ b/LPCBeremiz.py Tue Dec 15 18:24:50 2009 +0100
@@ -561,7 +561,7 @@
if self._connector is not None:
simulating = self._connector.GetPLCstatus() == "Started"
- elif self.OnlineMode == 1:
+ elif self.OnlineMode == 2: if self._connector is not None:
simulating = self._connector.GetPLCstatus() == "Started"
--- a/connectors/LPC/LPCObject.py Tue Dec 15 16:04:28 2009 +0100
+++ b/connectors/LPC/LPCObject.py Tue Dec 15 18:24:50 2009 +0100
@@ -93,11 +93,31 @@
def NewPLC(self, md5sum, data, extrafiles):
+ if os.path.exists(self.StorageConnection): + firmwarepath = os.path.join( + self.StorageConnection, + if os.path.exists(firmwarepath ): + os.unlink(firmwarepath) + f = open(firmwarepath, "wb") + self.StorageConnection = None + self.PLCStatus = "Disconnected" + self.pluginsroot.logger.write_error( + "LPC transfer error : "+ - data = self.HandleSerialTransaction(PLCIDTransaction())
+ data = self.HandleSerialTransaction(GET_PLCIDTransaction()) + return data[:32] == MD5 + def GetPLCInfo(self, MD5): + data = self.HandleSerialTransaction(GET_PLCIDTransaction()) class IEC_STRING(ctypes.Structure):
--- a/targets/LPC/plc_LPC_main.c Tue Dec 15 16:04:28 2009 +0100
+++ b/targets/LPC/plc_LPC_main.c Tue Dec 15 18:24:50 2009 +0100
@@ -82,10 +82,18 @@
+int CheckRetainBuffer(void) + /* TODO : compare RETAIN buffer start with MD5 */ void Retain(unsigned int offset, unsigned int count, void *p)
+ /* TODO : write in RETAIN buffer at offset*/ void Remind(unsigned int offset, unsigned int count, void *p)
+ /* TODO : read at offset in RETAIN buffer */ --- a/targets/Win32/plc_Win32_main.c Tue Dec 15 16:04:28 2009 +0100
+++ b/targets/Win32/plc_Win32_main.c Tue Dec 15 18:24:50 2009 +0100
@@ -227,6 +227,11 @@
WaitForSingleObject(python_sem, INFINITE);
+int CheckRetainBuffer(void) void Retain(unsigned int offset, unsigned int count, void * p)
--- a/targets/plc_debug.c Tue Dec 15 16:04:28 2009 +0100
+++ b/targets/plc_debug.c Tue Dec 15 18:24:50 2009 +0100
@@ -102,6 +102,8 @@
+int CheckRetainBuffer(void); /* init local static vars */
@@ -109,7 +111,8 @@
buffer_state = BUFFER_FREE;
/* Iterate over all variables to fill debug buffer */
- __for_each_variable_do(RemindIterator);
+ if(CheckRetainBuffer()) + __for_each_variable_do(RemindIterator); --- a/targets/toolchain_makefile.py Tue Dec 15 16:04:28 2009 +0100
+++ b/targets/toolchain_makefile.py Tue Dec 15 18:24:50 2009 +0100
@@ -2,6 +2,8 @@
from wxPopen import ProcessLogger
includes_re = re.compile('\s*#include\s*["<]([^">]*)[">].*')
class toolchain_makefile():
@@ -48,6 +50,11 @@
self.md5key = hashlib.md5(wholesrcdata).hexdigest()
+ props = self.PluginsRootInstance.GetProjectProperties() + self.md5key += '|'.join([props[key] for key in ['companyName', + self.md5key += '|'+','.join(map(str,time.localtime())) # Store new PLC filename based on md5 key
f = open(self._GetMD5FileName(), "w")