Class: Jeti::Log::Data::MezonData

Inherits:
Object
  • Object
show all
Defined in:
lib/jeti/log/data/mezon_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(time, fields) ⇒ MezonData

Returns a new instance of MezonData.

Raises:

  • (ArgumentError)


15
16
17
18
19
20
# File 'lib/jeti/log/data/mezon_data.rb', line 15

def initialize(time, fields)
  raise ArgumentError unless fields.length == 9
  @time = time
  @battery_voltage, @battery_current, @bec_voltage, @bec_current, @capacity,
    @rpm, @temperature, @run_time, @pwm = fields
end

Instance Attribute Details

#battery_currentObject (readonly)

Returns the value of attribute battery_current.



7
8
9
# File 'lib/jeti/log/data/mezon_data.rb', line 7

def battery_current
  @battery_current
end

#battery_voltageObject (readonly)

Returns the value of attribute battery_voltage.



6
7
8
# File 'lib/jeti/log/data/mezon_data.rb', line 6

def battery_voltage
  @battery_voltage
end

#bec_currentObject (readonly)

Returns the value of attribute bec_current.



9
10
11
# File 'lib/jeti/log/data/mezon_data.rb', line 9

def bec_current
  @bec_current
end

#bec_voltageObject (readonly)

Returns the value of attribute bec_voltage.



8
9
10
# File 'lib/jeti/log/data/mezon_data.rb', line 8

def bec_voltage
  @bec_voltage
end

#capacityObject (readonly)

Returns the value of attribute capacity.



10
11
12
# File 'lib/jeti/log/data/mezon_data.rb', line 10

def capacity
  @capacity
end

#pwmObject (readonly)

Returns the value of attribute pwm.



13
14
15
# File 'lib/jeti/log/data/mezon_data.rb', line 13

def pwm
  @pwm
end

#rpmObject (readonly)

Returns the value of attribute rpm.



11
12
13
# File 'lib/jeti/log/data/mezon_data.rb', line 11

def rpm
  @rpm
end

#run_timeObject (readonly)

Returns the value of attribute run_time.



12
13
14
# File 'lib/jeti/log/data/mezon_data.rb', line 12

def run_time
  @run_time
end

#timeObject (readonly)

Returns the value of attribute time.



5
6
7
# File 'lib/jeti/log/data/mezon_data.rb', line 5

def time
  @time
end

Instance Method Details

#temperature(unit = :c) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/jeti/log/data/mezon_data.rb', line 22

def temperature(unit = :c)
  case unit
  when :f
    (@temperature * (9.0 / 5.0)) + 32
  else
    @temperature
  end
end