tinderfridge 0.5.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tinderfridge/device.rb +101 -6
- data/lib/tinderfridge/device_collection.rb +19 -1
- data/lib/tinderfridge/device_info.txt +3 -0
- data/lib/tinderfridge/devices/brick_hat/brick_hat.json +11 -0
- data/lib/tinderfridge/devices/{brick_hat.rb → brick_hat/brick_hat.rb} +0 -0
- data/lib/tinderfridge/devices/brick_hat_zero/brick_hat_zero.json +11 -0
- data/lib/tinderfridge/devices/{brick_hat_zero.rb → brick_hat_zero/brick_hat_zero.rb} +0 -0
- data/lib/tinderfridge/devices/brick_master/brick_master.json +11 -0
- data/lib/tinderfridge/devices/brick_master/brick_master.rb +11 -0
- data/lib/tinderfridge/devices/bricklet_accelerometer_v2/bricklet_accelerometer_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_air_quality/bricklet_air_quality.json +11 -0
- data/lib/tinderfridge/devices/{bricklet_air_quality.rb → bricklet_air_quality/bricklet_air_quality.rb} +0 -0
- data/lib/tinderfridge/devices/bricklet_ambient_light_v3/bricklet_ambient_light_v3.json +11 -0
- data/lib/tinderfridge/devices/{bricklet_ambient_light_v3.rb → bricklet_ambient_light_v3/bricklet_ambient_light_v3.rb} +0 -0
- data/lib/tinderfridge/devices/bricklet_analog_in_v3/bricklet_analog_in_v3.json +10 -0
- data/lib/tinderfridge/devices/bricklet_analog_out_v3/bricklet_analog_out_v3.json +11 -0
- data/lib/tinderfridge/devices/bricklet_barometer_v2/bricklet_barometer_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_can_v2/bricklet_can_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_co2_v2/bricklet_co2_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_co2_v2/bricklet_co2_v2.rb +19 -0
- data/lib/tinderfridge/devices/bricklet_color_v2/bricklet_color_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_color_v2/bricklet_color_v2.rb +31 -0
- data/lib/tinderfridge/devices/bricklet_compass/bricklet_compass.json +11 -0
- data/lib/tinderfridge/devices/bricklet_dc_v2/bricklet_dc_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_distance_ir_v2/bricklet_distance_ir_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_distance_us_v2/bricklet_distance_us_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_dmx/bricklet_dmx.json +10 -0
- data/lib/tinderfridge/devices/{bricklet_dmx.rb → bricklet_dmx/bricklet_dmx.rb} +0 -0
- data/lib/tinderfridge/devices/bricklet_dual_button_v2/bricklet_dual_button_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_e_paper_296x128/bricklet_e_paper_296x128.json +10 -0
- data/lib/tinderfridge/devices/bricklet_energy_monitor/bricklet_energy_monitor.json +10 -0
- data/lib/tinderfridge/devices/bricklet_gps_v2/bricklet_gps_v2.json +11 -0
- data/lib/tinderfridge/devices/{bricklet_gps_v2.rb → bricklet_gps_v2/bricklet_gps_v2.rb} +14 -1
- data/lib/tinderfridge/devices/bricklet_hall_effect_v2/bricklet_hall_effect_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_humidity_v2/bricklet_humidity_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_imu_v3/bricklet_imu_v3.json +10 -0
- data/lib/tinderfridge/devices/bricklet_industrial_analog_out_v2/bricklet_industrial_analog_out_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_industrial_counter/bricklet_industrial_counter.json +11 -0
- data/lib/tinderfridge/devices/bricklet_industrial_digital_in_4_v2/bricklet_industrial_digital_in_4_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_industrial_digital_out_4_v2/bricklet_industrial_digital_out_4_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_industrial_dual_0_20ma_v2/bricklet_industrial_dual_0_20ma_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_industrial_dual_ac_relay/bricklet_industrial_dual_ac_relay.json +11 -0
- data/lib/tinderfridge/devices/bricklet_industrial_dual_analog_in_v2/bricklet_industrial_dual_analog_in_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_industrial_dual_relay/bricklet_industrial_dual_relay.json +10 -0
- data/lib/tinderfridge/devices/{bricklet_industrial_dual_relay.rb → bricklet_industrial_dual_relay/bricklet_industrial_dual_relay.rb} +0 -0
- data/lib/tinderfridge/devices/bricklet_industrial_ptc/bricklet_industrial_ptc.json +11 -0
- data/lib/tinderfridge/devices/bricklet_industrial_quad_relay_v2/bricklet_industrial_quad_relay_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_io16_v2/bricklet_io16_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_io4_v2/bricklet_io4_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_isolator/bricklet_isolator.json +10 -0
- data/lib/tinderfridge/devices/bricklet_isolator/bricklet_isolator.rb +17 -0
- data/lib/tinderfridge/devices/bricklet_joystick_v2/bricklet_joystick_v2.json +10 -0
- data/lib/tinderfridge/devices/{bricklet_joystick_v2.rb → bricklet_joystick_v2/bricklet_joystick_v2.rb} +0 -0
- data/lib/tinderfridge/devices/bricklet_laser_range_finder_v2/bricklet_laser_range_finder_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_lcd_128x64/bricklet_lcd_128x64.json +10 -0
- data/lib/tinderfridge/devices/{bricklet_lcd_128x64.rb → bricklet_lcd_128x64/bricklet_lcd_128x64.rb} +0 -0
- data/lib/tinderfridge/devices/bricklet_led_strip_v2/bricklet_led_strip_v2.json +11 -0
- data/lib/tinderfridge/devices/{bricklet_led_strip_v2.rb → bricklet_led_strip_v2/bricklet_led_strip_v2.rb} +0 -0
- data/lib/tinderfridge/devices/bricklet_linear_poti_v2/bricklet_linear_poti_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_load_cell_v2/bricklet_load_cell_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_motion_detector_v2/bricklet_motion_detector_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_motion_detector_v2/bricklet_motion_detector_v2.rb +22 -0
- data/lib/tinderfridge/devices/bricklet_motorized_linear_poti/bricklet_motorized_linear_poti.json +10 -0
- data/lib/tinderfridge/devices/{bricklet_motorized_linear_poti.rb → bricklet_motorized_linear_poti/bricklet_motorized_linear_poti.rb} +0 -0
- data/lib/tinderfridge/devices/bricklet_multi_touch_v2/bricklet_multi_touch_v2.json +11 -0
- data/lib/tinderfridge/devices/{bricklet_multi_touch_v2.rb → bricklet_multi_touch_v2/bricklet_multi_touch_v2.rb} +0 -0
- data/lib/tinderfridge/devices/bricklet_nfc/bricklet_nfc.json +10 -0
- data/lib/tinderfridge/devices/{bricklet_nfc.rb → bricklet_nfc/bricklet_nfc.rb} +0 -0
- data/lib/tinderfridge/devices/bricklet_oled_128x64_v2/bricklet_oled_128x64_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_one_wire/bricklet_one_wire.json +11 -0
- data/lib/tinderfridge/devices/bricklet_outdoor_weather/bricklet_outdoor_weather.json +10 -0
- data/lib/tinderfridge/devices/{bricklet_outdoor_weather.rb → bricklet_outdoor_weather/bricklet_outdoor_weather.rb} +0 -0
- data/lib/tinderfridge/devices/bricklet_particulate_matter/bricklet_particulate_matter.json +11 -0
- data/lib/tinderfridge/devices/bricklet_performance_dc/bricklet_performance_dc.json +11 -0
- data/lib/tinderfridge/devices/bricklet_piezo_speaker_v2/bricklet_piezo_speaker_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_ptc_v2/bricklet_ptc_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_real_time_clock_v2/bricklet_real_time_clock_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_remote_switch_v2/bricklet_remote_switch_v2.json +11 -0
- data/lib/tinderfridge/devices/{bricklet_remote_switch_v2.rb → bricklet_remote_switch_v2/bricklet_remote_switch_v2.rb} +0 -0
- data/lib/tinderfridge/devices/bricklet_rgb_led_button/bricklet_rgb_led_button.json +10 -0
- data/lib/tinderfridge/devices/{bricklet_rgb_led_button.rb → bricklet_rgb_led_button/bricklet_rgb_led_button.rb} +1 -1
- data/lib/tinderfridge/devices/bricklet_rgb_led_v2/bricklet_rgb_led_v2.json +10 -0
- data/lib/tinderfridge/devices/{bricklet_rgb_led_v2.rb → bricklet_rgb_led_v2/bricklet_rgb_led_v2.rb} +0 -0
- data/lib/tinderfridge/devices/bricklet_rotary_encoder_v2/bricklet_rotary_encoder_v2.json +10 -0
- data/lib/tinderfridge/devices/{bricklet_rotary_encoder_v2.rb → bricklet_rotary_encoder_v2/bricklet_rotary_encoder_v2.rb} +0 -0
- data/lib/tinderfridge/devices/bricklet_rotary_poti_v2/bricklet_rotary_poti_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_rs232_v2/bricklet_rs232_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_rs485/bricklet_rs485.json +11 -0
- data/lib/tinderfridge/devices/bricklet_segment_display_4x7_v2/bricklet_segment_display_4x7_v2.json +11 -0
- data/lib/tinderfridge/devices/{bricklet_segment_display_4x7_v2.rb → bricklet_segment_display_4x7_v2/bricklet_segment_display_4x7_v2.rb} +25 -1
- data/lib/tinderfridge/devices/bricklet_servo_v2/bricklet_servo_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_silent_stepper_v2/bricklet_silent_stepper_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_solid_state_relay_v2/bricklet_solid_state_relay_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_sound_pressure_level/bricklet_sound_pressure_level.json +11 -0
- data/lib/tinderfridge/devices/bricklet_sound_pressure_level/bricklet_sound_pressure_level.rb +20 -0
- data/lib/tinderfridge/devices/bricklet_temperature_ir_v2/bricklet_temperature_ir_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_temperature_v2/bricklet_temperature_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_thermal_imaging/bricklet_thermal_imaging.json +10 -0
- data/lib/tinderfridge/devices/bricklet_thermocouple_v2/bricklet_thermocouple_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_uv_light_v2/bricklet_uv_light_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_voltage_current_v2/bricklet_voltage_current_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_voltage_current_v2/bricklet_voltage_current_v2.rb +18 -0
- data/lib/tinderfridge/devices/bricklet_xmc1400_breakout/bricklet_xmc1400_breakout.json +10 -0
- data/lib/tinderfridge/ip_connection.rb +51 -4
- data/lib/tinderfridge/tinkerforge.rb +3 -0
- data/lib/tinderfridge/version.rb +1 -1
- metadata +110 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26a171ddfc01502cca8300d445d498c960b8cfb1304e1b60fddc5d33ad0a68ba
|
4
|
+
data.tar.gz: ebf5e97bd0fe072375c6a548615baff3e42ef77432b96373035571a41897ba8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5a6e8d3f54c3955afbbce8d48c1ded48ea46535dd078cc6118d207bf988634c7e04fbcab178a5b440ea5ff55798287df53f94465a06e0971a5d0282876f532f
|
7
|
+
data.tar.gz: 31d5cbea577e5b98279279193301e2a95062db29d7150149c3035ecb639f4301ce739854927f018fa922a9630bea7217c76dfb0329ccc5e88359b73f7c4fc7fe
|
data/lib/tinderfridge/device.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'tinkerforge/ip_connection'
|
2
2
|
|
3
3
|
module Tinkerforge
|
4
|
+
|
4
5
|
class Device
|
5
6
|
|
6
7
|
#----------------------------------------------------------------------#
|
@@ -41,7 +42,7 @@ module Tinkerforge
|
|
41
42
|
def inherited(klass)
|
42
43
|
if info = Tinkerforge.device_info(klass)
|
43
44
|
begin
|
44
|
-
require("tinderfridge/devices/#{info[2][1]}")
|
45
|
+
require("tinderfridge/devices/#{info[2][1]}/#{info[2][1]}")
|
45
46
|
rescue LoadError
|
46
47
|
# No extension found for this device
|
47
48
|
end
|
@@ -81,32 +82,85 @@ module Tinkerforge
|
|
81
82
|
"%s (%s@%s:%s)" % [self.class, @uid_string, ipcon.host, ipcon.port]
|
82
83
|
end
|
83
84
|
|
85
|
+
# Returns the device's properties.
|
86
|
+
def properties
|
87
|
+
@properties ||= {
|
88
|
+
'device_identifier' => device_identifier,
|
89
|
+
'device_display_name' => device_display_name,
|
90
|
+
}.merge load_properties
|
91
|
+
end
|
92
|
+
|
93
|
+
alias props properties
|
94
|
+
|
84
95
|
# Returns the device's state.
|
85
96
|
def state
|
97
|
+
|
98
|
+
# BrickDaemon inherits from Device, but has no #get_identity.
|
99
|
+
return {} unless respond_to? 'get_identity'
|
100
|
+
|
86
101
|
identity = get_identity
|
87
102
|
|
88
103
|
[
|
89
104
|
[ 'uid' , uid_string ],
|
90
105
|
[ 'update_time' , Time.now.gmtime ],
|
91
|
-
[ 'device_identifier' , device_identifier ],
|
92
|
-
[ 'device_display_name', device_display_name ],
|
93
106
|
[ 'firmware_version' , identity[4].join('.') ],
|
94
107
|
|
95
108
|
[ 'connected', { 'uid' => identity[1], 'position' => identity[2] } ],
|
96
109
|
[ 'ipcon' , { 'host' => ipcon.host , 'port' => ipcon.port } ],
|
97
110
|
|
98
111
|
respond_to?('get_chip_temperature' ) ? [ 'chip_temperature' , get_chip_temperature ] : nil,
|
99
|
-
|
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
|
+
|
100
119
|
respond_to?('get_status_led_config' ) ? [ 'status_led_config' , get_status_led_config ] : nil,
|
101
120
|
|
102
121
|
].compact.to_h
|
103
122
|
end
|
104
123
|
|
124
|
+
# Opens the online documentation for the device (Mac OS only).
|
125
|
+
#
|
126
|
+
# When the URL for the documentation is not known, does nothing.
|
127
|
+
def open_documentation
|
128
|
+
if properties['documentation_en_url'] and ( RUBY_PLATFORM =~ /darwin/ )
|
129
|
+
`open #{properties['documentation_en_url']}`
|
130
|
+
properties['documentation_en_url']
|
131
|
+
else
|
132
|
+
nil
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
alias doc open_documentation
|
137
|
+
|
105
138
|
# Identifies a Tinkerforge device by blinking its status led.
|
106
139
|
#
|
107
|
-
# Supports recent devices. When invoked on older devices, does nothing.
|
140
|
+
# Supports recent devices. When invoked on some older devices, does nothing.
|
108
141
|
def identify(seconds=10)
|
109
|
-
|
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
|
110
164
|
seconds = seconds.to_i
|
111
165
|
state = get_status_led_config
|
112
166
|
|
@@ -122,5 +176,46 @@ module Tinkerforge
|
|
122
176
|
end
|
123
177
|
end
|
124
178
|
|
179
|
+
private
|
180
|
+
|
181
|
+
def load_properties
|
182
|
+
if device_info
|
183
|
+
properties_file = File.join(
|
184
|
+
File.dirname(__FILE__),
|
185
|
+
'devices',
|
186
|
+
device_info[2][1],
|
187
|
+
device_info[2][1],
|
188
|
+
) + '.json'
|
189
|
+
|
190
|
+
if File.readable? properties_file
|
191
|
+
begin
|
192
|
+
require 'json'
|
193
|
+
JSON.load File.read properties_file
|
194
|
+
rescue
|
195
|
+
{}
|
196
|
+
end
|
197
|
+
else
|
198
|
+
{}
|
199
|
+
end
|
200
|
+
else
|
201
|
+
{}
|
202
|
+
end
|
203
|
+
end
|
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
|
+
|
125
219
|
end
|
220
|
+
|
126
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
|
@@ -63,11 +65,27 @@ module Tinkerforge
|
|
63
65
|
end.size
|
64
66
|
end
|
65
67
|
|
68
|
+
# Returns the properties of devices in the collection.
|
69
|
+
def properties
|
70
|
+
smap 'properties'
|
71
|
+
end
|
72
|
+
|
73
|
+
alias props properties
|
74
|
+
|
66
75
|
# Returns the state of devices in the collection.
|
67
76
|
def state
|
68
77
|
smap 'state'
|
69
78
|
end
|
70
79
|
|
80
|
+
# Opens the online documentation for the devices in the collection (Mac OS only).
|
81
|
+
#
|
82
|
+
# When the URL for a device's documentation is not known, does nothing.
|
83
|
+
def open_documentation
|
84
|
+
smap 'open_documentation'
|
85
|
+
end
|
86
|
+
|
87
|
+
alias doc open_documentation
|
88
|
+
|
71
89
|
# Turns off light sources such as screens and RGB LEDs for devices in the collection.
|
72
90
|
#
|
73
91
|
# Ignores devices that do not support the blackout method.
|
@@ -119,7 +137,7 @@ module Tinkerforge
|
|
119
137
|
private
|
120
138
|
|
121
139
|
def smap(m)
|
122
|
-
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
|
123
141
|
end
|
124
142
|
|
125
143
|
end
|
@@ -139,3 +139,6 @@
|
|
139
139
|
2157 Servo Bricklet 2.0 Tinkerforge::BrickletServoV2 bricklet_servo_v2
|
140
140
|
2161 IMU Bricklet 3.0 Tinkerforge::BrickletIMUV3 bricklet_imu_v3
|
141
141
|
2162 Industrial Dual AC Relay Bricklet Tinkerforge::BrickletIndustrialDualACRelay bricklet_industrial_dual_ac_relay
|
142
|
+
2164 Industrial PTC Bricklet Tinkerforge::BrickletIndustrialPTC bricklet_industrial_ptc
|
143
|
+
2165 DC Bricklet 2.0 Tinkerforge::BrickletDCV2 bricklet_dc_v2
|
144
|
+
2166 Silent Stepper Bricklet 2.0 Tinkerforge::BrickletSilentStepperV2 bricklet_silent_stepper_v2
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -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
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Tinkerforge
|
2
|
+
|
3
|
+
class BrickletColorV2
|
4
|
+
|
5
|
+
GAINS = [1, 4, 16, 60]
|
6
|
+
INTEGRATION_TIMES = [2.4, 24, 101, 154, 700]
|
7
|
+
|
8
|
+
# Switches off the Bricklet's white LED.
|
9
|
+
def blackout
|
10
|
+
set_light false
|
11
|
+
true
|
12
|
+
end
|
13
|
+
|
14
|
+
# Returns the device's state.
|
15
|
+
def state
|
16
|
+
super.merge(
|
17
|
+
'configuration' => config = get_configuration,
|
18
|
+
'gain' => GAINS[ config[0] ],
|
19
|
+
'integration_time' => INTEGRATION_TIMES[ config[1] ],
|
20
|
+
'color_rgbc' => color = get_color,
|
21
|
+
'illuminance_raw' => illum = get_illuminance,
|
22
|
+
'illuminance' => illum * 700.0 / GAINS[ config[0] ] / INTEGRATION_TIMES[ config[1] ],
|
23
|
+
'color_temperature' => get_color_temperature,
|
24
|
+
'saturated' => color[0,3].include?(65535),
|
25
|
+
'light' => get_light,
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
File without changes
|
@@ -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
|
22
|
+
if fix?
|
10
23
|
c = get_coordinates
|
11
24
|
[
|
12
25
|
c[0] / (c[1] == 'N' ? 1000000.0 : -1000000.0),
|
@@ -0,0 +1,11 @@
|
|
1
|
+
{
|
2
|
+
"dimensions": [
|
3
|
+
40,
|
4
|
+
40,
|
5
|
+
11
|
6
|
+
],
|
7
|
+
"weight": 9,
|
8
|
+
"documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Analog_Out_V2.html",
|
9
|
+
"versions_identifier": "bricklets:industrial_analog_out_v2",
|
10
|
+
"released": "2018-09-27"
|
11
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
{
|
2
|
+
"dimensions": [
|
3
|
+
40,
|
4
|
+
40,
|
5
|
+
11
|
6
|
+
],
|
7
|
+
"weight": 8.6,
|
8
|
+
"documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Digital_In_4_V2.html",
|
9
|
+
"versions_identifier": "bricklets:industrial_digital_in_4_v2",
|
10
|
+
"released": "2018-06-07"
|
11
|
+
}
|