1322 debug_code = targets.code("plc_debug") % { |
1322 debug_code = targets.code("plc_debug") % { |
1323 "buffer_size": reduce(lambda x, y: x + y, [DebugTypesSize.get(v["type"], 0) for v in self._VariablesList], 0), |
1323 "buffer_size": reduce(lambda x, y: x + y, [DebugTypesSize.get(v["type"], 0) for v in self._VariablesList], 0), |
1324 "programs_declarations": |
1324 "programs_declarations": |
1325 "\n".join(["extern %(type)s %(C_path)s;"%p for p in self._ProgramList]), |
1325 "\n".join(["extern %(type)s %(C_path)s;"%p for p in self._ProgramList]), |
1326 "extern_variables_declarations":"\n".join([ |
1326 "extern_variables_declarations":"\n".join([ |
1327 {"PT":"extern %(type)s *%(C_path)s;", |
1327 {"PT":"extern __IEC_%(type)s_p %(C_path)s;", |
1328 "VAR":"extern %(type)s %(C_path)s;"}[v["vartype"]]%v |
1328 "VAR":"extern __IEC_%(type)s_t %(C_path)s;"}[v["vartype"]]%v |
1329 for v in self._VariablesList if v["vartype"] != "FB" and v["C_path"].find('.')<0]), |
1329 for v in self._VariablesList if v["vartype"] != "FB" and v["C_path"].find('.')<0]), |
1330 "subscription_table_count": |
1330 "subscription_table_count": |
1331 len(self._VariablesList), |
1331 len(self._VariablesList), |
1332 "variables_pointer_type_table_count": |
1332 "variables_pointer_type_table_count": |
1333 len(self._VariablesList), |
1333 len(self._VariablesList), |
1616 # use wx.CallAfter use keep using same thread. TODO : use wx.Timer instead |
1616 # use wx.CallAfter use keep using same thread. TODO : use wx.Timer instead |
1617 self.DebugTimer=Timer(0.5,wx.CallAfter,args = [self.RegisterDebugVarToConnector]) |
1617 self.DebugTimer=Timer(0.5,wx.CallAfter,args = [self.RegisterDebugVarToConnector]) |
1618 # Rearm anti-rapid-fire timer |
1618 # Rearm anti-rapid-fire timer |
1619 self.DebugTimer.start() |
1619 self.DebugTimer.start() |
1620 |
1620 |
|
1621 def GetDebugIECVariableType(self, IECPath): |
|
1622 Idx, IEC_Type = self._IECPathToIdx.get(IECPath,(None,None)) |
|
1623 return IEC_Type |
1621 |
1624 |
1622 def SubscribeDebugIECVariable(self, IECPath, callableobj, *args, **kwargs): |
1625 def SubscribeDebugIECVariable(self, IECPath, callableobj, *args, **kwargs): |
1623 """ |
1626 """ |
1624 Dispatching use a dictionnary linking IEC variable paths |
1627 Dispatching use a dictionnary linking IEC variable paths |
1625 to a WeakKeyDictionary linking |
1628 to a WeakKeyDictionary linking |
1660 self.IECdebug_lock.acquire() |
1663 self.IECdebug_lock.acquire() |
1661 IECdebug_data = {} |
1664 IECdebug_data = {} |
1662 self.IECdebug_lock.release() |
1665 self.IECdebug_lock.release() |
1663 |
1666 |
1664 self.ReArmDebugRegisterTimer() |
1667 self.ReArmDebugRegisterTimer() |
|
1668 |
|
1669 def ForceDebugIECVariable(self, IECPath, value): |
|
1670 pass |
|
1671 |
|
1672 def ReleaseDebugIECVariable(self, IECPath): |
|
1673 pass |
1665 |
1674 |
1666 def CallWeakcallables(self, IECPath, function_name, *cargs): |
1675 def CallWeakcallables(self, IECPath, function_name, *cargs): |
1667 data_tuple = self.IECdebug_datas.get(IECPath, None) |
1676 data_tuple = self.IECdebug_datas.get(IECPath, None) |
1668 if data_tuple is not None: |
1677 if data_tuple is not None: |
1669 WeakCallableDict, data_log, status = data_tuple |
1678 WeakCallableDict, data_log, status = data_tuple |