tinderfridge 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1f848437f1877596a58521fdbe213042f6561b42a91c91b60eca2fd3ab1a690
4
- data.tar.gz: '09c7adcf40fabf6eae5ca89316428aeb6cabfa5f4abccbaaf27bd3901535afca'
3
+ metadata.gz: 26a171ddfc01502cca8300d445d498c960b8cfb1304e1b60fddc5d33ad0a68ba
4
+ data.tar.gz: ebf5e97bd0fe072375c6a548615baff3e42ef77432b96373035571a41897ba8a
5
5
  SHA512:
6
- metadata.gz: a84bc2687015ef1c65dd61cac031a7b6e6ff57e22a811784e6160dd5b002badf5f55f11c3883ffa754a6f42d0b5a6e5a085a4c930700c899956d06ec8f533d98
7
- data.tar.gz: c12dcf3ef70b1111f665a3098ab213a75819c2953b3c7cb2ebc020bd00b016588ec70ca0bebbdf72666a84edcc4be345f7aaa67c8ee4f8841262c1fc4afb80a7
6
+ metadata.gz: e5a6e8d3f54c3955afbbce8d48c1ded48ea46535dd078cc6118d207bf988634c7e04fbcab178a5b440ea5ff55798287df53f94465a06e0971a5d0282876f532f
7
+ data.tar.gz: 31d5cbea577e5b98279279193301e2a95062db29d7150149c3035ecb639f4301ce739854927f018fa922a9630bea7217c76dfb0329ccc5e88359b73f7c4fc7fe
@@ -109,7 +109,13 @@ module Tinkerforge
109
109
  [ 'ipcon' , { 'host' => ipcon.host , 'port' => ipcon.port } ],
110
110
 
111
111
  respond_to?('get_chip_temperature' ) ? [ 'chip_temperature' , get_chip_temperature ] : nil,
112
- respond_to?('get_spitfp_error_count') ? [ 'spitfp_error_count', get_spitfp_error_count ] : nil,
112
+
113
+ if respond_to?('get_spitfp_error_count') and (method(:get_spitfp_error_count).arity == 0)
114
+ [ 'spitfp_error_count', get_spitfp_error_count ]
115
+ else
116
+ nil
117
+ end,
118
+
113
119
  respond_to?('get_status_led_config' ) ? [ 'status_led_config' , get_status_led_config ] : nil,
114
120
 
115
121
  ].compact.to_h
@@ -131,9 +137,30 @@ module Tinkerforge
131
137
 
132
138
  # Identifies a Tinkerforge device by blinking its status led.
133
139
  #
134
- # Supports recent devices. When invoked on older devices, does nothing.
140
+ # Supports recent devices. When invoked on some older devices, does nothing.
135
141
  def identify(seconds=10)
136
- if (respond_to? 'get_status_led_config') and (respond_to? 'set_status_led_config')
142
+ case status_led_api_variety
143
+ when 1
144
+ seconds = seconds.to_i
145
+ state = is_status_led_enabled
146
+
147
+ (seconds*2).times do |n|
148
+ if n.even?
149
+ disable_status_led
150
+ else
151
+ enable_status_led
152
+ end
153
+ sleep 0.5
154
+ end
155
+
156
+ if state
157
+ enable_status_led
158
+ else
159
+ disable_status_led
160
+ end
161
+
162
+ seconds
163
+ when 2
137
164
  seconds = seconds.to_i
138
165
  state = get_status_led_config
139
166
 
@@ -175,6 +202,20 @@ module Tinkerforge
175
202
  end
176
203
  end
177
204
 
205
+ def status_led_api_variety
206
+ @status_led_api_variety ||=
207
+ if ( respond_to?('get_status_led_config') &&
208
+ respond_to?('set_status_led_config') )
209
+ 2
210
+ elsif ( respond_to?('is_status_led_enabled') &&
211
+ respond_to?('enable_status_led') &&
212
+ respond_to?('disable_status_led') )
213
+ 1
214
+ else
215
+ nil
216
+ end
217
+ end
218
+
178
219
  end
179
220
 
180
221
  end
@@ -5,6 +5,8 @@ module Tinkerforge
5
5
  # Returns the temperatures as measured inside the microcontrollers of devices in the collection.
6
6
  #
7
7
  # Nil for devices that do not support the get_chip_temperature method.
8
+ #
9
+ # Note: most devices return temperature in °C, but a few return temperature in 1/10 °C.
8
10
  def get_chip_temperature
9
11
  smap 'get_chip_temperature'
10
12
  end
@@ -135,7 +137,7 @@ module Tinkerforge
135
137
  private
136
138
 
137
139
  def smap(m)
138
- map { |k,d| [ k, d.respond_to?(m) ? d.send(m) : nil ] }.to_h
140
+ map { |k,d| [ k, ( d.respond_to?(m) and (d.method(m).arity == 0) ) ? d.send(m) : nil ] }.to_h
139
141
  end
140
142
 
141
143
  end
@@ -0,0 +1,11 @@
1
+ {
2
+ "dimensions": [
3
+ 40,
4
+ 40,
5
+ 16
6
+ ],
7
+ "weight": 12,
8
+ "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricks/Master_Brick.html",
9
+ "versions_identifier": "bricks:master",
10
+ "released": ""
11
+ }
@@ -0,0 +1,11 @@
1
+ module Tinkerforge
2
+
3
+ class BrickMaster
4
+
5
+ # Unit returned by #get_chip_temperature. Master Bricks return temperature as 1/10 °C.
6
+ CHIP_TEMPERATURE_UNIT = 0.1
7
+ # REVIEW: This should ideally be part of base Tinkerforge.
8
+
9
+ end
10
+
11
+ end
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 2,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Ambient_Light_V3.html",
9
- "versions_identifier": "bricklets:ambient_light_v3"
9
+ "versions_identifier": "bricklets:ambient_light_v3",
10
+ "released": "2019-01-29"
10
11
  }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 9,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/CO2_V2.html",
9
- "versions_identifier": "bricklets:co2_v2"
9
+ "versions_identifier": "bricklets:co2_v2",
10
+ "released": "2019-05-20"
10
11
  }
@@ -0,0 +1,19 @@
1
+ module Tinkerforge
2
+
3
+ class BrickletCO2V2
4
+
5
+ # Returns the device's state.
6
+ def state
7
+ av = get_all_values
8
+ super.merge(
9
+ 'co2_concentration' => av[0],
10
+ 'temperature' => av[1],
11
+ 'temperature_offset' => get_temperature_offset,
12
+ 'humidity' => av[2],
13
+ 'air_pressure' => get_air_pressure,
14
+ )
15
+ end
16
+
17
+ end
18
+
19
+ end
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 2,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Color_V2.html",
9
- "versions_identifier": "bricklets:color_v2"
9
+ "versions_identifier": "bricklets:color_v2",
10
+ "released": "2019-08-22"
10
11
  }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 2,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Compass.html",
9
- "versions_identifier": "bricklets:compass"
9
+ "versions_identifier": "bricklets:compass",
10
+ "released": "2019-08-22"
10
11
  }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 20,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/GPS_V2.html",
9
- "versions_identifier": "bricklets:gps_v2"
9
+ "versions_identifier": "bricklets:gps_v2",
10
+ "released": "2017-05-11"
10
11
  }
@@ -2,11 +2,24 @@ module Tinkerforge
2
2
 
3
3
  class BrickletGPSV2
4
4
 
5
+ # Returns the device's state.
6
+ def state
7
+ super.merge(
8
+ 'fix_led_config' => get_fix_led_config,
9
+ 'fix' => fix?,
10
+ )
11
+ end
12
+
13
+ # Returns true if a fix is available.
14
+ def fix?
15
+ get_status[0]
16
+ end
17
+
5
18
  # Returns latitude and longitude as reported by the GPS Bricklet.
6
19
  #
7
20
  # Nil when there is no fix (position not determined).
8
21
  def coordinates
9
- if get_status[0]
22
+ if fix?
10
23
  c = get_coordinates
11
24
  [
12
25
  c[0] / (c[1] == 'N' ? 1000000.0 : -1000000.0),
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 6,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Motion_Detector_V2.html",
9
- "versions_identifier": "bricklets:motion_detector_v2"
9
+ "versions_identifier": "bricklets:motion_detector_v2",
10
+ "released": "2018-02-26"
10
11
  }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 4,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Multi_Touch_V2.html",
9
- "versions_identifier": "bricklets:multi_touch_v2"
9
+ "versions_identifier": "bricklets:multi_touch_v2",
10
+ "released": "2019-08-22"
10
11
  }
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 8,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Remote_Switch_V2.html",
9
- "versions_identifier": "bricklets:remote_switch_v2"
9
+ "versions_identifier": "bricklets:remote_switch_v2",
10
+ "released": "2018-02-26"
10
11
  }
@@ -120,6 +120,8 @@ module Tinkerforge
120
120
  '[' => '1001110',
121
121
  ']' => '1111000',
122
122
 
123
+ '°' => '1100011',
124
+
123
125
  }
124
126
  end
125
127
 
@@ -6,5 +6,6 @@
6
6
  ],
7
7
  "weight": 2.6,
8
8
  "documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Sound_Pressure_Level.html",
9
- "versions_identifier": "bricklets:sound_pressure_level"
9
+ "versions_identifier": "bricklets:sound_pressure_level",
10
+ "released": "2018-06-07"
10
11
  }
@@ -0,0 +1,20 @@
1
+ module Tinkerforge
2
+
3
+ class BrickletSoundPressureLevel
4
+
5
+ WEIGHTINGS = [ 'dB(A)', 'dB(B)','dB(C)', 'dB(D)', 'dB(Z)', 'ITU-R 468']
6
+
7
+ # Returns the device's state.
8
+ def state
9
+ super.merge(
10
+ 'configuration' => conf = get_configuration,
11
+ 'weighting' => WEIGHTINGS[ conf[1] ],
12
+ 'sampling_rate' => 2 ** (3 - conf[0]) * 10,
13
+ 'bin_size' => 2 ** (3 - conf[0]) * 40,
14
+ 'sound_pressure' => get_decibel,
15
+ )
16
+ end
17
+
18
+ end
19
+
20
+ end
@@ -3,7 +3,7 @@ require 'tinkerforge/version'
3
3
  module Tinkerforge
4
4
 
5
5
  # Tinderfridge version.
6
- TINDERFRIDGE_VERSION = '0.8.0'
6
+ TINDERFRIDGE_VERSION = '0.9.0'
7
7
 
8
8
  # About Tinkerforge & Tinderfridge.
9
9
  def self.about
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinderfridge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - lllist.eu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-17 00:00:00.000000000 Z
11
+ date: 2022-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tinkerforge
@@ -45,6 +45,8 @@ files:
45
45
  - lib/tinderfridge/devices/brick_hat/brick_hat.rb
46
46
  - lib/tinderfridge/devices/brick_hat_zero/brick_hat_zero.json
47
47
  - lib/tinderfridge/devices/brick_hat_zero/brick_hat_zero.rb
48
+ - lib/tinderfridge/devices/brick_master/brick_master.json
49
+ - lib/tinderfridge/devices/brick_master/brick_master.rb
48
50
  - lib/tinderfridge/devices/bricklet_accelerometer_v2/bricklet_accelerometer_v2.json
49
51
  - lib/tinderfridge/devices/bricklet_air_quality/bricklet_air_quality.json
50
52
  - lib/tinderfridge/devices/bricklet_air_quality/bricklet_air_quality.rb
@@ -55,6 +57,7 @@ files:
55
57
  - lib/tinderfridge/devices/bricklet_barometer_v2/bricklet_barometer_v2.json
56
58
  - lib/tinderfridge/devices/bricklet_can_v2/bricklet_can_v2.json
57
59
  - lib/tinderfridge/devices/bricklet_co2_v2/bricklet_co2_v2.json
60
+ - lib/tinderfridge/devices/bricklet_co2_v2/bricklet_co2_v2.rb
58
61
  - lib/tinderfridge/devices/bricklet_color_v2/bricklet_color_v2.json
59
62
  - lib/tinderfridge/devices/bricklet_color_v2/bricklet_color_v2.rb
60
63
  - lib/tinderfridge/devices/bricklet_compass/bricklet_compass.json
@@ -129,6 +132,7 @@ files:
129
132
  - lib/tinderfridge/devices/bricklet_silent_stepper_v2/bricklet_silent_stepper_v2.json
130
133
  - lib/tinderfridge/devices/bricklet_solid_state_relay_v2/bricklet_solid_state_relay_v2.json
131
134
  - lib/tinderfridge/devices/bricklet_sound_pressure_level/bricklet_sound_pressure_level.json
135
+ - lib/tinderfridge/devices/bricklet_sound_pressure_level/bricklet_sound_pressure_level.rb
132
136
  - lib/tinderfridge/devices/bricklet_temperature_ir_v2/bricklet_temperature_ir_v2.json
133
137
  - lib/tinderfridge/devices/bricklet_temperature_v2/bricklet_temperature_v2.json
134
138
  - lib/tinderfridge/devices/bricklet_thermal_imaging/bricklet_thermal_imaging.json
@@ -162,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
166
  - !ruby/object:Gem::Version
163
167
  version: '0'
164
168
  requirements: []
165
- rubygems_version: 3.1.4
169
+ rubygems_version: 3.2.32
166
170
  signing_key:
167
171
  specification_version: 4
168
172
  summary: Extending Tinkerforge in fun and useful ways.