1416 |
1416 |
1417 def PullPLCStatusProc(self, event): |
1417 def PullPLCStatusProc(self, event): |
1418 self.UpdateMethodsFromPLCStatus() |
1418 self.UpdateMethodsFromPLCStatus() |
1419 |
1419 |
1420 def SnapshotAndResetDebugValuesBuffers(self): |
1420 def SnapshotAndResetDebugValuesBuffers(self): |
1421 plc_status, Traces = self._connector.GetTraceVariables() |
1421 if self._connector is not None: |
1422 # print [dict.keys() for IECPath, (dict, log, status, fvalue) in self.IECdebug_datas.items()] |
1422 plc_status, Traces = self._connector.GetTraceVariables() |
1423 if plc_status == "Started": |
1423 # print [dict.keys() for IECPath, (dict, log, status, fvalue) in self.IECdebug_datas.items()] |
1424 if len(Traces) > 0: |
1424 if plc_status == "Started": |
1425 for debug_tick, debug_buff in Traces: |
1425 if len(Traces) > 0: |
1426 debug_vars = UnpackDebugBuffer(debug_buff, self.TracedIECTypes) |
1426 for debug_tick, debug_buff in Traces: |
1427 if debug_vars is not None and len(debug_vars) == len(self.TracedIECPath): |
1427 debug_vars = UnpackDebugBuffer(debug_buff, self.TracedIECTypes) |
1428 for IECPath, values_buffer, value in izip( |
1428 if debug_vars is not None and len(debug_vars) == len(self.TracedIECPath): |
1429 self.TracedIECPath, |
1429 for IECPath, values_buffer, value in izip( |
1430 self.DebugValuesBuffers, |
1430 self.TracedIECPath, |
1431 debug_vars): |
1431 self.DebugValuesBuffers, |
1432 IECdebug_data = self.IECdebug_datas.get(IECPath, None) |
1432 debug_vars): |
1433 if IECdebug_data is not None and value is not None: |
1433 IECdebug_data = self.IECdebug_datas.get(IECPath, None) |
1434 forced = IECdebug_data[2:4] == ["Forced", value] |
1434 if IECdebug_data is not None and value is not None: |
1435 if not IECdebug_data[4] and len(values_buffer) > 0: |
1435 forced = IECdebug_data[2:4] == ["Forced", value] |
1436 values_buffer[-1] = (value, forced) |
1436 if not IECdebug_data[4] and len(values_buffer) > 0: |
1437 else: |
1437 values_buffer[-1] = (value, forced) |
1438 values_buffer.append((value, forced)) |
1438 else: |
1439 self.DebugTicks.append(debug_tick) |
1439 values_buffer.append((value, forced)) |
|
1440 self.DebugTicks.append(debug_tick) |
1440 |
1441 |
1441 |
1442 |
1442 buffers, self.DebugValuesBuffers = (self.DebugValuesBuffers, |
1443 buffers, self.DebugValuesBuffers = (self.DebugValuesBuffers, |
1443 [list() for dummy in xrange(len(self.TracedIECPath))]) |
1444 [list() for dummy in xrange(len(self.TracedIECPath))]) |
1444 |
1445 |