Skip to content

Commit

Permalink
Merge pull request #1019 from OpenC3/processors_in_decom
Browse files Browse the repository at this point in the history
Only run processors in decom microservice
  • Loading branch information
ryanmelt authored Jan 8, 2024
2 parents a986a12 + e2751d5 commit 2b1c022
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions openc3/lib/openc3/microservices/decom_microservice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def decom_packet(topic, msg_id, msg_hash, _redis)
packet.extra = extra
end
packet.buffer = msg_hash["buffer"]
packet.process # Run processors
packet.check_limits(System.limits_set) # Process all the limits and call the limits_change_callback (as necessary)

TelemetryDecomTopic.write_packet(packet, scope: @scope)
Expand Down
5 changes: 2 additions & 3 deletions openc3/lib/openc3/packets/packet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ def buffer=(buffer)
Logger.instance.error "#{@target_name} #{@packet_name} received with actual packet length of #{buffer.length} but defined length of #{@defined_length}"
end
@read_conversion_cache.clear if @read_conversion_cache
process()
end
end

Expand Down Expand Up @@ -1195,8 +1194,6 @@ def decom
json_hash
end

protected

# Performs packet specific processing on the packet.
# Intended to only be run once for each packet received
def process(buffer = @buffer)
Expand All @@ -1207,6 +1204,8 @@ def process(buffer = @buffer)
end
end

protected

def handle_limits_states(item, value)
# Retrieve limits state for the given value
limits_state = item.state_colors[value]
Expand Down
1 change: 1 addition & 0 deletions openc3/python/openc3/microservices/decom_microservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def decom_packet(self, topic, msg_id, msg_hash, _redis):
if extra is not None:
packet.extra = json.loads(extra)
packet.buffer = msg_hash[b"buffer"]
packet.process() # Run processors
packet.check_limits(
System.limits_set()
) # Process all the limits and call the limits_change_callback (as necessary)
Expand Down
1 change: 0 additions & 1 deletion openc3/python/openc3/packets/packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ def buffer(self, buffer):
f"{self.target_name} {self.packet_name} buffer ({type(buffer)}) received with actual packet length of {len(buffer)} but defined length of {self.defined_length}"
)
self.read_conversion_cache = {}
self.process()

# Sets the received time of the packet (without cloning)
#
Expand Down
1 change: 1 addition & 0 deletions openc3/spec/packets/parsers/processor_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ module OpenC3
tf.close
@pc.process_file(tf.path, "TGT1")
@pc.telemetry["TGT1"]["PKT1"].buffer = "\x01\x01"
@pc.telemetry["TGT1"]["PKT1"].process
expect(@pc.telemetry["TGT1"]["PKT1"].read("ITEM1")).to eql 5
tf.unlink

Expand Down

0 comments on commit 2b1c022

Please sign in to comment.