tinderfridge 0.15.0 → 0.17.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 +4 -4
- data/lib/tinderfridge/device/configuration.rb +44 -0
- data/lib/tinderfridge/device.rb +2 -12
- data/lib/tinderfridge/device_collection.rb +17 -8
- data/lib/tinderfridge/device_info.txt +1 -0
- data/lib/tinderfridge/devices/bricklet_ambient_light_v3/bricklet_ambient_light_v3.rb +6 -0
- data/lib/tinderfridge/devices/bricklet_barometer_v2/bricklet_barometer_v2.rb +6 -0
- data/lib/tinderfridge/devices/bricklet_gps_v2/bricklet_gps_v2.rb +3 -52
- data/lib/tinderfridge/devices/bricklet_gps_v3/bricklet_gps_v3.rb +3 -52
- data/lib/tinderfridge/devices/bricklet_industrial_dual_ac_in/bricklet_industrial_dual_ac_in.json +11 -0
- data/lib/tinderfridge/devices/bricklet_industrial_dual_relay/bricklet_industrial_dual_relay.rb +8 -0
- data/lib/tinderfridge/devices/bricklet_led_strip_v2/bricklet_led_strip_v2.rb +22 -0
- data/lib/tinderfridge/devices/bricklet_motion_detector_v2/bricklet_motion_detector_v2.rb +8 -0
- data/lib/tinderfridge/devices/bricklet_outdoor_weather/bricklet_outdoor_weather.rb +2 -2
- data/lib/tinderfridge/devices/bricklet_particulate_matter/bricklet_particulate_matter.rb +6 -0
- data/lib/tinderfridge/devices/bricklet_rgb_led_button/bricklet_rgb_led_button.rb +8 -0
- data/lib/tinderfridge/devices/bricklet_segment_display_4x7_v2/bricklet_segment_display_4x7_v2.rb +9 -1
- data/lib/tinderfridge/ip_connection.rb +5 -4
- data/lib/tinderfridge/shared/gps.rb +68 -0
- data/lib/tinderfridge/shared/logger.rb +34 -19
- data/lib/tinderfridge/version.rb +1 -1
- data/lib/tinderfridge.rb +6 -15
- metadata +8 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d72a23621805a4527cf80a4e35d0ad49fff4cb362a94fe1e916a36130f5fe844
|
|
4
|
+
data.tar.gz: 8e5422de11c1e78dcedfe354fbd35829bf2f09254c33363040091e83d595cc6c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 576e9b5d51bc93fee968f6a0788dd5bb71c451b0b5e4860f789e1603b1d2ce98cf48e0e8d7825ede45ae4510b3b15c54920f18eb153d21fc1d3424e6f5f1f06a
|
|
7
|
+
data.tar.gz: 908a10df2b8722fad35b5caf3e243c4d202658f2fe9a53575a59b905cb6e61962dcf1a46b8b5a6b0995f9decb7ad7606fff5ab1b7442ad747d46010500a72189
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module Tinkerforge
|
|
2
|
+
class Device
|
|
3
|
+
|
|
4
|
+
# Returns settings for the device (a mutable Hash).
|
|
5
|
+
def settings
|
|
6
|
+
@settings ||= {}
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
alias config settings
|
|
10
|
+
|
|
11
|
+
# Defines settings for the device (a Hash).
|
|
12
|
+
def settings=(settings_hash)
|
|
13
|
+
raise(ArgumentError, 'Invalid settings') unless settings_hash.class == Hash
|
|
14
|
+
@settings = settings_hash
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
alias config= settings=
|
|
18
|
+
|
|
19
|
+
# Configures the device by applying settings.
|
|
20
|
+
def configure
|
|
21
|
+
if settings.any?
|
|
22
|
+
logger_debug "Configuring #{settings.keys.map(&:to_s).join(', ')}"
|
|
23
|
+
case status_led_api_variety
|
|
24
|
+
when 2
|
|
25
|
+
if settings.has_key? 'status_led_config'
|
|
26
|
+
set_status_led_config settings['status_led_config'].to_i
|
|
27
|
+
end
|
|
28
|
+
when 1
|
|
29
|
+
if settings.has_key? 'status_led_enabled'
|
|
30
|
+
if !!settings['status_led_enabled']
|
|
31
|
+
enable_status_led
|
|
32
|
+
else
|
|
33
|
+
disable_status_led
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
if respond_to?(:custom_configure, true)
|
|
38
|
+
custom_configure
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
end
|
|
44
|
+
end
|
data/lib/tinderfridge/device.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'tinkerforge/ip_connection'
|
|
2
2
|
require 'tinderfridge/shared/logger'
|
|
3
|
+
require 'tinderfridge/device/configuration'
|
|
3
4
|
|
|
4
5
|
module Tinkerforge
|
|
5
6
|
|
|
@@ -76,7 +77,7 @@ module Tinkerforge
|
|
|
76
77
|
def initialize(uid, ipcon, device_identifier, device_display_name)
|
|
77
78
|
original_initialize(uid, ipcon, device_identifier, device_display_name)
|
|
78
79
|
if respond_to? 'get_identity'
|
|
79
|
-
logger_debug "Created
|
|
80
|
+
logger_debug "Created #{self.class}"
|
|
80
81
|
end
|
|
81
82
|
end
|
|
82
83
|
|
|
@@ -141,17 +142,6 @@ module Tinkerforge
|
|
|
141
142
|
].compact.to_h
|
|
142
143
|
end
|
|
143
144
|
|
|
144
|
-
# Returns configuration data for the device (a mutable Hash).
|
|
145
|
-
def config
|
|
146
|
-
@config ||= {}
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
# Sets configuration data (a Hash) for the device.
|
|
150
|
-
def config=(configuration)
|
|
151
|
-
raise(ArgumentError, 'Invalid configuration') unless configuration.class == Hash
|
|
152
|
-
@config = configuration
|
|
153
|
-
end
|
|
154
|
-
|
|
155
145
|
# Opens the online documentation for the device (Mac OS only).
|
|
156
146
|
#
|
|
157
147
|
# When the URL for the documentation is not known, does nothing.
|
|
@@ -79,21 +79,30 @@ module Tinkerforge
|
|
|
79
79
|
smap 'state'
|
|
80
80
|
end
|
|
81
81
|
|
|
82
|
-
# Returns
|
|
83
|
-
def
|
|
84
|
-
smap '
|
|
82
|
+
# Returns settings for the devices in the collection.
|
|
83
|
+
def settings
|
|
84
|
+
smap 'settings'
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
alias config settings
|
|
88
|
+
|
|
89
|
+
# Defines settings for the devices in the collection.
|
|
90
|
+
def settings=(settings_hash)
|
|
91
|
+
raise ArgumentError, 'invalid settings' unless (settings_hash.class == Hash)
|
|
90
92
|
each do |k,v|
|
|
91
|
-
if
|
|
92
|
-
v.
|
|
93
|
+
if settings_hash[k]
|
|
94
|
+
v.settings = settings_hash[k]
|
|
93
95
|
end
|
|
94
96
|
end
|
|
95
97
|
end
|
|
96
98
|
|
|
99
|
+
alias config= settings=
|
|
100
|
+
|
|
101
|
+
# Configures the devices in the collection by applying settings.
|
|
102
|
+
def configure
|
|
103
|
+
smap 'configure'
|
|
104
|
+
end
|
|
105
|
+
|
|
97
106
|
# Opens the online documentation for the devices in the collection (Mac OS only).
|
|
98
107
|
#
|
|
99
108
|
# When the URL for a device's documentation is not known, does nothing.
|
|
@@ -145,3 +145,4 @@
|
|
|
145
145
|
2165 DC Bricklet 2.0 Tinkerforge::BrickletDCV2 bricklet_dc_v2
|
|
146
146
|
2166 Silent Stepper Bricklet 2.0 Tinkerforge::BrickletSilentStepperV2 bricklet_silent_stepper_v2
|
|
147
147
|
2171 GPS Bricklet 3.0 Tinkerforge::BrickletGPSV3 bricklet_gps_v3
|
|
148
|
+
2174 Industrial Dual AC In Bricklet Tinkerforge::BrickletIndustrialDualACIn bricklet_industrial_dual_ac_in
|
|
@@ -17,6 +17,12 @@ module Tinkerforge
|
|
|
17
17
|
|
|
18
18
|
private
|
|
19
19
|
|
|
20
|
+
def custom_configure
|
|
21
|
+
if settings.has_key? 'sensor_configuration'
|
|
22
|
+
set_sensor_configuration *settings['sensor_configuration']
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
20
26
|
def _view_21x8
|
|
21
27
|
"BaroV2 #{uid_string.rjust 8}\n\n\n" +
|
|
22
28
|
('%.2f hPa' % [get_air_pressure*0.001]).center(21)
|
|
@@ -1,58 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
require 'tinderfridge/shared/gps'
|
|
2
2
|
|
|
3
|
+
module Tinkerforge
|
|
3
4
|
class BrickletGPSV2
|
|
4
5
|
|
|
5
|
-
|
|
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
|
-
|
|
18
|
-
# Returns latitude and longitude as reported by the GPS Bricklet.
|
|
19
|
-
#
|
|
20
|
-
# Nil when there is no fix (position not determined).
|
|
21
|
-
def coordinates
|
|
22
|
-
if fix?
|
|
23
|
-
c = get_coordinates
|
|
24
|
-
[
|
|
25
|
-
c[0] / (c[1] == 'N' ? 1000000.0 : -1000000.0),
|
|
26
|
-
c[2] / (c[3] == 'E' ? 1000000.0 : -1000000.0)
|
|
27
|
-
]
|
|
28
|
-
else
|
|
29
|
-
nil
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# Returns a Time object representing the time as reported by the GPS Bricklet.
|
|
34
|
-
def time
|
|
35
|
-
# FIXME: This will not work after 31-Dec-2099.
|
|
36
|
-
dt = get_date_time.map &:to_s
|
|
37
|
-
dt = dt[0].rjust(6,'0').unpack('a2a2a2').reverse + dt[1].rjust(9,'0').concat('000').unpack('a2a2a2a6')
|
|
38
|
-
dt[0].prepend '20'
|
|
39
|
-
Time.gm *dt.map(&:to_i)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
# Returns a URL for viewing the current coordinates on OpenStreetMap.
|
|
43
|
-
def openstreetmap_marker_url(zoom=12)
|
|
44
|
-
if c = coordinates
|
|
45
|
-
"https://www.openstreetmap.org/?mlat=%f&mlon=%f&zoom=%d" % [c, zoom].flatten
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
private
|
|
50
|
-
|
|
51
|
-
def _view_21x8
|
|
52
|
-
"GPSV2 #{uid_string.rjust 8}\n\n" +
|
|
53
|
-
((c = coordinates) ? (" Lat %10.5f\n Lon %10.5f" % c) : ' no fix')
|
|
54
|
-
end
|
|
6
|
+
include Tinkerforge::Shared::GPS
|
|
55
7
|
|
|
56
8
|
end
|
|
57
|
-
|
|
58
9
|
end
|
|
@@ -1,58 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
require 'tinderfridge/shared/gps'
|
|
2
2
|
|
|
3
|
+
module Tinkerforge
|
|
3
4
|
class BrickletGPSV3
|
|
4
5
|
|
|
5
|
-
|
|
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
|
-
|
|
18
|
-
# Returns latitude and longitude as reported by the GPS Bricklet.
|
|
19
|
-
#
|
|
20
|
-
# Nil when there is no fix (position not determined).
|
|
21
|
-
def coordinates
|
|
22
|
-
if fix?
|
|
23
|
-
c = get_coordinates
|
|
24
|
-
[
|
|
25
|
-
c[0] / (c[1] == 'N' ? 1000000.0 : -1000000.0),
|
|
26
|
-
c[2] / (c[3] == 'E' ? 1000000.0 : -1000000.0)
|
|
27
|
-
]
|
|
28
|
-
else
|
|
29
|
-
nil
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# Returns a Time object representing the time as reported by the GPS Bricklet.
|
|
34
|
-
def time
|
|
35
|
-
# FIXME: This will not work after 31-Dec-2099.
|
|
36
|
-
dt = get_date_time.map &:to_s
|
|
37
|
-
dt = dt[0].rjust(6,'0').unpack('a2a2a2').reverse + dt[1].rjust(9,'0').concat('000').unpack('a2a2a2a6')
|
|
38
|
-
dt[0].prepend '20'
|
|
39
|
-
Time.gm *dt.map(&:to_i)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
# Returns a URL for viewing the current coordinates on OpenStreetMap.
|
|
43
|
-
def openstreetmap_marker_url(zoom=12)
|
|
44
|
-
if c = coordinates
|
|
45
|
-
"https://www.openstreetmap.org/?mlat=%f&mlon=%f&zoom=%d" % [c, zoom].flatten
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
private
|
|
50
|
-
|
|
51
|
-
def _view_21x8
|
|
52
|
-
"GPSV3 #{uid_string.rjust 8}\n\n" +
|
|
53
|
-
((c = coordinates) ? (" Lat %10.5f\n Lon %10.5f" % c) : ' no fix')
|
|
54
|
-
end
|
|
6
|
+
include Tinkerforge::Shared::GPS
|
|
55
7
|
|
|
56
8
|
end
|
|
57
|
-
|
|
58
9
|
end
|
data/lib/tinderfridge/devices/bricklet_industrial_dual_ac_in/bricklet_industrial_dual_ac_in.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dimensions": [
|
|
3
|
+
40,
|
|
4
|
+
40,
|
|
5
|
+
16
|
|
6
|
+
],
|
|
7
|
+
"weight": 29,
|
|
8
|
+
"documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Dual_AC_In.html",
|
|
9
|
+
"versions_identifier": "bricklets:industrial_dual_ac_in",
|
|
10
|
+
"released": "2023-05-12"
|
|
11
|
+
}
|
|
@@ -34,6 +34,28 @@ module Tinkerforge
|
|
|
34
34
|
|
|
35
35
|
private
|
|
36
36
|
|
|
37
|
+
def custom_configure
|
|
38
|
+
if settings.has_key? 'chip_type'
|
|
39
|
+
if settings['chip_type'].to_i != get_chip_type
|
|
40
|
+
set_chip_type settings['chip_type'].to_i
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
if settings.has_key? 'channel_mapping'
|
|
45
|
+
set_channel_mapping settings['channel_mapping'].to_i
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
if settings.has_key? 'frame_duration'
|
|
49
|
+
set_frame_duration settings['frame_duration'].to_i
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
if settings.has_key? 'clock_frequency'
|
|
53
|
+
if settings['clock_frequency'].to_i != get_clock_frequency
|
|
54
|
+
set_clock_frequency settings['clock_frequency'].to_i
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
37
59
|
def lookup_channel_mapping(selector=nil)
|
|
38
60
|
@@channel_mapping_table ||= self.class.constants.map do |c|
|
|
39
61
|
(c.to_s =~ /^CHANNEL_MAPPING_(\w{3,4})$/ ) ? [self.class.const_get(c), $1] : nil
|
|
@@ -18,9 +18,9 @@ module Tinkerforge
|
|
|
18
18
|
#
|
|
19
19
|
# Sensor identifiers can be mapped to descriptive strings or other values:
|
|
20
20
|
# @example
|
|
21
|
-
# my_weather_bricklet.
|
|
21
|
+
# my_weather_bricklet.settings['sensormap'] = { 202 => 'outdoors' }
|
|
22
22
|
def sensors
|
|
23
|
-
sensormap = (
|
|
23
|
+
sensormap = (settings['sensormap'].class == Hash) ? settings['sensormap'] : {}
|
|
24
24
|
get_sensor_identifiers.map do |id|
|
|
25
25
|
[ (sensormap[id] || id), get_sensor_data(id).each_with_index.map { |v,i| i == 0 ? v/10.0 : v } ]
|
|
26
26
|
end.to_h
|
data/lib/tinderfridge/devices/bricklet_segment_display_4x7_v2/bricklet_segment_display_4x7_v2.rb
CHANGED
|
@@ -61,7 +61,7 @@ module Tinkerforge
|
|
|
61
61
|
elsif c == ':' and out.size == 16
|
|
62
62
|
colon = true
|
|
63
63
|
else
|
|
64
|
-
raise "Can not display '#{
|
|
64
|
+
raise "Can not display character '#{c}'"
|
|
65
65
|
end
|
|
66
66
|
end
|
|
67
67
|
|
|
@@ -190,6 +190,14 @@ module Tinkerforge
|
|
|
190
190
|
end
|
|
191
191
|
end
|
|
192
192
|
|
|
193
|
+
private
|
|
194
|
+
|
|
195
|
+
def custom_configure
|
|
196
|
+
if settings.has_key? 'brightness'
|
|
197
|
+
set_brightness settings['brightness'].to_i
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
|
|
193
201
|
end
|
|
194
202
|
|
|
195
203
|
end
|
|
@@ -20,9 +20,10 @@ module Tinkerforge
|
|
|
20
20
|
|
|
21
21
|
# Creates a TCP/IP connection to the given host and port. Logs events if event logging is enabled.
|
|
22
22
|
def connect(host, port)
|
|
23
|
-
logger_debug "Connecting to
|
|
23
|
+
logger_debug "Connecting to %s:%s" % [host, port]
|
|
24
|
+
ts = Time.now.to_f
|
|
24
25
|
original_connect(host, port)
|
|
25
|
-
logger_debug "Connected to
|
|
26
|
+
logger_debug "Connected to %s:%s (%5.3fs)" % [host, port, Time.now.to_f - ts]
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
alias original_disconnect disconnect
|
|
@@ -148,14 +149,14 @@ module Tinkerforge
|
|
|
148
149
|
require "tinkerforge/#{dev_info[2][1]}"
|
|
149
150
|
Tinkerforge.const_get(dev_info[2][0]).new enum_data[0], self
|
|
150
151
|
else
|
|
151
|
-
logger_warn "
|
|
152
|
+
logger_warn "[ #{enum_data[0]} ] Unknown Device Identifier: #{enum_data[5]}"
|
|
152
153
|
nil
|
|
153
154
|
end
|
|
154
155
|
end
|
|
155
156
|
|
|
156
157
|
def logger_log_enum(enum_data)
|
|
157
158
|
logger_debug(
|
|
158
|
-
"
|
|
159
|
+
"[ #{enum_data[0]} ] Device " +
|
|
159
160
|
['available', 'connected', 'disconnected'][enum_data[6]] +
|
|
160
161
|
( enum_data[6] == 2 ? '' : " (Device Identifier: #{enum_data[5]})" )
|
|
161
162
|
)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
module Tinkerforge
|
|
2
|
+
module Shared
|
|
3
|
+
|
|
4
|
+
# Mixin for GPS Bricklet versions 2 & 3.
|
|
5
|
+
module GPS
|
|
6
|
+
|
|
7
|
+
# Returns the device's state.
|
|
8
|
+
def state
|
|
9
|
+
super.merge(
|
|
10
|
+
'fix_led_config' => get_fix_led_config,
|
|
11
|
+
'fix' => fix?,
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Returns true if a fix is available.
|
|
16
|
+
def fix?
|
|
17
|
+
get_status[0]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Returns latitude and longitude as reported by the GPS Bricklet.
|
|
21
|
+
#
|
|
22
|
+
# Nil when there is no fix (position not determined).
|
|
23
|
+
def coordinates
|
|
24
|
+
if fix?
|
|
25
|
+
c = get_coordinates
|
|
26
|
+
[
|
|
27
|
+
c[0] / (c[1] == 'N' ? 1000000.0 : -1000000.0),
|
|
28
|
+
c[2] / (c[3] == 'E' ? 1000000.0 : -1000000.0)
|
|
29
|
+
]
|
|
30
|
+
else
|
|
31
|
+
nil
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Returns a Time object representing the time as reported by the GPS Bricklet.
|
|
36
|
+
def time
|
|
37
|
+
# FIXME: This will not work after 31-Dec-2099.
|
|
38
|
+
dt = get_date_time.map &:to_s
|
|
39
|
+
dt = dt[0].rjust(6,'0').unpack('a2a2a2').reverse + dt[1].rjust(9,'0').concat('000').unpack('a2a2a2a6')
|
|
40
|
+
dt[0].prepend '20'
|
|
41
|
+
Time.gm *dt.map(&:to_i)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Returns a URL for viewing the current coordinates on OpenStreetMap.
|
|
45
|
+
def openstreetmap_marker_url(zoom=12)
|
|
46
|
+
if c = coordinates
|
|
47
|
+
"https://www.openstreetmap.org/?mlat=%f&mlon=%f&zoom=%d" % [c, zoom].flatten
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
|
|
53
|
+
def custom_configure
|
|
54
|
+
if settings.has_key? 'fix_led_config'
|
|
55
|
+
set_fix_led_config settings['fix_led_config'].to_i
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def _view_21x8
|
|
60
|
+
@label21x8 ||= self.class.to_s[-5,5]
|
|
61
|
+
"#{@label21x8} #{uid_string.rjust 8}\n\n" +
|
|
62
|
+
((c = coordinates) ? (" Lat %10.5f\n Lon %10.5f" % c) : ' no fix')
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -14,33 +14,48 @@ module Tinkerforge
|
|
|
14
14
|
Tinkerforge.logger
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
def logger_debug(
|
|
18
|
-
|
|
19
|
-
logger.debug(msg)
|
|
20
|
-
end
|
|
17
|
+
def logger_debug(message='', &block)
|
|
18
|
+
logger_log(0, message, &block)
|
|
21
19
|
end
|
|
22
20
|
|
|
23
|
-
def logger_info(
|
|
24
|
-
|
|
25
|
-
logger.info(msg)
|
|
26
|
-
end
|
|
21
|
+
def logger_info(message='', &block)
|
|
22
|
+
logger_log(1, message, &block)
|
|
27
23
|
end
|
|
28
24
|
|
|
29
|
-
def logger_warn(
|
|
30
|
-
|
|
31
|
-
logger.warn(msg)
|
|
32
|
-
end
|
|
25
|
+
def logger_warn(message='', &block)
|
|
26
|
+
logger_log(2, message, &block)
|
|
33
27
|
end
|
|
34
28
|
|
|
35
|
-
def logger_error(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
def logger_error(message='', &block)
|
|
30
|
+
logger_log(3, message, &block)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def logger_fatal(message='', &block)
|
|
34
|
+
logger_log(4, message, &block)
|
|
39
35
|
end
|
|
40
36
|
|
|
41
|
-
def
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
def logger_log(level, message='', &block)
|
|
38
|
+
return unless logger
|
|
39
|
+
|
|
40
|
+
if message.empty? and block_given?
|
|
41
|
+
message = yield
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
if respond_to? 'uid_string'
|
|
45
|
+
message = "[ #{uid_string} ] #{message}"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
case level
|
|
49
|
+
when 0
|
|
50
|
+
logger.debug(message)
|
|
51
|
+
when 1
|
|
52
|
+
logger.info(message)
|
|
53
|
+
when 2
|
|
54
|
+
logger.warn(message)
|
|
55
|
+
when 3
|
|
56
|
+
logger.error(message)
|
|
57
|
+
when 4
|
|
58
|
+
logger.fatal(message)
|
|
44
59
|
end
|
|
45
60
|
end
|
|
46
61
|
|
data/lib/tinderfridge/version.rb
CHANGED
data/lib/tinderfridge.rb
CHANGED
|
@@ -2,18 +2,9 @@ if defined? Tinkerforge
|
|
|
2
2
|
raise 'Tinkerforge was already loaded, so Tinderfridge can not reliably extend it!'
|
|
3
3
|
end
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
device
|
|
12
|
-
|
|
13
|
-
tinkerforge
|
|
14
|
-
|
|
15
|
-
device_info
|
|
16
|
-
|
|
17
|
-
device_collection
|
|
18
|
-
|
|
19
|
-
).each { |m| require "tinderfridge/#{m}" }
|
|
5
|
+
require 'tinderfridge/version'
|
|
6
|
+
require 'tinderfridge/ip_connection'
|
|
7
|
+
require 'tinderfridge/device'
|
|
8
|
+
require 'tinderfridge/tinkerforge'
|
|
9
|
+
require 'tinderfridge/device_info'
|
|
10
|
+
require 'tinderfridge/device_collection'
|
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.17.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:
|
|
11
|
+
date: 2026-01-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: tinkerforge
|
|
@@ -38,6 +38,7 @@ extra_rdoc_files: []
|
|
|
38
38
|
files:
|
|
39
39
|
- lib/tinderfridge.rb
|
|
40
40
|
- lib/tinderfridge/device.rb
|
|
41
|
+
- lib/tinderfridge/device/configuration.rb
|
|
41
42
|
- lib/tinderfridge/device_collection.rb
|
|
42
43
|
- lib/tinderfridge/device_info.rb
|
|
43
44
|
- lib/tinderfridge/device_info.txt
|
|
@@ -87,6 +88,7 @@ files:
|
|
|
87
88
|
- lib/tinderfridge/devices/bricklet_industrial_digital_in_4_v2/bricklet_industrial_digital_in_4_v2.json
|
|
88
89
|
- lib/tinderfridge/devices/bricklet_industrial_digital_out_4_v2/bricklet_industrial_digital_out_4_v2.json
|
|
89
90
|
- lib/tinderfridge/devices/bricklet_industrial_dual_0_20ma_v2/bricklet_industrial_dual_0_20ma_v2.json
|
|
91
|
+
- lib/tinderfridge/devices/bricklet_industrial_dual_ac_in/bricklet_industrial_dual_ac_in.json
|
|
90
92
|
- lib/tinderfridge/devices/bricklet_industrial_dual_ac_relay/bricklet_industrial_dual_ac_relay.json
|
|
91
93
|
- lib/tinderfridge/devices/bricklet_industrial_dual_analog_in_v2/bricklet_industrial_dual_analog_in_v2.json
|
|
92
94
|
- lib/tinderfridge/devices/bricklet_industrial_dual_relay/bricklet_industrial_dual_relay.json
|
|
@@ -157,15 +159,16 @@ files:
|
|
|
157
159
|
- lib/tinderfridge/devices/bricklet_xmc1400_breakout/bricklet_xmc1400_breakout.json
|
|
158
160
|
- lib/tinderfridge/ip_connection.rb
|
|
159
161
|
- lib/tinderfridge/shared/display_ibm437_encoding.rb
|
|
162
|
+
- lib/tinderfridge/shared/gps.rb
|
|
160
163
|
- lib/tinderfridge/shared/logger.rb
|
|
161
164
|
- lib/tinderfridge/tinkerforge.rb
|
|
162
165
|
- lib/tinderfridge/version.rb
|
|
163
|
-
homepage: https://
|
|
166
|
+
homepage: https://codeberg.org/lllisteu/tinderfridge
|
|
164
167
|
licenses:
|
|
165
168
|
- CC0-1.0
|
|
166
169
|
metadata:
|
|
167
|
-
homepage_uri: https://
|
|
168
|
-
changelog_uri: https://
|
|
170
|
+
homepage_uri: https://codeberg.org/lllisteu/tinderfridge
|
|
171
|
+
changelog_uri: https://codeberg.org/lllisteu/tinderfridge/src/branch/master/History.md
|
|
169
172
|
documentation_uri: https://www.rubydoc.info/gems/tinderfridge
|
|
170
173
|
post_install_message:
|
|
171
174
|
rdoc_options: []
|