tinderfridge 0.10.0 → 0.11.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 +1 -1
- data/lib/tinderfridge/device_info.txt +3 -0
- data/lib/tinderfridge/devices/brick_esp32/brick_esp32.json +11 -0
- data/lib/tinderfridge/devices/brick_esp32/brick_esp32.rb +13 -0
- data/lib/tinderfridge/devices/brick_esp32_ethernet/brick_esp32_ethernet.json +11 -0
- data/lib/tinderfridge/devices/brick_esp32_ethernet/brick_esp32_ethernet.rb +13 -0
- data/lib/tinderfridge/devices/brick_hat/brick_hat.rb +12 -0
- data/lib/tinderfridge/devices/brick_hat_zero/brick_hat_zero.rb +10 -0
- data/lib/tinderfridge/devices/bricklet_barometer_v2/bricklet_barometer_v2.rb +30 -0
- data/lib/tinderfridge/devices/bricklet_co2_v2/bricklet_co2_v2.rb +10 -0
- data/lib/tinderfridge/devices/bricklet_gps_v2/bricklet_gps_v2.rb +7 -0
- data/lib/tinderfridge/devices/bricklet_gps_v3/bricklet_gps_v3.json +4 -0
- data/lib/tinderfridge/devices/bricklet_lcd_128x64/bricklet_lcd_128x64.rb +37 -0
- data/lib/tinderfridge/devices/bricklet_oled_128x64_v2/bricklet_oled_128x64_v2.rb +15 -0
- data/lib/tinderfridge/devices/bricklet_outdoor_weather/bricklet_outdoor_weather.rb +9 -0
- data/lib/tinderfridge/devices/bricklet_temperature_v2/bricklet_temperature_v2.rb +27 -0
- data/lib/tinderfridge/version.rb +1 -1
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1c28bf9d30fc0a07640bc0455e0c79625d9c83891eff91d8e6e4227780c57d3
|
4
|
+
data.tar.gz: cb7039e16d274378b77af9c065e74ff0ad2ebd07450df034893d04144c5b5302
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3311ac8e16a9233ae652ae8caf50aca8ebe6fa48ba8f0079764da55a8234542d57044ab52c2d7a6358fe22fb57e771c4cef8777e772dff3ad78da1e0e86ba989
|
7
|
+
data.tar.gz: 466bc1054d70689af056866a5d784050d6731d71fc711937a59e8a053bc7f17335eee594034f241282f918d773237d401486f62cef209d173e37eb95b559e105
|
data/lib/tinderfridge/device.rb
CHANGED
@@ -79,7 +79,7 @@ module Tinkerforge
|
|
79
79
|
|
80
80
|
# Returns a programmer-friendly representation of the device.
|
81
81
|
def inspect
|
82
|
-
"%s (%s@%s:%s)" % [self.class,
|
82
|
+
"%s (%s@%s:%s)" % [self.class, uid_string, ipcon.host, ipcon.port]
|
83
83
|
end
|
84
84
|
|
85
85
|
# Returns the device's properties.
|
@@ -16,6 +16,8 @@
|
|
16
16
|
29 IO-4 Bricklet Tinkerforge::BrickletIO4 bricklet_io4
|
17
17
|
111 HAT Brick Tinkerforge::BrickHAT brick_hat
|
18
18
|
112 HAT Zero Brick Tinkerforge::BrickHATZero brick_hat_zero
|
19
|
+
113 ESP32 Brick Tinkerforge::BrickESP32 brick_esp32
|
20
|
+
115 ESP32 Ethernet Brick Tinkerforge::BrickESP32Ethernet brick_esp32_ethernet
|
19
21
|
210 Joystick Bricklet Tinkerforge::BrickletJoystick bricklet_joystick
|
20
22
|
211 LCD 16x2 Bricklet Tinkerforge::BrickletLCD16x2 bricklet_lcd_16x2
|
21
23
|
212 LCD 20x4 Bricklet Tinkerforge::BrickletLCD20x4 bricklet_lcd_20x4
|
@@ -142,3 +144,4 @@
|
|
142
144
|
2164 Industrial PTC Bricklet Tinkerforge::BrickletIndustrialPTC bricklet_industrial_ptc
|
143
145
|
2165 DC Bricklet 2.0 Tinkerforge::BrickletDCV2 bricklet_dc_v2
|
144
146
|
2166 Silent Stepper Bricklet 2.0 Tinkerforge::BrickletSilentStepperV2 bricklet_silent_stepper_v2
|
147
|
+
2171 GPS Bricklet 3.0 Tinkerforge::BrickletGPSV3 bricklet_gps_v3
|
@@ -13,6 +13,18 @@ module Tinkerforge
|
|
13
13
|
)
|
14
14
|
end
|
15
15
|
|
16
|
+
private
|
17
|
+
|
18
|
+
def _view_21x8
|
19
|
+
volts = get_voltages
|
20
|
+
<<~ET
|
21
|
+
HAT #{uid_string.rjust 8}
|
22
|
+
|
23
|
+
USB #{'%5.2f V' % [volts[0]*0.001]}
|
24
|
+
DC #{'%5.2f V' % [volts[1]*0.001]}
|
25
|
+
ET
|
26
|
+
end
|
27
|
+
|
16
28
|
end
|
17
29
|
|
18
30
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Tinkerforge
|
2
|
+
|
3
|
+
class BrickletBarometerV2
|
4
|
+
|
5
|
+
# Returns the device's state.
|
6
|
+
def state
|
7
|
+
super.merge(
|
8
|
+
'air_pressure' => get_air_pressure,
|
9
|
+
'calibration' => get_calibration,
|
10
|
+
'altitude' => get_altitude,
|
11
|
+
'reference_air_pressure' => get_reference_air_pressure,
|
12
|
+
'temperature' => get_temperature,
|
13
|
+
'moving_average_configuration' => get_moving_average_configuration,
|
14
|
+
'sensor_configuration' => get_sensor_configuration,
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def _view_21x8
|
21
|
+
<<~ET
|
22
|
+
Baro #{uid_string.rjust 8}
|
23
|
+
|
24
|
+
#{'%7.2f hPa' % [get_air_pressure*0.001]}
|
25
|
+
ET
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -72,6 +72,43 @@ module Tinkerforge
|
|
72
72
|
)
|
73
73
|
end
|
74
74
|
|
75
|
+
# Clears the display and prints upto 8 lines of text.
|
76
|
+
#
|
77
|
+
# Text may contain newline characters to separate lines.
|
78
|
+
# Lines longer than 21 characters will be wrapped.
|
79
|
+
#
|
80
|
+
# Text is automatically encoded in the IBM437 character set.
|
81
|
+
# @example
|
82
|
+
# my_lcd.put_screen "Hello, World!\n\nRuby #{RUBY_VERSION}"
|
83
|
+
def put_screen(text='', test: false)
|
84
|
+
lines = text.split("\n")
|
85
|
+
lines = lines.map { |s| s.empty? ? '' : s.scan(/.{1,21}/) }.flatten
|
86
|
+
lines = lines[0,8].map { |l| encode l }
|
87
|
+
|
88
|
+
return lines if test
|
89
|
+
|
90
|
+
clear
|
91
|
+
lines.each_with_index do |s,l|
|
92
|
+
write_line l, 0, s
|
93
|
+
end
|
94
|
+
nil
|
95
|
+
end
|
96
|
+
|
97
|
+
# Shows an object.
|
98
|
+
def show(object)
|
99
|
+
if object.respond_to?( :_view_21x8, true)
|
100
|
+
put_screen ( object.send(:_view_21x8) rescue "21x8 view error\n\n#{object.class.to_s}" )
|
101
|
+
elsif
|
102
|
+
put_screen object.inspect[0,168]
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
private
|
107
|
+
|
108
|
+
def _view_21x8
|
109
|
+
"LCD #{uid_string.rjust 8}"
|
110
|
+
end
|
111
|
+
|
75
112
|
end
|
76
113
|
|
77
114
|
end
|
@@ -74,6 +74,21 @@ module Tinkerforge
|
|
74
74
|
nil
|
75
75
|
end
|
76
76
|
|
77
|
+
# Shows an object.
|
78
|
+
def show(object)
|
79
|
+
if object.respond_to?( :_view_21x8, true)
|
80
|
+
put_screen ( object.send(:_view_21x8) rescue "21x8 view error\n\n#{object.class.to_s}" )
|
81
|
+
elsif
|
82
|
+
put_screen object.inspect[0,168]
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
def _view_21x8
|
89
|
+
"OLED #{uid_string.rjust 8}"
|
90
|
+
end
|
91
|
+
|
77
92
|
end
|
78
93
|
|
79
94
|
end
|
@@ -14,6 +14,15 @@ module Tinkerforge
|
|
14
14
|
end.to_h
|
15
15
|
end
|
16
16
|
|
17
|
+
private
|
18
|
+
|
19
|
+
def _view_21x8
|
20
|
+
"Weather #{uid_string.rjust 8}\n\n" +
|
21
|
+
sensors.first(6).map do |k,v|
|
22
|
+
%Q(#{v[2] > 100 ? '?' : ' '} %3d %4.1f °C %2d %%\n) % [k,v].flatten
|
23
|
+
end.join
|
24
|
+
end
|
25
|
+
|
17
26
|
end
|
18
27
|
|
19
28
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Tinkerforge
|
2
|
+
|
3
|
+
class BrickletTemperatureV2
|
4
|
+
|
5
|
+
# Returns the device's state.
|
6
|
+
def state
|
7
|
+
super.merge(
|
8
|
+
'temperature' => get_temperature,
|
9
|
+
'heater_configuration' => get_heater_configuration,
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def _view_21x8
|
16
|
+
<<~ET
|
17
|
+
Temp #{uid_string.rjust 8}
|
18
|
+
|
19
|
+
#{'%6.2f °C' % [get_temperature*0.01]}
|
20
|
+
|
21
|
+
#{get_heater_configuration == 1 ? 'HEATER' : ''}
|
22
|
+
ET
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/lib/tinderfridge/version.rb
CHANGED
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.
|
4
|
+
version: 0.11.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: 2022-
|
11
|
+
date: 2022-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tinkerforge
|
@@ -41,6 +41,10 @@ files:
|
|
41
41
|
- lib/tinderfridge/device_collection.rb
|
42
42
|
- lib/tinderfridge/device_info.rb
|
43
43
|
- lib/tinderfridge/device_info.txt
|
44
|
+
- lib/tinderfridge/devices/brick_esp32/brick_esp32.json
|
45
|
+
- lib/tinderfridge/devices/brick_esp32/brick_esp32.rb
|
46
|
+
- lib/tinderfridge/devices/brick_esp32_ethernet/brick_esp32_ethernet.json
|
47
|
+
- lib/tinderfridge/devices/brick_esp32_ethernet/brick_esp32_ethernet.rb
|
44
48
|
- lib/tinderfridge/devices/brick_hat/brick_hat.json
|
45
49
|
- lib/tinderfridge/devices/brick_hat/brick_hat.rb
|
46
50
|
- lib/tinderfridge/devices/brick_hat_zero/brick_hat_zero.json
|
@@ -55,6 +59,7 @@ files:
|
|
55
59
|
- lib/tinderfridge/devices/bricklet_analog_in_v3/bricklet_analog_in_v3.json
|
56
60
|
- lib/tinderfridge/devices/bricklet_analog_out_v3/bricklet_analog_out_v3.json
|
57
61
|
- lib/tinderfridge/devices/bricklet_barometer_v2/bricklet_barometer_v2.json
|
62
|
+
- lib/tinderfridge/devices/bricklet_barometer_v2/bricklet_barometer_v2.rb
|
58
63
|
- lib/tinderfridge/devices/bricklet_can_v2/bricklet_can_v2.json
|
59
64
|
- lib/tinderfridge/devices/bricklet_co2_v2/bricklet_co2_v2.json
|
60
65
|
- lib/tinderfridge/devices/bricklet_co2_v2/bricklet_co2_v2.rb
|
@@ -71,6 +76,7 @@ files:
|
|
71
76
|
- lib/tinderfridge/devices/bricklet_energy_monitor/bricklet_energy_monitor.json
|
72
77
|
- lib/tinderfridge/devices/bricklet_gps_v2/bricklet_gps_v2.json
|
73
78
|
- lib/tinderfridge/devices/bricklet_gps_v2/bricklet_gps_v2.rb
|
79
|
+
- lib/tinderfridge/devices/bricklet_gps_v3/bricklet_gps_v3.json
|
74
80
|
- lib/tinderfridge/devices/bricklet_hall_effect_v2/bricklet_hall_effect_v2.json
|
75
81
|
- lib/tinderfridge/devices/bricklet_hall_effect_v2/bricklet_hall_effect_v2.rb
|
76
82
|
- lib/tinderfridge/devices/bricklet_humidity_v2/bricklet_humidity_v2.json
|
@@ -138,6 +144,7 @@ files:
|
|
138
144
|
- lib/tinderfridge/devices/bricklet_temperature_ir_v2/bricklet_temperature_ir_v2.json
|
139
145
|
- lib/tinderfridge/devices/bricklet_temperature_ir_v2/bricklet_temperature_ir_v2.rb
|
140
146
|
- lib/tinderfridge/devices/bricklet_temperature_v2/bricklet_temperature_v2.json
|
147
|
+
- lib/tinderfridge/devices/bricklet_temperature_v2/bricklet_temperature_v2.rb
|
141
148
|
- lib/tinderfridge/devices/bricklet_thermal_imaging/bricklet_thermal_imaging.json
|
142
149
|
- lib/tinderfridge/devices/bricklet_thermocouple_v2/bricklet_thermocouple_v2.json
|
143
150
|
- lib/tinderfridge/devices/bricklet_uv_light_v2/bricklet_uv_light_v2.json
|
@@ -170,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
177
|
- !ruby/object:Gem::Version
|
171
178
|
version: '0'
|
172
179
|
requirements: []
|
173
|
-
rubygems_version: 3.
|
180
|
+
rubygems_version: 3.3.11
|
174
181
|
signing_key:
|
175
182
|
specification_version: 4
|
176
183
|
summary: Extending Tinkerforge in fun and useful ways.
|