Fixed bug when starting Beremiz_runtime.py non empty (-a)
authorEdouard Tisserant
Fri, 12 Apr 2013 14:53:14 +0900
changeset 1027 4e44c2c3e081
parent 1026 96a2dc05651a
child 1029 474484781eac
Fixed bug when starting Beremiz_runtime.py non empty (-a)
Beremiz_service.py
runtime/PLCObject.py
--- a/Beremiz_service.py	Tue Apr 09 18:42:47 2013 +0200
+++ b/Beremiz_service.py	Fri Apr 12 14:53:14 2013 +0900
@@ -488,6 +488,7 @@
             self.servicepublisher.RegisterService(self.servicename, self.ip_addr, self.port)
         
         if self.autostart:
+            self.plcobj.LoadPLC()
             self.plcobj.StartPLC()
         
         sys.stdout.flush()
--- a/runtime/PLCObject.py	Tue Apr 09 18:42:47 2013 +0200
+++ b/runtime/PLCObject.py	Fri Apr 12 14:53:14 2013 +0900
@@ -122,7 +122,7 @@
         return os.path.join(self.workingdir,self.CurrentPLCFilename)
 
 
-    def _LoadNewPLC(self):
+    def LoadPLC(self):
         """
         Load PLC library
         Declare all functions, arguments and return values
@@ -209,7 +209,7 @@
         """
         self.PLClibraryLock.acquire()
         # Forget all refs to library
-        self._startPLC = lambda:None
+        self._startPLC = lambda x,y:None
         self._stopPLC = lambda:None
         self._ResetDebugVariables = lambda:None
         self._RegisterDebugVariable = lambda x, y:None
@@ -400,7 +400,7 @@
                 PLCprint(traceback.format_exc())
                 return False
 
-            if self._LoadNewPLC():
+            if self.LoadPLC():
                 self.PLCStatus = "Stopped"
                 try:
                     self.PythonRuntimeInit()