class Spektrum::Log::BasicDataRecord

Public Class Methods

new(timestamp, raw_data) click to toggle source
Calls superclass method Spektrum::Log::Record::new
# File lib/spektrum/log/records.rb, line 74
def initialize(timestamp, raw_data)
  super timestamp, raw_data
end

Public Instance Methods

rpm(pole_count) click to toggle source
# File lib/spektrum/log/records.rb, line 78
def rpm(pole_count)
  raw_rpm * pole_count
end
rpm?() click to toggle source
# File lib/spektrum/log/records.rb, line 82
def rpm?
  raw_rpm != 0xFFFF
end
temperature(unit = :f) click to toggle source
# 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?() click to toggle source
# File lib/spektrum/log/records.rb, line 113
def temperature?
  self.temperature != 0x7FFF
end
voltage() click to toggle source

Gets the flight pack voltage data.

@return [Float] flight voltage data, in volts @note This conversion has been verified via Spektrum STi

# File lib/spektrum/log/records.rb, line 90
def voltage
  raw_voltage / 100.0
end
voltage?() click to toggle source

Determines if there is flight voltage data contained within.

@return [Boolean] true if there is flight voltage data, false otherwise

# File lib/spektrum/log/records.rb, line 97
def voltage?
  raw_voltage != 0xFFFF
end

Private Instance Methods

raw_rpm() click to toggle source
# File lib/spektrum/log/records.rb, line 119
def raw_rpm
  @raw_rpm ||= two_byte_field(2..3)
end
raw_voltage() click to toggle source
# File lib/spektrum/log/records.rb, line 123
def raw_voltage
  @raw_voltage ||= two_byte_field(4..5)
end