spektrum-log 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -68,8 +68,16 @@ module Spektrum
68
68
  raw_voltage != 0xFFFF
69
69
  end
70
70
 
71
- def temperature
71
+ def temperature unit = :f
72
72
  @temperature ||= two_byte_field(5..6)
73
+ case unit
74
+ when :f
75
+ @temperature
76
+ when :c
77
+ (@temperature - 32) * (5.0 / 9.0)
78
+ else
79
+ @temperature
80
+ end
73
81
  end
74
82
 
75
83
  def temperature?
@@ -1,5 +1,5 @@
1
1
  module Spektrum
2
2
  module Log
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
@@ -36,6 +36,10 @@ describe Spektrum::Log::BasicDataRecord do
36
36
 
37
37
  its(:temperature) { should eq(161) }
38
38
 
39
+ it 'should allow temperature in celsius' do
40
+ subject.temperature(:c).should be_within(0.1).of(71.7)
41
+ end
42
+
39
43
  its(:voltage?) { should be_false }
40
44
 
41
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spektrum-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: