# HG changeset patch
# User Edouard Tisserant
# Date 1599746906 -7200
# Node ID bff50b7e50eed21f7405ba282691be9d56b723e8
# Parent  ffce85221ea5b85d7e80b605f3b222fa3e2f8050
Runtime/PLCObject : move call to PreStartPLC right after call to the "start" method of all python extensions, and then just before the start of the python loop executing python_* blocks.

diff -r ffce85221ea5 -r bff50b7e50ee runtime/PLCObject.py
--- a/runtime/PLCObject.py	Thu Sep 03 11:16:08 2020 +0200
+++ b/runtime/PLCObject.py	Thu Sep 10 16:08:26 2020 +0200
@@ -440,6 +440,7 @@
 
             if cmd == "Activate":
                 self.PythonRuntimeCall("start")
+                self.PreStartPLC()
                 self.PythonThreadLoop()
                 self.PythonRuntimeCall("stop", reverse_order=True)
             else:  # "Finish"
@@ -471,8 +472,6 @@
             if not self.LoadPLC():
                 self._fail(_("Problem starting PLC : can't load PLC"))
 
-        self.PreStartPLC()
-
         if self.CurrentPLCFilename is not None and self.PLCStatus == PlcStatus.Stopped:
             c_argv = ctypes.c_char_p * len(self.argv)
             res = self._startPLC(len(self.argv), c_argv(*self.argv))