Tolerance to bad casing; added 'Ra' as acceptable unit

pull/2/head
Aaron Johnson 6 years ago
parent 74fec40e64
commit 96ffc16155

@ -128,8 +128,9 @@ if @tunit.nil?
puts "Error(#{errcount.to_s}): Temperature units not configured! Defaulting to Rankine. Continuing...\n\n"
@tunit = 'R'
else
case @tunit
when "C", "F", "K", "R"
case @tunit.upcase
when "C", "F", "K", "R", "RA"
@tunit = @tunit.capitalize
print "OK\n".green.bold
else
errcount += 1
@ -202,14 +203,14 @@ def process_tdata(host, simple=false)
#if tdata.is_integer?
if tdata.is_float?
tdf = tdata.to_f
case @tunit
case @tunit.upcase
when "C"
#Do nothing; expected input is Celsius
when "F"
tdf = (tdf * 1.8) + 32
when "K"
tdf = tdf + 273.15
when "R"
when "R", "RA"
tdf = (tdf * 1.8) + 491.67
else
puts "#{@tunit} not valid temperature unit! Submitting unmodified output!"

Loading…
Cancel
Save