runtime/PLCObject.py
changeset 2689 7f67a7f6bfcc
parent 2682 4d3320fdab19
child 2697 93333d206198
equal deleted inserted replaced
2688:4dd67aa45855 2689:7f67a7f6bfcc
   438                 self.PythonThreadCmd = "Wait"
   438                 self.PythonThreadCmd = "Wait"
   439             self.PythonThreadCondLock.release()
   439             self.PythonThreadCondLock.release()
   440 
   440 
   441             if cmd == "Activate":
   441             if cmd == "Activate":
   442                 self.PythonRuntimeCall("start")
   442                 self.PythonRuntimeCall("start")
       
   443                 self.PreStartPLC()
   443                 self.PythonThreadLoop()
   444                 self.PythonThreadLoop()
   444                 self.PythonRuntimeCall("stop", reverse_order=True)
   445                 self.PythonRuntimeCall("stop", reverse_order=True)
   445             else:  # "Finish"
   446             else:  # "Finish"
   446                 break
   447                 break
   447 
   448 
   468     def StartPLC(self):
   469     def StartPLC(self):
   469 
   470 
   470         if self.PLClibraryHandle is None:
   471         if self.PLClibraryHandle is None:
   471             if not self.LoadPLC():
   472             if not self.LoadPLC():
   472                 self._fail(_("Problem starting PLC : can't load PLC"))
   473                 self._fail(_("Problem starting PLC : can't load PLC"))
   473 
       
   474         self.PreStartPLC()
       
   475 
   474 
   476         if self.CurrentPLCFilename is not None and self.PLCStatus == PlcStatus.Stopped:
   475         if self.CurrentPLCFilename is not None and self.PLCStatus == PlcStatus.Stopped:
   477             c_argv = ctypes.c_char_p * len(self.argv)
   476             c_argv = ctypes.c_char_p * len(self.argv)
   478             res = self._startPLC(len(self.argv), c_argv(*self.argv))
   477             res = self._startPLC(len(self.argv), c_argv(*self.argv))
   479             if res == 0:
   478             if res == 0: