ProjectController.py
changeset 1146 510d1ea1f6c1
parent 1116 300f98a8d4c6
child 1176 f4b434672204
equal deleted inserted replaced
1144:21475ee0e688 1146:510d1ea1f6c1
  1180                 self._connector.SetTraceVariablesList(zip(*zip(*Idxs)[0:3]))
  1180                 self._connector.SetTraceVariablesList(zip(*zip(*Idxs)[0:3]))
  1181             else:
  1181             else:
  1182                 self.TracedIECPath = []
  1182                 self.TracedIECPath = []
  1183                 self._connector.SetTraceVariablesList([])
  1183                 self._connector.SetTraceVariablesList([])
  1184             self.IECdebug_lock.release()
  1184             self.IECdebug_lock.release()
  1185 
  1185     
       
  1186     def IsPLCStarted(self):
       
  1187         return self.previous_plcstate == "Started"
       
  1188      
  1186     def ReArmDebugRegisterTimer(self):
  1189     def ReArmDebugRegisterTimer(self):
  1187         if self.DebugTimer is not None:
  1190         if self.DebugTimer is not None:
  1188             self.DebugTimer.cancel()
  1191             self.DebugTimer.cancel()
  1189         
  1192         
  1190         # Prevent to call RegisterDebugVarToConnector when PLC is not started
  1193         # Prevent to call RegisterDebugVarToConnector when PLC is not started
  1191         # If an output location var is forced it's leads to segmentation fault in runtime
  1194         # If an output location var is forced it's leads to segmentation fault in runtime
  1192         # Links between PLC located variables and real variables are not ready
  1195         # Links between PLC located variables and real variables are not ready
  1193         if self.previous_plcstate == "Started":
  1196         if self.IsPLCStarted():
  1194             # Timer to prevent rapid-fire when registering many variables
  1197             # Timer to prevent rapid-fire when registering many variables
  1195             # use wx.CallAfter use keep using same thread. TODO : use wx.Timer instead
  1198             # use wx.CallAfter use keep using same thread. TODO : use wx.Timer instead
  1196             self.DebugTimer=Timer(0.5,wx.CallAfter,args = [self.RegisterDebugVarToConnector])
  1199             self.DebugTimer=Timer(0.5,wx.CallAfter,args = [self.RegisterDebugVarToConnector])
  1197             # Rearm anti-rapid-fire timer
  1200             # Rearm anti-rapid-fire timer
  1198             self.DebugTimer.start()
  1201             self.DebugTimer.start()