Skip to content

Commit

Permalink
Don't allow :RAW for limits widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
jmthomas committed Sep 26, 2017
1 parent c3919c4 commit 1b434f3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion demo/config/targets/INST/screens/hs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ VERTICAL
SECTIONHEADER "Temperatures"
LABELTRENDLIMITSBAR INST HEALTH_STATUS TEMP1 WITH_UNITS 5
LABELVALUELIMITSBAR INST HEALTH_STATUS TEMP2 CONVERTED 25
LABELVALUELIMITSBAR INST HEALTH_STATUS TEMP2 RAW 20
# LABELVALUELIMITSBAR INST HEALTH_STATUS TEMP2 RAW 20 # RAW is not allowed for LIMITSBAR widgets
LABELVALUELIMITSBAR INST HEALTH_STATUS TEMP2 FORMATTED
LABELVALUELIMITSBAR INST HEALTH_STATUS TEMP2 WITH_UNITS
LABELVALUELIMITSBAR INST HEALTH_STATUS TEMP3
Expand Down
6 changes: 3 additions & 3 deletions lib/cosmos/tools/tlm_viewer/screen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def process(filename)
end

unless @widgets.invalid.empty?
Qt::MessageBox.information(self, "Screen #{@full_name}", "The following telemetry items could not be created: \n" + @widgets.invalid.join("\n"))
Qt::MessageBox.information(self, "Screen #{@full_name}", "In #{filename}, the following telemetry items could not be created: \n" + @widgets.invalid.join("\n"))
end

# Process all settings before we show the screen
Expand Down Expand Up @@ -383,8 +383,8 @@ def process_widget(parser, keyword, parameters, layout_stack, global_settings, g
System.telemetry.packet_and_item(*parameters[0..2])
widget = klass.new(layout_stack[-1], *parameters)
end
rescue
@widgets.invalid << parameters.join(" ")
rescue => err
@widgets.invalid << "#{parser.line_number}: #{parameters.join(" ").strip} due to #{err.message}"
return nil
end
else
Expand Down
2 changes: 1 addition & 1 deletion lib/cosmos/tools/tlm_viewer/widgets/limits_widget.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class LimitsWidget < Qt::Label

def initialize(parent_layout, target_name, packet_name, item_name, value_type, width, height)
super(target_name, packet_name, item_name, value_type)
@value_type = :CONVERTED if @value_type == :WITH_UNITS
raise "Invalid value_type #{@value_type} for LimitsWidget" if @value_type == :RAW
@width = width.to_i
@height = height.to_i
@value = 0
Expand Down

0 comments on commit 1b434f3

Please sign in to comment.