Skip to content

Commit

Permalink
Restore table deprecated, remove some TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
jmthomas committed Oct 24, 2024
1 parent 586146f commit 35a45f4
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 244 deletions.
3 changes: 3 additions & 0 deletions openc3/lib/openc3/tools/table_manager/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class Table < Packet
# Constructor for a TableDefinition
def initialize(name, endianness, type, description, filename)
super(TARGET, name, endianness, description, '', TableItem)
# ONE_DIMENSIONAL and TWO_DIMENSIONAL are deprecated so translate
type = :KEY_VALUE if type == :ONE_DIMENSIONAL
type = :ROW_COLUMN if type == :TWO_DIMENSIONAL
if type != :KEY_VALUE && type != :ROW_COLUMN
raise ArgumentError,
"Invalid type '#{type}' for table '#{name}'. Must be KEY_VALUE or ROW_COLUMN"
Expand Down
4 changes: 2 additions & 2 deletions openc3/lib/openc3/tools/table_manager/table_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ def create_table(tables, warnings)
end
type = params[2].to_s.upcase.to_sym
case type
when :KEY_VALUE
when :KEY_VALUE, :ONE_DIMENSIONAL # :ONE_DIMENSIONAL is deprecated
@parser.verify_num_parameters(3, 4, @usage)
description = params[3].to_s
when :ROW_COLUMN
when :ROW_COLUMN, :TWO_DIMENSIONAL # :TWO_DIMENSIONAL is deprecated
@parser.verify_num_parameters(4, 5, @usage)
num_rows = params[3].to_i
description = params[4].to_s
Expand Down
7 changes: 0 additions & 7 deletions openc3/lib/openc3/topics/command_decom_topic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ def self.write_packet(packet, scope:)
def self.get_cmd_item(target_name, packet_name, param_name, type: :WITH_UNITS, scope: $openc3_scope)
msg_id, msg_hash = Topic.get_newest_message("#{scope}__DECOMCMD__{#{target_name}}__#{packet_name}")
if msg_id
# TODO: We now have these reserved items directly on command packets
# Do we still calculate from msg_hash['time'] or use the times directly?
#
# if param_name == 'RECEIVED_TIMESECONDS' || param_name == 'PACKET_TIMESECONDS'
# Time.from_nsec_from_epoch(msg_hash['time'].to_i).to_f
# elsif param_name == 'RECEIVED_TIMEFORMATTED' || param_name == 'PACKET_TIMEFORMATTED'
# Time.from_nsec_from_epoch(msg_hash['time'].to_i).formatted
if param_name == 'RECEIVED_COUNT'
msg_hash['received_count'].to_i
else
Expand Down
1 change: 0 additions & 1 deletion openc3/python/openc3/models/target_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ def build_item_to_packet_map(cls, target_name: str, scope: str = OPENC3_SCOPE):
item_map[item_name].append(packet["packet_name"])
return item_map

# TODO: Not nearly complete ... see target_model.rb
def __init__(
self,
name: str,
Expand Down
6 changes: 4 additions & 2 deletions openc3/python/openc3/packets/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,10 @@ def build_cmd_output_string(self, target_name, cmd_name, cmd_params, raw=False):
if cmd_params is None or len(cmd_params) == 0:
output_string += '")'
else:
# TODO: Try except around this?
command_items = self.packet(target_name, cmd_name).items
try:
command_items = self.packet(target_name, cmd_name).items
except RuntimeError:
command_items = {}

params = []
for key, value in cmd_params:
Expand Down
7 changes: 0 additions & 7 deletions openc3/python/openc3/topics/command_decom_topic.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ def write_packet(cls, packet, scope):
def get_cmd_item(cls, target_name, packet_name, param_name, type="WITH_UNITS", scope=OPENC3_SCOPE):
msg_id, msg_hash = Topic.get_newest_message(f"{scope}__DECOMCMD__{{{target_name}}}__{packet_name}")
if msg_id:
# TODO: We now have these reserved items directly on command packets
# Do we still calculate from msg_hash['time'] or use the times directly?
#
# if param_name == 'RECEIVED_TIMESECONDS' || param_name == 'PACKET_TIMESECONDS'
# Time.from_nsec_from_epoch(msg_hash['time'].to_i).to_f
# elsif param_name == 'RECEIVED_TIMEFORMATTED' || param_name == 'PACKET_TIMEFORMATTED'
# Time.from_nsec_from_epoch(msg_hash['time'].to_i).formatted
if param_name == "RECEIVED_COUNT":
return int(msg_hash[b"received_count"])
else:
Expand Down
Loading

0 comments on commit 35a45f4

Please sign in to comment.