Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions cfecfs/missionlib/eds/91-write_cosmos_txt.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,26 @@ local append_qual_prefix = function(old_prefix,add_prefix)
return merged_prefix
end

-- -------------------------------------------------------------------------
-- Helper function: Write the enumeration labels associated with a lineitem (STATE tags)
-- -------------------------------------------------------------------------
write_cosmos_states = function(output,attribs)
if (attribs.labels) then
output:start_group()
for label in attribs.labels:iterate_subtree("ENUMERATION_ENTRY") do
output:write(string.format("STATE %s %d",string.upper(label.name),label.value))
end
output:end_group()
end
end

-- -------------------------------------------------------------------------
-- Helper function: Write a single line-item to a TLM definition (APPEND_ITEM)
-- -------------------------------------------------------------------------
write_cosmos_tlm_lineitem = function(output,attribs)

output:write(string.format("APPEND_ITEM %s %d %s \"%s\"", attribs.name, attribs.bitsize, attribs.ctype, attribs.descr))
write_cosmos_states(output,attribs)

end

Expand Down Expand Up @@ -101,6 +115,7 @@ write_cosmos_cmd_lineitem = function(output,attribs)
output:write(string.format("APPEND_PARAMETER %s %d %s %s %s %d \"%s\"",
attribs.name, attribs.bitsize, attribs.ctype, min, max, attribs.defaultval or 0, attribs.descr or ""))

write_cosmos_states(output,attribs)
end

end
Expand Down Expand Up @@ -159,6 +174,11 @@ write_cosmos_lineitem = function(output,line_writer,entry,qual_prefix,descr)
elseif (entry.entity_type == "BOOLEAN_DATATYPE" or SEDS.index_datatype_filter(entry)) then
attribs.ctype = (entry.is_signed and "INT") or "UINT"

-- collect the labels if this is an enum
if (entry.entity_type == "ENUMERATION_DATATYPE") then
attribs.labels = entry:find_first("ENUMERATION_LIST")
end

-- This only handles integers
if (entry.resolved_range) then
if (entry.resolved_range.min) then
Expand Down
Loading