230 @return: True if data type is numeric |
230 @return: True if data type is numeric |
231 """ |
231 """ |
232 return (self.Parent.IsNumType(self.VariableType) or |
232 return (self.Parent.IsNumType(self.VariableType) or |
233 self.VariableType in ["STRING", "WSTRING"]) |
233 self.VariableType in ["STRING", "WSTRING"]) |
234 |
234 |
235 def NewValues(self, ticks, values, forced=False): |
235 def NewValues(self, ticks, values): |
236 """ |
236 """ |
237 Function called by debug thread when a new debug value is available |
237 Function called by debug thread when a new debug value is available |
238 @param tick: PLC tick when value was captured |
238 @param tick: PLC tick when value was captured |
239 @param value: Value captured |
239 @param value: Value captured |
240 @param forced: Forced flag, True if value is forced (default: False) |
240 @param forced: Forced flag, True if value is forced (default: False) |
241 """ |
241 """ |
242 DebugDataConsumer.NewValues(self, ticks, values, forced, raw=None) |
242 DebugDataConsumer.NewValues(self, ticks[-1], values[-1], raw=None) |
243 |
243 |
244 if self.Data is not None: |
244 if self.Data is not None: |
245 |
245 |
246 if self.VariableType in ["STRING", "WSTRING"]: |
246 if self.VariableType in ["STRING", "WSTRING"]: |
247 last_raw_data = (self.RawData[-1] |
247 last_raw_data = (self.RawData[-1] |
248 if len(self.RawData) > 0 else None) |
248 if len(self.RawData) > 0 else None) |
249 last_raw_data_idx = len(self.RawData) - 1 |
249 last_raw_data_idx = len(self.RawData) - 1 |
250 |
|
251 # Translate forced flag to float for storing in Data table |
|
252 forced_value = float(forced) |
|
253 |
250 |
254 data_values = [] |
251 data_values = [] |
255 for tick, value in zip(ticks, values): |
252 for tick, (value, forced) in zip(ticks, values): |
256 |
253 # Translate forced flag to float for storing in Data table |
|
254 forced_value = float(forced) |
|
255 |
257 # String data value is CRC |
256 # String data value is CRC |
258 num_value = (binascii.crc32(value) & STRING_CRC_MASK |
257 num_value = (binascii.crc32(value) & STRING_CRC_MASK |
259 if self.VariableType in ["STRING", "WSTRING"] |
258 if self.VariableType in ["STRING", "WSTRING"] |
260 else float(value)) |
259 else float(value)) |
261 |
260 |