Class: Elemac::Sensors
- Inherits:
-
Object
- Object
- Elemac::Sensors
- Defined in:
- lib/elemac/sensors.rb
Instance Method Summary collapse
-
#initialize(device:) ⇒ Sensors
constructor
A new instance of Sensors.
- #ph1 ⇒ Object
- #ph2 ⇒ Object
- #temp1 ⇒ Object
- #temp2 ⇒ Object
- #temp3 ⇒ Object
- #temp4 ⇒ Object
Constructor Details
#initialize(device:) ⇒ Sensors
Returns a new instance of Sensors.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/elemac/sensors.rb', line 12 def initialize(device:) @device = device # TODO: check loaded sensors @temp1_available = true @temp2_available = false @temp3_available = false @temp4_available = false @ph1_available = true @ph2_available = false end |
Instance Method Details
#ph1 ⇒ Object
38 39 40 41 |
# File 'lib/elemac/sensors.rb', line 38 def ph1 throw 'Sensor ph1 unavailable' unless @ph1_available Sensor::Ph.new(device: @device, index: 4, divider: 100.0) end |
#ph2 ⇒ Object
42 43 44 45 |
# File 'lib/elemac/sensors.rb', line 42 def ph2 throw 'Sensor ph1 unavailable' unless @ph2_available Sensor::Ph.new(device: @device, index: 5, divider: 100.0) end |
#temp1 ⇒ Object
22 23 24 25 |
# File 'lib/elemac/sensors.rb', line 22 def temp1 throw 'Sensor temp1 unavailable' unless @temp1_available Sensor::Temperature.new(device: @device, index: 0, divider: 10.0) end |
#temp2 ⇒ Object
26 27 28 29 |
# File 'lib/elemac/sensors.rb', line 26 def temp2 throw 'Sensor temp2 unavailable' unless @temp2_available Sensor::Temperature.new(device: @device, index: 1, divider: 10.0) end |
#temp3 ⇒ Object
30 31 32 33 |
# File 'lib/elemac/sensors.rb', line 30 def temp3 throw 'Sensor temp3 unavailable' unless @temp3_available Sensor::Temperature.new(device: @device, index: 2, divider: 10.0) end |
#temp4 ⇒ Object
34 35 36 37 |
# File 'lib/elemac/sensors.rb', line 34 def temp4 throw 'Sensor temp4 unavailable' unless @temp4_available Sensor::Temperature.new(device: @device, index: 3, divider: 10.0) end |