rfbeam 0.4.2 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/rfbeam/cli.rb +9 -7
- data/lib/rfbeam/kld7/cli_formatter.rb +4 -2
- data/lib/rfbeam/kld7/cli_output.rb +18 -15
- data/lib/rfbeam/kld7/constants.rb +137 -62
- data/lib/rfbeam/kld7/radar_messages.rb +8 -5
- data/lib/rfbeam/kld7/radar_parameters.rb +3 -3
- data/lib/rfbeam/kld7/serial_connection.rb +7 -5
- data/lib/rfbeam/version.rb +1 -1
- data/lib/rfbeam.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf7e877bee6e38f770c7058a27e5c3b8240347699d7f5839dcb1785200288d33
|
4
|
+
data.tar.gz: f69fa55d36aa8c160329224f88cf8d9ed291ff107fce17a4d2915809237352e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5eee8481b7e290057353b9b5aca03ac22949824b1eefee979a26d36e34c46bbe029d893948af78df0c97354271adf14d495eae41491c3fd56afb3719e847012a
|
7
|
+
data.tar.gz: cacf5bc2b75eeb187ffaca4b2a9c28dad4f55d0a4f25492f163c1b9fe8cf0d9d7b27cb75c5c5d372f2618ed72d1923e091e93afdf6cfcb259b46cda182ea3f75
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -27,7 +27,7 @@ The RfBeam class will return the path of any connected modules
|
|
27
27
|
|
28
28
|
Simple pass the path and baude rate to initialise a new radar object
|
29
29
|
|
30
|
-
RfBeam::
|
30
|
+
RfBeam::KLD7.new("/dev/ttyUSB0", 115200) do |radar|
|
31
31
|
puts radar.config
|
32
32
|
end
|
33
33
|
|
@@ -285,7 +285,7 @@ radar.micro_detection_sensitivty = 4
|
|
285
285
|
|
286
286
|
## CLI
|
287
287
|
|
288
|
-
```
|
288
|
+
```fish
|
289
289
|
❯ bundle exec rfbeam list
|
290
290
|
|
291
291
|
+--+------------+------------------+
|
data/lib/rfbeam/cli.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'thor'
|
2
4
|
require 'rfbeam'
|
3
5
|
require 'tty-table'
|
@@ -8,7 +10,7 @@ require 'unicode_plot'
|
|
8
10
|
|
9
11
|
module RfBeam
|
10
12
|
class CLI < Thor
|
11
|
-
attr_accessor :
|
13
|
+
attr_accessor :logger
|
12
14
|
|
13
15
|
desc 'list', 'List available radar modules'
|
14
16
|
def list
|
@@ -18,7 +20,7 @@ module RfBeam
|
|
18
20
|
|
19
21
|
table = TTY::Table.new(header: %w[id Path Version])
|
20
22
|
|
21
|
-
devices.each.with_index { |path, index| table << [
|
23
|
+
devices.each.with_index { |path, index| table << [index.to_s, path, radar(index).sw_version] }
|
22
24
|
puts table.render(:ascii)
|
23
25
|
end
|
24
26
|
|
@@ -44,13 +46,13 @@ module RfBeam
|
|
44
46
|
desc 'ddat <radar_id>', 'stream any valid detections, stop stream with q and enter'
|
45
47
|
option :stream, type: :boolean, aliases: '-s', desc: 'Stream the data from the device'
|
46
48
|
def ddat(radar_id)
|
47
|
-
cli = RfBeam::
|
49
|
+
cli = RfBeam::Kld7::CliOutput.new(radar_id)
|
48
50
|
cli.display(:ddat, stream: options[:stream])
|
49
51
|
end
|
50
52
|
|
51
53
|
desc 'pdat <radar_id>', 'Display Tracked Targets'
|
52
54
|
def pdat(radar_id)
|
53
|
-
cli = RfBeam::
|
55
|
+
cli = RfBeam::Kld7::CliOutput.new(radar_id)
|
54
56
|
cli.display(:pdat, stream: options[:stream])
|
55
57
|
end
|
56
58
|
|
@@ -58,7 +60,7 @@ module RfBeam
|
|
58
60
|
option :stream, type: :boolean, aliases: '-s', desc: 'Stream the data from the device'
|
59
61
|
option :raw, type: :boolean, aliases: '-r', desc: 'Display raw data'
|
60
62
|
def rfft(radar_id)
|
61
|
-
plotter = RfBeam::
|
63
|
+
plotter = RfBeam::Kld7::CliOutput.new(radar_id)
|
62
64
|
if options[:raw]
|
63
65
|
print radar(radar_id).rfft
|
64
66
|
else
|
@@ -68,7 +70,7 @@ module RfBeam
|
|
68
70
|
|
69
71
|
desc 'tdat <radar_id>', 'Display tracked target data'
|
70
72
|
def tdat(radar_id)
|
71
|
-
cli = RfBeam::
|
73
|
+
cli = RfBeam::Kld7::CliOutput.new(radar_id)
|
72
74
|
cli.display(:tdat, stream: options[:stream])
|
73
75
|
end
|
74
76
|
|
@@ -79,7 +81,7 @@ module RfBeam
|
|
79
81
|
@logger = TTY::Logger.new
|
80
82
|
return @logger.warning 'No Radar modules found.' unless devices.count.positive?
|
81
83
|
|
82
|
-
RfBeam::
|
84
|
+
RfBeam::KLD7.new(devices[id.to_i])
|
83
85
|
end
|
84
86
|
end
|
85
87
|
end
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'tty-table'
|
2
4
|
|
3
5
|
module RfBeam
|
4
|
-
module
|
6
|
+
module Kld7
|
5
7
|
class CliFormatter
|
6
8
|
def tdat(data)
|
7
9
|
{ dist: data[2], speed: data[3], angle: data[4], mag: data[5] }
|
@@ -11,7 +13,7 @@ module RfBeam
|
|
11
13
|
table = TTY::Table.new header: ['index', 'dist (M)', 'speed (Km/h)', 'angle (°)', 'mag (db)']
|
12
14
|
count = data[1] / 8
|
13
15
|
data.shift(2)
|
14
|
-
count.times
|
16
|
+
count.times do |index|
|
15
17
|
values = data.shift(4).map { |value| value.to_f / 100.0 }
|
16
18
|
table << [index, values].flatten
|
17
19
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'unicode_plot'
|
2
4
|
require 'io/console'
|
3
5
|
require 'stringio'
|
@@ -5,7 +7,7 @@ require 'tty-screen'
|
|
5
7
|
require 'tty-logger'
|
6
8
|
|
7
9
|
module RfBeam
|
8
|
-
module
|
10
|
+
module Kld7
|
9
11
|
class CliOutput
|
10
12
|
attr_reader :radar
|
11
13
|
|
@@ -13,7 +15,7 @@ module RfBeam
|
|
13
15
|
devices = RfBeam.connected
|
14
16
|
return TTY::Logger.new.warning 'No Radar modules found.' unless devices.count.positive?
|
15
17
|
|
16
|
-
@radar = RfBeam::
|
18
|
+
@radar = RfBeam::KLD7.new(devices[radar_id.to_i])
|
17
19
|
end
|
18
20
|
|
19
21
|
def display(type, stream: false)
|
@@ -39,10 +41,10 @@ module RfBeam
|
|
39
41
|
$stdout.print "\e[0J"
|
40
42
|
$stdout.flush
|
41
43
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
44
|
+
return unless @streaming
|
45
|
+
|
46
|
+
n = lines.count
|
47
|
+
$stdout.print "\e[#{n}F"
|
46
48
|
end
|
47
49
|
|
48
50
|
def stream_plot(type)
|
@@ -59,7 +61,7 @@ module RfBeam
|
|
59
61
|
|
60
62
|
def monitor_keypress
|
61
63
|
loop do
|
62
|
-
key =
|
64
|
+
key = $stdin.getch
|
63
65
|
if key.downcase == 'q'
|
64
66
|
@streaming = false
|
65
67
|
break
|
@@ -76,6 +78,7 @@ module RfBeam
|
|
76
78
|
end
|
77
79
|
|
78
80
|
def display_ddat(stream)
|
81
|
+
data = @radar.ddat
|
79
82
|
if stream
|
80
83
|
@streaming = true
|
81
84
|
Thread.new { monitor_keypress }
|
@@ -83,28 +86,28 @@ module RfBeam
|
|
83
86
|
logger = TTY::Logger.new
|
84
87
|
loop do
|
85
88
|
break unless @streaming
|
89
|
+
|
86
90
|
spinner.spin
|
87
|
-
|
88
|
-
|
89
|
-
logger.success "#{@radar.tdat}" if data[:detection]
|
91
|
+
spinner.update title: "Detection: #{DETECTION_FLAGS[data[2]]}"
|
92
|
+
logger.success @radar.tdat.to_s unless data[2].zero?
|
90
93
|
end
|
91
94
|
else
|
92
|
-
puts RfBeam::
|
95
|
+
puts RfBeam::Kld7::CliFormatter.new.ddat(data)
|
93
96
|
end
|
94
97
|
end
|
95
98
|
|
96
99
|
def display_tdat(stream)
|
97
|
-
puts RfBeam::
|
100
|
+
puts RfBeam::Kld7::CliFormatter.new.tdat(@radar.tdat)
|
98
101
|
end
|
99
102
|
|
100
103
|
def display_pdat(stream)
|
101
|
-
table = RfBeam::
|
104
|
+
table = RfBeam::Kld7::CliFormatter.new.pdat_table(@radar.pdat)
|
102
105
|
puts "\n Detected Raw Targets"
|
103
106
|
puts table.render(:unicode, alignment: :center)
|
104
107
|
end
|
105
108
|
|
106
109
|
def rfft_plot
|
107
|
-
|
110
|
+
screen_width = TTY::Screen.width * 0.65
|
108
111
|
data = rfft_plot_data(@radar.rfft)
|
109
112
|
plot =
|
110
113
|
UnicodePlot.lineplot(
|
@@ -113,7 +116,7 @@ module RfBeam
|
|
113
116
|
name: 'IF1/2 Averaged',
|
114
117
|
title: 'Raw FFT',
|
115
118
|
height: 25,
|
116
|
-
width:
|
119
|
+
width: screen_width,
|
117
120
|
xlabel: 'Speed (km/h)',
|
118
121
|
ylabel: 'Signal (db)',
|
119
122
|
xlim: [-128, 128],
|
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RfBeam
|
2
|
-
module
|
4
|
+
module Kld7
|
3
5
|
# All supported Serial port baude rates
|
4
6
|
BAUDE_RATES = { 0 => 115_200, 1 => 460_800, 2 => 921_600, 3 => 2_000_000, 4 => 3_000_000 }.freeze
|
5
7
|
|
@@ -31,158 +33,231 @@ module RfBeam
|
|
31
33
|
speed: %w[Low High]
|
32
34
|
}.freeze
|
33
35
|
|
34
|
-
Param
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
class Param
|
37
|
+
attr_accessor :name, :grps_index, :description, :default, :units, :str_values
|
38
|
+
|
39
|
+
def initialize(name:, grps_index:, options: {})
|
40
|
+
@name = name
|
41
|
+
@grps_index = grps_index
|
42
|
+
@description = options.fetch(:description, nil)
|
43
|
+
@default = options.fetch(:default, nil)
|
44
|
+
@units = options.fetch(:units, nil)
|
45
|
+
@str_values = options.fetch(:str_values, [])
|
39
46
|
end
|
47
|
+
end
|
40
48
|
|
41
49
|
RADAR_PARAMETERS = {
|
42
|
-
sw_version: Param.new(name: 'Software Version', grps_index: 2, default: 'K-LD7_APP-RFB-XXXX'),
|
50
|
+
sw_version: Param.new(name: 'Software Version', grps_index: 2, options: { default: 'K-LD7_APP-RFB-XXXX' }),
|
43
51
|
base_frequency:
|
44
52
|
Param.new(
|
45
53
|
name: 'Base Frequency',
|
46
54
|
grps_index: 3,
|
47
|
-
|
48
|
-
|
49
|
-
|
55
|
+
options: {
|
56
|
+
description: '0 = Low, 1 = Middle, 2 = High',
|
57
|
+
default: 1,
|
58
|
+
str_values: %w[Low Middle High]
|
59
|
+
}
|
50
60
|
),
|
51
61
|
max_speed:
|
52
62
|
Param.new(
|
53
63
|
name: 'Maximum Speed',
|
54
64
|
grps_index: 4,
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
65
|
+
options: {
|
66
|
+
description: '0 = 12km/h, 1 = 25km/h, 2 = 50km/h, 3 = 100km/h',
|
67
|
+
default: 1,
|
68
|
+
units: 'km/h',
|
69
|
+
str_values: %w[12.5 25 50 100]
|
70
|
+
}
|
59
71
|
),
|
60
72
|
max_range:
|
61
73
|
Param.new(
|
62
74
|
name: 'Maximum Range',
|
63
75
|
grps_index: 5,
|
64
|
-
|
65
|
-
|
66
|
-
|
76
|
+
options: {
|
77
|
+
description: '0 = 5m, 1 = 10m, 2 = 30m, 3 = 100m',
|
78
|
+
default: 1,
|
79
|
+
str_values: %w[5m 10m 30m 100m]
|
80
|
+
}
|
67
81
|
),
|
68
82
|
threshold_offset:
|
69
|
-
Param.new(
|
83
|
+
Param.new(
|
84
|
+
name: 'Threshold Offset',
|
85
|
+
grps_index: 6,
|
86
|
+
options: {
|
87
|
+
description: '10db - 60db',
|
88
|
+
default: 30,
|
89
|
+
units: 'db'
|
90
|
+
}
|
91
|
+
),
|
70
92
|
tracking_filter:
|
71
93
|
Param.new(
|
72
94
|
name: 'Tracking Filter Type',
|
73
95
|
grps_index: 7,
|
74
|
-
|
75
|
-
|
76
|
-
|
96
|
+
options: {
|
97
|
+
description: '0 = Standard, 2 = Fast Detection, 3 = Long Visibility',
|
98
|
+
default: 0,
|
99
|
+
str_values: ['standard', 'Fast Detection', 'Long Visibility']
|
100
|
+
}
|
77
101
|
),
|
78
102
|
vibration_suppression:
|
79
103
|
Param.new(
|
80
104
|
name: 'Vibration Suppression',
|
81
105
|
grps_index: 8,
|
82
|
-
|
83
|
-
|
106
|
+
options: {
|
107
|
+
description: '0-16, 0 = No Suppression, 16 = High Suppression',
|
108
|
+
default: 2
|
109
|
+
}
|
84
110
|
),
|
85
111
|
min_detection_distance:
|
86
112
|
Param.new(
|
87
113
|
name: 'Minimum Detection Distance',
|
88
114
|
grps_index: 9,
|
89
|
-
|
90
|
-
|
91
|
-
|
115
|
+
options: {
|
116
|
+
description: '0 - 100% of range setting',
|
117
|
+
default: 0,
|
118
|
+
units: '%'
|
119
|
+
}
|
92
120
|
),
|
93
121
|
max_detection_distance:
|
94
122
|
Param.new(
|
95
123
|
name: 'Maximum Detection Distance',
|
96
124
|
grps_index: 10,
|
97
|
-
|
98
|
-
|
99
|
-
|
125
|
+
options: {
|
126
|
+
description: '0 - 100% of range setting',
|
127
|
+
default: 50,
|
128
|
+
units: '%'
|
129
|
+
}
|
100
130
|
),
|
101
131
|
min_detection_angle:
|
102
|
-
Param.new(
|
132
|
+
Param.new(
|
133
|
+
name: 'Minimum Detection Angle',
|
134
|
+
grps_index: 11,
|
135
|
+
options: {
|
136
|
+
description: '-90° - 90°',
|
137
|
+
default: -90,
|
138
|
+
units: '°'
|
139
|
+
}
|
140
|
+
),
|
103
141
|
max_detection_angle:
|
104
|
-
Param.new(
|
142
|
+
Param.new(
|
143
|
+
name: 'Maximum Detection Angle',
|
144
|
+
grps_index: 12,
|
145
|
+
options: {
|
146
|
+
description: '-90° - 90°',
|
147
|
+
default: 90,
|
148
|
+
units: '°'
|
149
|
+
}
|
150
|
+
),
|
105
151
|
min_detection_speed:
|
106
152
|
Param.new(
|
107
153
|
name: 'Minimum Detection Speed',
|
108
154
|
grps_index: 13,
|
109
|
-
|
110
|
-
|
111
|
-
|
155
|
+
options: {
|
156
|
+
description: '0 - 100% of speed setting',
|
157
|
+
default: 0,
|
158
|
+
units: '%'
|
159
|
+
}
|
112
160
|
),
|
113
161
|
max_detection_speed:
|
114
162
|
Param.new(
|
115
163
|
name: 'Maximum Detection Speed',
|
116
164
|
grps_index: 14,
|
117
|
-
|
118
|
-
|
119
|
-
|
165
|
+
options: {
|
166
|
+
description: '0 - 100% of speed setting',
|
167
|
+
default: 100,
|
168
|
+
units: '%'
|
169
|
+
}
|
120
170
|
),
|
121
171
|
detection_direction:
|
122
172
|
Param.new(
|
123
173
|
name: 'Detection Direction',
|
124
174
|
grps_index: 15,
|
125
|
-
|
126
|
-
|
127
|
-
|
175
|
+
options: {
|
176
|
+
description: '0 = Receding, 1 = Approaching, 2 = Both',
|
177
|
+
default: 2,
|
178
|
+
str_values: %w[Receding Approaching Both]
|
179
|
+
}
|
128
180
|
),
|
129
181
|
range_threshold:
|
130
182
|
Param.new(
|
131
183
|
name: 'Range Threshold',
|
132
184
|
grps_index: 16,
|
133
|
-
|
134
|
-
|
135
|
-
|
185
|
+
options: {
|
186
|
+
description: '0 - 100% of range setting',
|
187
|
+
default: 10,
|
188
|
+
units: '%'
|
189
|
+
}
|
136
190
|
),
|
137
191
|
angle_threshold:
|
138
|
-
Param.new(
|
192
|
+
Param.new(
|
193
|
+
name: 'Angle Threshold',
|
194
|
+
grps_index: 17,
|
195
|
+
options: {
|
196
|
+
description: '-90° - 90°',
|
197
|
+
default: 0,
|
198
|
+
units: '°'
|
199
|
+
}
|
200
|
+
),
|
139
201
|
speed_threshold:
|
140
202
|
Param.new(
|
141
203
|
name: 'Speed Threshold',
|
142
204
|
grps_index: 18,
|
143
|
-
|
144
|
-
|
145
|
-
|
205
|
+
options: {
|
206
|
+
description: '0 - 100% of speed setting',
|
207
|
+
default: 50,
|
208
|
+
units: '%'
|
209
|
+
}
|
146
210
|
),
|
147
211
|
digital_output1:
|
148
212
|
Param.new(
|
149
213
|
name: 'Digital Output 1',
|
150
214
|
grps_index: 19,
|
151
|
-
|
152
|
-
|
153
|
-
|
215
|
+
options: {
|
216
|
+
description: '0 = Direction, 1 = Angle, 2 = Range, 3 = Speed, 4 = Micro Detection',
|
217
|
+
default: 0,
|
218
|
+
str_values: %w[Direction Angle Range Speed Micro]
|
219
|
+
}
|
154
220
|
),
|
155
221
|
digital_output2:
|
156
222
|
Param.new(
|
157
223
|
name: 'Digital Output 2',
|
158
224
|
grps_index: 20,
|
159
|
-
|
160
|
-
|
161
|
-
|
225
|
+
options: {
|
226
|
+
description: '0 = Direction, 1 = Angle, 2 = Range, 3 = Speed, 4 = Micro Detection',
|
227
|
+
default: 1,
|
228
|
+
str_values: %w[Direction Angle Range Speed Micro]
|
229
|
+
}
|
162
230
|
),
|
163
231
|
digital_output3:
|
164
232
|
Param.new(
|
165
233
|
name: 'Digital Output 3',
|
166
234
|
grps_index: 21,
|
167
|
-
|
168
|
-
|
169
|
-
|
235
|
+
options: {
|
236
|
+
description: '0 = Direction, 1 = Angle, 2 = Range, 3 = Speed, 4 = Micro Detection',
|
237
|
+
default: 2,
|
238
|
+
str_values: %w[Direction Angle Range Speed Micro]
|
239
|
+
}
|
170
240
|
),
|
171
|
-
hold_time:
|
241
|
+
hold_time:
|
242
|
+
Param.new(name: 'Hold Time', grps_index: 22, options: { description: '1 - 7200s', default: 1, units: 's' }),
|
172
243
|
micro_detection_retrigger:
|
173
244
|
Param.new(
|
174
245
|
name: 'Micro Detection Trigger',
|
175
246
|
grps_index: 23,
|
176
|
-
|
177
|
-
|
178
|
-
|
247
|
+
options: {
|
248
|
+
description: '0 = Off, 1 = Retrigger',
|
249
|
+
default: 0,
|
250
|
+
str_values: %w[Off Retrigger]
|
251
|
+
}
|
179
252
|
),
|
180
253
|
micro_detection_sensativity:
|
181
254
|
Param.new(
|
182
255
|
name: 'Micro Detection Sensativity',
|
183
256
|
grps_index: 24,
|
184
|
-
|
185
|
-
|
257
|
+
options: {
|
258
|
+
description: '0 - 9, 0 = Min, 9 = Max',
|
259
|
+
default: 4
|
260
|
+
}
|
186
261
|
)
|
187
262
|
}.freeze
|
188
263
|
end
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'csv'
|
2
4
|
|
3
5
|
module RfBeam
|
4
|
-
module
|
6
|
+
module Kld7
|
5
7
|
def detection?
|
6
8
|
data = ddat
|
7
9
|
(data[2] == 1)
|
@@ -33,7 +35,7 @@ module RfBeam
|
|
33
35
|
return resp unless formatted
|
34
36
|
|
35
37
|
target_count = resp[1].to_i / 8
|
36
|
-
return [] unless target_count
|
38
|
+
return [] unless target_count.positive?
|
37
39
|
|
38
40
|
resp.shift 2
|
39
41
|
resp.compact
|
@@ -58,6 +60,7 @@ module RfBeam
|
|
58
60
|
|
59
61
|
resp = read(14).unpack('a4LC6')
|
60
62
|
raise Error, "DDAT response = #{resp[0]}" unless resp[0] == 'DDAT'
|
63
|
+
|
61
64
|
resp
|
62
65
|
end
|
63
66
|
|
@@ -71,8 +74,8 @@ module RfBeam
|
|
71
74
|
|
72
75
|
def config
|
73
76
|
data = grps
|
74
|
-
output =
|
75
|
-
RADAR_PARAMETERS.
|
77
|
+
output = []
|
78
|
+
RADAR_PARAMETERS.each_key { |key| output << formatted_parameter(key, data[RADAR_PARAMETERS[key].grps_index]) }
|
76
79
|
output
|
77
80
|
end
|
78
81
|
|
@@ -82,7 +85,7 @@ module RfBeam
|
|
82
85
|
data = grps
|
83
86
|
value = data[param.grps_index]
|
84
87
|
end
|
85
|
-
param_str_value = param.
|
88
|
+
param_str_value = param.str_values.empty? ? value.to_s : param.str_values[value]
|
86
89
|
"#{param.name}: #{param_str_value}#{param.units}\n"
|
87
90
|
end
|
88
91
|
|
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RfBeam
|
2
|
-
module
|
4
|
+
module Kld7
|
3
5
|
# -----------------
|
4
6
|
# Software Version, 'K-LD7_APP-RFB-XXXX'
|
5
7
|
# -----------------
|
@@ -386,8 +388,6 @@ module RfBeam
|
|
386
388
|
'L'
|
387
389
|
when :int32
|
388
390
|
'l'
|
389
|
-
when :uint32
|
390
|
-
'S'
|
391
391
|
else
|
392
392
|
'L'
|
393
393
|
end
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RfBeam
|
2
|
-
module
|
4
|
+
module Kld7
|
3
5
|
require 'rubyserial'
|
4
6
|
require 'timeout'
|
5
|
-
|
7
|
+
|
6
8
|
class Error < StandardError
|
7
9
|
end
|
8
10
|
|
@@ -80,10 +82,10 @@ module RfBeam
|
|
80
82
|
raise Error, 'No valid response from Serial Port' if resp[2].nil?
|
81
83
|
|
82
84
|
response_key = resp[2]
|
83
|
-
return response_key.zero? # Everything OK
|
84
|
-
|
85
85
|
error_string = RESP_CODES[response_key].nil? ? 'Response unknown' : RESP_CODES[response_key]
|
86
|
-
raise Error, "Radar response Error: #{error_string}"
|
86
|
+
raise Error, "Radar response Error: #{error_string}" unless response_key.zero?
|
87
|
+
|
88
|
+
response_key.zero? # Everything OK
|
87
89
|
end
|
88
90
|
end
|
89
91
|
end
|
data/lib/rfbeam/version.rb
CHANGED
data/lib/rfbeam.rb
CHANGED