Class: Spektrum::Log::BasicDataRecord
- Defined in:
- lib/spektrum/log/records.rb
Instance Attribute Summary
Attributes inherited from Record
Instance Method Summary collapse
-
#initialize(timestamp, raw_data) ⇒ BasicDataRecord
constructor
A new instance of BasicDataRecord.
- #rpm(pole_count) ⇒ Object
- #rpm? ⇒ Boolean
- #temperature(unit = :f) ⇒ Object
- #temperature? ⇒ Boolean
-
#voltage ⇒ Float
Gets the flight pack voltage data.
-
#voltage? ⇒ Boolean
Determines if there is flight voltage data contained within.
Methods inherited from Record
#raw_hex_string, #type, #valid?
Constructor Details
#initialize(timestamp, raw_data) ⇒ BasicDataRecord
Returns a new instance of BasicDataRecord.
74 75 76 |
# File 'lib/spektrum/log/records.rb', line 74 def initialize(, raw_data) super , raw_data end |
Instance Method Details
#rpm(pole_count) ⇒ Object
78 79 80 |
# File 'lib/spektrum/log/records.rb', line 78 def rpm(pole_count) raw_rpm * pole_count end |
#rpm? ⇒ Boolean
82 83 84 |
# File 'lib/spektrum/log/records.rb', line 82 def rpm? raw_rpm != 0xFFFF end |
#temperature(unit = :f) ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/spektrum/log/records.rb', line 101 def temperature(unit = :f) @temperature ||= two_byte_field(6..7) case unit when :f @temperature when :c (@temperature - 32) * (5.0 / 9.0) else @temperature end end |
#temperature? ⇒ Boolean
113 114 115 |
# File 'lib/spektrum/log/records.rb', line 113 def temperature? self.temperature != 0x7FFF end |
#voltage ⇒ Float
Note:
This conversion has been verified via Spektrum STi
Gets the flight pack voltage data.
90 91 92 |
# File 'lib/spektrum/log/records.rb', line 90 def voltage raw_voltage / 100.0 end |
#voltage? ⇒ Boolean
Determines if there is flight voltage data contained within.
97 98 99 |
# File 'lib/spektrum/log/records.rb', line 97 def voltage? raw_voltage != 0xFFFF end |