graphics/DebugDataConsumer.py
changeset 1220 16c283246241
parent 1214 2ef048b5383c
child 1363 e87e0166d0a7
equal deleted inserted replaced
1219:f5da9702685a 1220:16c283246241
   195         Set value IEC data type
   195         Set value IEC data type
   196         @param data_type: Value IEC data type
   196         @param data_type: Value IEC data type
   197         """
   197         """
   198         self.DataType = data_type
   198         self.DataType = data_type
   199     
   199     
   200     def NewValue(self, tick, value, forced=False, raw_bool=True):
   200     def NewValue(self, tick, value, forced=False, raw="BOOL"):
   201         """
   201         """
   202         Function called by debug thread when a new debug value is available
   202         Function called by debug thread when a new debug value is available
   203         @param tick: PLC tick when value was captured
   203         @param tick: PLC tick when value was captured
   204         @param value: Value captured
   204         @param value: Value captured
   205         @param forced: Forced flag, True if value is forced (default: False)
   205         @param forced: Forced flag, True if value is forced (default: False)
   206         @param raw_bool: Bool values must be treated rawly (default: True)
   206         @param raw: Data type of values not translated (default: 'BOOL')
   207         """
   207         """
   208         # Translate value to IEC literal
   208         # Translate value to IEC literal
   209         if self.DataType != "BOOL" or not raw_bool:
   209         if self.DataType != raw:
   210             value = TYPE_TRANSLATOR.get(self.DataType, str)(value)
   210             value = TYPE_TRANSLATOR.get(self.DataType, str)(value)
   211         
   211         
   212         # Store value and forced flag when value update is inhibited
   212         # Store value and forced flag when value update is inhibited
   213         if self.Inhibited:
   213         if self.Inhibited:
   214             self.LastValue = value
   214             self.LastValue = value