Removed status polling for LPC, as status cannot change by itself, fixed MD5 comparison in app mode
authoredouard
Thu, 17 Feb 2011 17:34:29 +0100
changeset 575 6765adf58711
parent 574 1b6bd9f590aa
child 576 7fcdc0d3d8d9
Removed status polling for LPC, as status cannot change by itself, fixed MD5 comparison in app mode
LPCBeremiz.py
connectors/LPC/LPCAppObject.py
--- a/LPCBeremiz.py	Thu Feb 17 17:04:10 2011 +0100
+++ b/LPCBeremiz.py	Thu Feb 17 17:34:29 2011 +0100
@@ -492,9 +492,9 @@
                     status = ""
                 self.logger.write(_("PLC is %s\n")%status)
                 
-                if self.StatusTimer and not self.StatusTimer.IsRunning():
-                    # Start the status Timer
-                    self.StatusTimer.Start(milliseconds=2000, oneShot=False)
+                #if self.StatusTimer and not self.StatusTimer.IsRunning():
+                #    # Start the status Timer
+                #    self.StatusTimer.Start(milliseconds=2000, oneShot=False)
                 
                 if self.previous_plcstate=="Started":
                     if self.DebugAvailable() and self.GetIECProgramsAndVariables():
@@ -808,7 +808,7 @@
             
             else:
                 self.logger.write(_("Resetting PLC\n"))
-                self.StatusTimer.Stop()
+                #self.StatusTimer.Stop()
                 self.LPCConnector.ResetPLC()
                 self.AbortTransferTimer.Start(milliseconds=5000, oneShot=True)
     
--- a/connectors/LPC/LPCAppObject.py	Thu Feb 17 17:04:10 2011 +0100
+++ b/connectors/LPC/LPCAppObject.py	Thu Feb 17 17:34:29 2011 +0100
@@ -31,7 +31,6 @@
         self.SerialConnection = LPCAppProto(comport,#number
                                          115200, #speed
                                          2)      #timeout
-        self.HandleSerialTransaction(IDLETransaction())
 
     def StartPLC(self, debug=False):
         self.HandleSerialTransaction(STARTTransaction())
@@ -45,13 +44,13 @@
         return self.PLCStatus
 
     def GetPLCstatus(self):
-        self.HandleSerialTransaction(IDLETransaction())
+        self.HandleSerialTransaction(GET_PLCIDTransaction())
         return self.PLCStatus
 
     def MatchMD5(self, MD5):
         data = self.HandleSerialTransaction(GET_PLCIDTransaction())
         if data is not None:
-            return data[:32] == MD5
+            return data[:32] == MD5[:32]
         return False
 
     class IEC_STRING(ctypes.Structure):