Sha256: 986d0f976f8bbe9b3ee753faa6ee06e8164c2feffb2b3f17e2a619866544776b
Contents?: true
Size: 1.35 KB
Versions: 5
Compression:
Stored size: 1.35 KB
Contents
from openc3.conversions.conversion import Conversion # Custom conversion class # See https://docs.openc3.com/docs/configuration/telemetry#read_conversion class <%= conversion_class %>(Conversion): def __init__(self): super().__init__() # Should be one of 'INT', 'UINT', 'FLOAT', 'STRING', 'BLOCK' self.converted_type = 'STRING' # Size of the converted type in bits # Use 0 for 'STRING' or 'BLOCK' where the size can be variable self.converted_bit_size = 0 # @param value [Object] Value based on the item definition. This could be # a string, integer, float, or array of values. # @param packet [Packet] The packet object where the conversion is defined # @param buffer [String] The raw packet buffer def call(self, value, packet, buffer): # Read values from the packet and do a conversion # Used for DERIVED items that don't have a value # item1 = packet.read("ITEM1") # returns CONVERTED value (default) # item2 = packet.read("ITEM2", 'RAW') # returns RAW value # return (item1 + item2) / 2 # # Perform conversion logic directly on value # Used when conversion is applied to a regular (not DERIVED) item # NOTE: You can also use packet.read("ITEM") to get additional values # return value / 2 * packet.read("OTHER_ITEM")
Version data entries
5 entries across 5 versions & 1 rubygems