rfbeam 0.4.0 → 0.4.2
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/.rubocop.yml +5 -4
- data/.streerc +2 -0
- data/.tool-versions +1 -1
- data/CHANGELOG.md +4 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +6 -1
- data/README.md +57 -33
- data/lib/rfbeam/cli.rb +35 -80
- data/lib/rfbeam/kld7/cli_formatter.rb +41 -0
- data/lib/rfbeam/kld7/cli_output.rb +127 -0
- data/lib/rfbeam/kld7/constants.rb +155 -31
- data/lib/rfbeam/kld7/radar_messages.rb +30 -23
- data/lib/rfbeam/kld7/radar_parameters.rb +97 -97
- data/lib/rfbeam/kld7/serial_connection.rb +1 -1
- data/lib/rfbeam/version.rb +1 -1
- data/lib/rfbeam.rb +2 -2
- data/rfbeam.gemspec +1 -1
- metadata +7 -5
- data/lib/rfbeam/kld7/streamer.rb +0 -75
@@ -1,6 +1,5 @@
|
|
1
1
|
module RfBeam
|
2
2
|
module KLD7
|
3
|
-
|
4
3
|
# -----------------
|
5
4
|
# Software Version, 'K-LD7_APP-RFB-XXXX'
|
6
5
|
# -----------------
|
@@ -15,9 +14,10 @@ module RfBeam
|
|
15
14
|
query_parameter RADAR_PARAMETERS[:base_frequency].grps_index
|
16
15
|
end
|
17
16
|
alias rbfr base_frequency
|
18
|
-
|
17
|
+
|
19
18
|
def base_frequency=(frequency = 1)
|
20
|
-
value =
|
19
|
+
value =
|
20
|
+
case frequency
|
21
21
|
when 0, :low, 'low'
|
22
22
|
0
|
23
23
|
when 1, :middle, 'middle'
|
@@ -32,341 +32,341 @@ module RfBeam
|
|
32
32
|
|
33
33
|
alias set_base_frequency base_frequency=
|
34
34
|
alias rbfr= base_frequency=
|
35
|
-
|
35
|
+
|
36
36
|
# -----------------
|
37
37
|
# Maximum Speed, 0 = 12.5km/h, 1 = 25km/h (default), 2 = 50km/h, 3 = 100km/h
|
38
38
|
# -----------------
|
39
39
|
def max_speed
|
40
40
|
query_parameter(RADAR_PARAMETERS[:max_speed].grps_index)
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
def max_speed=(speed = 1)
|
44
44
|
raise ArgumentError, "Invalid arg: '#{speed}'" unless (0..3).include?(speed)
|
45
|
-
raise ArgumentError,
|
46
|
-
|
45
|
+
raise ArgumentError, 'Expected an Integer' unless speed.is_a?(Integer)
|
46
|
+
|
47
47
|
set_parameter :rspi, speed, :uint32
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
alias set_max_speed max_speed=
|
51
51
|
alias rspi max_speed=
|
52
|
-
|
52
|
+
|
53
53
|
# -----------------
|
54
54
|
# Maximum Range, 0 = 5m, 1 = 10m (default), 2 = 30m, 3 = 100m
|
55
55
|
# -----------------
|
56
56
|
def max_range
|
57
57
|
query_parameter(RADAR_PARAMETERS[:max_range].grps_index)
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
def max_range=(range = 1)
|
61
61
|
raise ArgumentError, "Invalid arg: '#{range}'" unless (0..3).include?(range)
|
62
|
-
raise ArgumentError,
|
63
|
-
|
62
|
+
raise ArgumentError, 'Expected an Integer' unless range.is_a?(Integer)
|
63
|
+
|
64
64
|
set_parameter :rrai, range, :uint32
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
alias rrai= max_range=
|
68
68
|
alias set_max_range max_range=
|
69
|
-
|
69
|
+
|
70
70
|
# -----------------
|
71
71
|
# Threshold Offset, 10 - 60db, (default = 30)
|
72
72
|
# -----------------
|
73
73
|
def threshold_offset
|
74
74
|
query_parameter RADAR_PARAMETERS[:threshold_offset].grps_index
|
75
75
|
end
|
76
|
-
|
76
|
+
|
77
77
|
def threshold_offset=(offset = 30)
|
78
78
|
raise ArgumentError, "Invalid arg: '#{offset}'" unless (10..60).include?(offset)
|
79
|
-
raise ArgumentError,
|
80
|
-
|
79
|
+
raise ArgumentError, 'Expected an Integer' unless offset.is_a?(Integer)
|
80
|
+
|
81
81
|
set_parameter :thof, offset, :uint32
|
82
82
|
end
|
83
|
-
|
83
|
+
|
84
84
|
alias thof= threshold_offset=
|
85
85
|
alias set_threshold_offset threshold_offset=
|
86
|
-
|
86
|
+
|
87
87
|
# -----------------
|
88
88
|
# Tracking filter type, 0 = Standard (Default), 1 = Fast Tracking, 2 = Long visibility
|
89
89
|
# -----------------
|
90
90
|
def tracking_filter
|
91
91
|
query_parameter RADAR_PARAMETERS[:tracking_filter].grps_index
|
92
92
|
end
|
93
|
-
|
93
|
+
|
94
94
|
def tracking_filter=(type = 0)
|
95
95
|
raise ArgumentError, "Invalid arg: '#{type}'" unless (0..2).include?(type)
|
96
|
-
raise ArgumentError,
|
97
|
-
|
96
|
+
raise ArgumentError, 'Expected an Integer' unless type.is_a?(Integer)
|
97
|
+
|
98
98
|
set_parameter :trft, type, :uint32
|
99
99
|
end
|
100
100
|
alias trtf= tracking_filter=
|
101
101
|
alias set_tracking_filter tracking_filter=
|
102
|
-
|
102
|
+
|
103
103
|
# -----------------
|
104
104
|
# Vibration suppression, 0 - 16, 0 = No Suppression, 16 = High Suppression, default = 2
|
105
105
|
# -----------------
|
106
106
|
def vibration_suppression
|
107
107
|
query_parameter RADAR_PARAMETERS[:vibration_suppression].grps_index
|
108
108
|
end
|
109
|
-
|
109
|
+
|
110
110
|
def vibration_suppression=(value = 2)
|
111
111
|
raise ArgumentError, "Invalid arg: '#{value}'" unless (0..16).include?(value)
|
112
|
-
raise ArgumentError,
|
113
|
-
|
114
|
-
set_parameter :visu, value, :uint32
|
112
|
+
raise ArgumentError, 'Expected an Integer' unless value.is_a?(Integer)
|
113
|
+
|
114
|
+
set_parameter :visu, value, :uint32
|
115
115
|
end
|
116
116
|
alias visu= vibration_suppression=
|
117
117
|
alias set_vibration_suppression vibration_suppression=
|
118
|
-
|
118
|
+
|
119
119
|
# -----------------
|
120
120
|
# Minimum Detection distance, 0 - 100% of Range setting, default = 0
|
121
121
|
# -----------------
|
122
122
|
def min_detection_distance
|
123
123
|
query_parameter RADAR_PARAMETERS[:min_detection_distance].grps_index
|
124
124
|
end
|
125
|
-
|
125
|
+
|
126
126
|
def min_detection_distance=(value = 0)
|
127
127
|
raise ArgumentError, "Invalid arg: '#{value}'" unless (0..100).include?(value)
|
128
|
-
raise ArgumentError,
|
129
|
-
|
128
|
+
raise ArgumentError, 'Expected an Integer' unless value.is_a?(Integer)
|
129
|
+
|
130
130
|
set_parameter :mira, value, :uint32
|
131
131
|
end
|
132
132
|
alias mira= min_detection_distance=
|
133
133
|
alias set_min_detection_distance min_detection_distance=
|
134
|
-
|
134
|
+
|
135
135
|
# -----------------
|
136
136
|
# Maximum Detection distance, 0 - 100% of Range setting, default = 50
|
137
137
|
# -----------------
|
138
138
|
def max_detection_distance
|
139
139
|
query_parameter RADAR_PARAMETERS[:min_detection_distance].grps_index
|
140
140
|
end
|
141
|
-
|
141
|
+
|
142
142
|
def max_detection_distance=(value = 50)
|
143
143
|
raise ArgumentError, "Invalid arg: '#{value}'" unless (0..100).include?(value)
|
144
|
-
raise ArgumentError,
|
145
|
-
|
144
|
+
raise ArgumentError, 'Expected an Integer' unless value.is_a?(Integer)
|
145
|
+
|
146
146
|
set_parameter :mara, value, :uint32
|
147
147
|
end
|
148
148
|
alias mara= max_detection_distance=
|
149
149
|
alias set_max_detection_distance max_detection_distance=
|
150
|
-
|
150
|
+
|
151
151
|
# -----------------
|
152
152
|
# Minimum Detection Angle, -90° - 90°, default = -90
|
153
153
|
# -----------------
|
154
154
|
def min_detection_angle
|
155
155
|
query_parameter RADAR_PARAMETERS[:min_detection_angle].grps_index
|
156
156
|
end
|
157
|
-
|
157
|
+
|
158
158
|
def min_detection_angle=(angle = -90)
|
159
159
|
raise ArgumentError, "Invalid arg: '#{angle}'" unless (-90..90).include?(angle)
|
160
|
-
raise ArgumentError,
|
161
|
-
|
160
|
+
raise ArgumentError, 'Expected an Integer' unless angle.is_a?(Integer)
|
161
|
+
|
162
162
|
set_parameter :mian, angle, :int32
|
163
163
|
end
|
164
164
|
alias mian= min_detection_angle=
|
165
165
|
alias set_min_detection_angle min_detection_angle=
|
166
|
-
|
166
|
+
|
167
167
|
# -----------------
|
168
168
|
# Maximum Detection Angle, -90° - 90°, default = 90
|
169
169
|
# -----------------
|
170
170
|
def max_detection_angleq
|
171
171
|
query_parameter RADAR_PARAMETERS[:max_detection_angle].grps_index
|
172
172
|
end
|
173
|
-
|
173
|
+
|
174
174
|
def max_detection_angle=(angle = 90)
|
175
175
|
raise ArgumentError, "Invalid arg: '#{angle}'" unless (-90..90).include?(angle)
|
176
|
-
raise ArgumentError,
|
177
|
-
|
176
|
+
raise ArgumentError, 'Expected an Integer' unless angle.is_a?(Integer)
|
177
|
+
|
178
178
|
set_parameter :maan, angle, :int32
|
179
179
|
end
|
180
180
|
alias maan= max_detection_angle=
|
181
181
|
alias set_max_detection_angle max_detection_angle=
|
182
|
-
|
182
|
+
|
183
183
|
# -----------------
|
184
184
|
# Minimum Detection Speed, 0 - 100% of Speed setting, default = 0
|
185
185
|
# -----------------
|
186
186
|
def min_detection_speed
|
187
187
|
query_parameter RADAR_PARAMETERS[:min_detection_angle].grps_index
|
188
188
|
end
|
189
|
-
|
189
|
+
|
190
190
|
def min_detection_speed=(speed = 0)
|
191
191
|
raise ArgumentError, "Invalid arg: '#{speed}'" unless (0..100).include?(speed)
|
192
|
-
raise ArgumentError,
|
193
|
-
|
192
|
+
raise ArgumentError, 'Expected an Integer' unless speed.is_a?(Integer)
|
193
|
+
|
194
194
|
set_parameter :misp, speed, :uint32
|
195
195
|
end
|
196
196
|
alias misp= min_detection_speed=
|
197
197
|
alias set_min_detection_speed min_detection_speed=
|
198
|
-
|
198
|
+
|
199
199
|
# -----------------
|
200
200
|
# Maximum Detection Speed, 0 - 100% of Speed setting, default = 100
|
201
201
|
# -----------------
|
202
202
|
def max_detection_speed
|
203
203
|
query_parameter RADAR_PARAMETERS[:max_detection_speed].grps_index
|
204
204
|
end
|
205
|
-
|
205
|
+
|
206
206
|
def max_detection_speed=(speed = 100)
|
207
207
|
raise ArgumentError, "Invalid arg: '#{speed}'" unless (0..100).include?(speed)
|
208
|
-
raise ArgumentError,
|
209
|
-
|
208
|
+
raise ArgumentError, 'Expected an Integer' unless speed.is_a?(Integer)
|
209
|
+
|
210
210
|
set_parameter :masp, speed, :uint32
|
211
211
|
end
|
212
212
|
alias masp= max_detection_speed=
|
213
213
|
alias set_max_detection_speed max_detection_speed=
|
214
|
-
|
214
|
+
|
215
215
|
# -----------------
|
216
216
|
# Detection Direction, 0 = Receding, 1 = Approaching, 2 = Both (default)
|
217
217
|
# -----------------
|
218
218
|
def detection_direction
|
219
219
|
query_parameter RADAR_PARAMETERS[:detection_direction].grps_index
|
220
220
|
end
|
221
|
-
|
221
|
+
|
222
222
|
def detection_direction=(direction = 2)
|
223
223
|
raise ArgumentError, "Invalid arg: '#{direction}'" unless (0..2).include?(direction)
|
224
|
-
raise ArgumentError,
|
225
|
-
|
224
|
+
raise ArgumentError, 'Expected an Integer' unless direction.is_a?(Integer)
|
225
|
+
|
226
226
|
set_parameter :dedi, direction, :uint32
|
227
227
|
end
|
228
228
|
alias dedi= detection_direction=
|
229
229
|
alias set_detection_direction detection_direction=
|
230
|
-
|
230
|
+
|
231
231
|
# -----------------
|
232
232
|
# Range Threshold, 0 - 100% of Range setting, default = 10
|
233
233
|
# -----------------
|
234
234
|
def range_threshold
|
235
235
|
query_parameter RADAR_PARAMETERS[:range_threshold].grps_index
|
236
236
|
end
|
237
|
-
|
237
|
+
|
238
238
|
def range_threshold=(value = 10)
|
239
239
|
raise ArgumentError, "Invalid arg: '#{value}'" unless (0..100).include?(value)
|
240
|
-
raise ArgumentError,
|
241
|
-
|
240
|
+
raise ArgumentError, 'Expected an Integer' unless value.is_a?(Integer)
|
241
|
+
|
242
242
|
set_parameter :rath, value, :uint32
|
243
243
|
end
|
244
244
|
alias rath= range_threshold=
|
245
245
|
alias set_range_threshold range_threshold=
|
246
|
-
|
246
|
+
|
247
247
|
# -----------------
|
248
248
|
# Angle Threshold, -90° to 90°, default = 0
|
249
249
|
# -----------------
|
250
250
|
def angle_threshold
|
251
251
|
query_parameter RADAR_PARAMETERS[:angle_threshold].grps_index
|
252
252
|
end
|
253
|
-
|
253
|
+
|
254
254
|
def angle_threshold=(value = 0)
|
255
255
|
raise ArgumentError, "Invalid arg: '#{value}'" unless (-90..90).include?(value)
|
256
|
-
raise ArgumentError,
|
257
|
-
|
256
|
+
raise ArgumentError, 'Expected an Integer' unless value.is_a?(Integer)
|
257
|
+
|
258
258
|
set_parameter :anth, value, :int32
|
259
259
|
end
|
260
260
|
alias anth= angle_threshold=
|
261
261
|
alias set_angle_threshold angle_threshold=
|
262
|
-
|
262
|
+
|
263
263
|
# -----------------
|
264
264
|
# Speed Threshold, 0 - 100% of speed setting, default = 50
|
265
265
|
# -----------------
|
266
266
|
def speed_threshold
|
267
267
|
query_parameter RADAR_PARAMETERS[:speed_threshold].grps_index
|
268
268
|
end
|
269
|
-
|
269
|
+
|
270
270
|
def speed_threshold=(value = 50)
|
271
271
|
raise ArgumentError, "Invalid arg: '#{value}'" unless (0..100).include?(value)
|
272
|
-
raise ArgumentError,
|
273
|
-
|
272
|
+
raise ArgumentError, 'Expected an Integer' unless value.is_a?(Integer)
|
273
|
+
|
274
274
|
set_parameter :spth, value, :uint32
|
275
275
|
end
|
276
276
|
alias spth= angle_threshold=
|
277
277
|
alias set_speed_threshold angle_threshold=
|
278
|
-
|
278
|
+
|
279
279
|
# -----------------
|
280
280
|
# Digital output 1, 0 = Direction, 1 = Angle, 2 = Range, 3 = Speed, 4 = Micro Detection, default = 0
|
281
281
|
# -----------------
|
282
282
|
def digital_output1
|
283
283
|
query_parameter RADAR_PARAMETERS[:digital_output1].grps_index
|
284
284
|
end
|
285
|
-
|
286
|
-
def digital_output1=(value = 0)
|
285
|
+
|
286
|
+
def digital_output1=(value = 0)
|
287
287
|
raise ArgumentError, "Invalid arg: '#{value}'" unless (0..4).include?(value)
|
288
|
-
raise ArgumentError,
|
289
|
-
|
288
|
+
raise ArgumentError, 'Expected an Integer' unless value.is_a?(Integer)
|
289
|
+
|
290
290
|
set_parameter :dig1, value, :uint32
|
291
291
|
end
|
292
292
|
alias dig1= digital_output1=
|
293
293
|
alias set_digital_output1 digital_output1=
|
294
|
-
|
294
|
+
|
295
295
|
# -----------------
|
296
296
|
# Digital output 2, 0 = Direction, 1 = Angle, 2 = Range, 3 = Speed, 4 = Micro Detection, default = 1
|
297
297
|
# -----------------
|
298
298
|
def digital_output2
|
299
299
|
query_parameter RADAR_PARAMETERS[:digital_output2].grps_index
|
300
300
|
end
|
301
|
-
|
301
|
+
|
302
302
|
def digital_output2=(value = 1)
|
303
303
|
raise ArgumentError, "Invalid arg: '#{value}'" unless (0..4).include?(value)
|
304
|
-
raise ArgumentError,
|
305
|
-
|
304
|
+
raise ArgumentError, 'Expected an Integer' unless value.is_a?(Integer)
|
305
|
+
|
306
306
|
set_parameter :dig2, value, :uint32
|
307
307
|
end
|
308
308
|
alias dig2= digital_output2=
|
309
309
|
alias set_digital_output2 digital_output2=
|
310
|
-
|
310
|
+
|
311
311
|
# -----------------
|
312
312
|
# Digital output 3, 0 = Direction, 1 = Angle, 2 = Range, 3 = Speed, 4 = Micro Detection, default = 2
|
313
313
|
# -----------------
|
314
314
|
def digital_output3
|
315
315
|
query_parameter RADAR_PARAMETERS[:digital_output3].grps_index
|
316
316
|
end
|
317
|
-
|
317
|
+
|
318
318
|
def digital_output3=(value = 2)
|
319
319
|
raise ArgumentError, "Invalid arg: '#{value}'" unless (0..4).include?(value)
|
320
|
-
raise ArgumentError,
|
321
|
-
|
320
|
+
raise ArgumentError, 'Expected an Integer' unless value.is_a?(Integer)
|
321
|
+
|
322
322
|
set_parameter :dig3, value, :uint32
|
323
323
|
end
|
324
324
|
alias dig3= digital_output3=
|
325
325
|
alias set_digital_output3 digital_output3=
|
326
|
-
|
326
|
+
|
327
327
|
# -----------------
|
328
328
|
# Hold Time, 1 - 7200s, default = 1
|
329
329
|
# -----------------
|
330
330
|
def hold_time
|
331
331
|
query_parameter RADAR_PARAMETERS[:hold_time].grps_index
|
332
332
|
end
|
333
|
-
|
333
|
+
|
334
334
|
def hold_time=(time = 1)
|
335
335
|
raise ArgumentError, "Invalid arg: '#{time}'" unless (1..7200).include?(time)
|
336
|
-
raise ArgumentError,
|
337
|
-
|
336
|
+
raise ArgumentError, 'Expected an Integer' unless time.is_a?(Integer)
|
337
|
+
|
338
338
|
set_parameter :hold, time, :uint32
|
339
339
|
end
|
340
340
|
alias hold= hold_time=
|
341
341
|
alias set_hold_time hold_time=
|
342
|
-
|
342
|
+
|
343
343
|
# -----------------
|
344
344
|
# Micro Detection retrigger, 0 = Off (default), 1 = Retrigger
|
345
345
|
# -----------------
|
346
346
|
def micro_detection_retrigger
|
347
347
|
query_parameter RADAR_PARAMETERS[:set_micro_detection_retrigger].grps_index
|
348
348
|
end
|
349
|
-
|
349
|
+
|
350
350
|
def micro_detection_retrigger=(value = 0)
|
351
351
|
raise ArgumentError, "Invalid arg: '#{value}'" unless (0..1).include?(value)
|
352
|
-
raise ArgumentError,
|
353
|
-
|
352
|
+
raise ArgumentError, 'Expected an Integer' unless value.is_a?(Integer)
|
353
|
+
|
354
354
|
set_parameter :mide, value, :uint32
|
355
355
|
end
|
356
356
|
alias mide= micro_detection_retrigger=
|
357
357
|
alias set_micro_detection_retrigger micro_detection_retrigger=
|
358
|
-
|
358
|
+
|
359
359
|
# -----------------
|
360
360
|
# Micro Detection sensitivity, 0 - 9, 0 = Min, 9 = Max, default = 4
|
361
361
|
# -----------------
|
362
362
|
def micro_detection_sensitivity
|
363
363
|
query_parameter RADAR_PARAMETERS[:micro_detection_sensitivity].grps_index
|
364
364
|
end
|
365
|
-
|
365
|
+
|
366
366
|
def micro_detection_sensitivity=(value = 4)
|
367
367
|
raise ArgumentError, "Invalid arg: '#{value}'" unless (0..9).include?(value)
|
368
|
-
raise ArgumentError,
|
369
|
-
|
368
|
+
raise ArgumentError, 'Expected an Integer' unless value.is_a?(Integer)
|
369
|
+
|
370
370
|
set_parameter :mids, value, :uint32
|
371
371
|
end
|
372
372
|
alias mids= micro_detection_sensitivity=
|
@@ -378,17 +378,17 @@ module RfBeam
|
|
378
378
|
data = grps
|
379
379
|
data[index]
|
380
380
|
end
|
381
|
-
|
381
|
+
|
382
382
|
def set_parameter(header, value, return_type = :uint32)
|
383
383
|
return_type =
|
384
384
|
case return_type
|
385
|
-
|
385
|
+
when :uint32
|
386
386
|
'L'
|
387
|
-
|
387
|
+
when :int32
|
388
388
|
'l'
|
389
|
-
|
389
|
+
when :uint32
|
390
390
|
'S'
|
391
|
-
|
391
|
+
else
|
392
392
|
'L'
|
393
393
|
end
|
394
394
|
command = [header.upcase.to_s, 4, value]
|
data/lib/rfbeam/version.rb
CHANGED
data/lib/rfbeam.rb
CHANGED
@@ -4,11 +4,11 @@ require 'rfbeam/kld7/radar_parameters'
|
|
4
4
|
require 'rfbeam/kld7/radar_messages'
|
5
5
|
require 'rfbeam/kld7/serial_connection'
|
6
6
|
require 'rfbeam/kld7/constants'
|
7
|
-
require 'rfbeam/kld7/
|
7
|
+
require 'rfbeam/kld7/cli_output'
|
8
|
+
require 'rfbeam/kld7/cli_formatter'
|
8
9
|
require 'rfbeam/version'
|
9
10
|
require 'rfbeam/cli'
|
10
11
|
|
11
|
-
|
12
12
|
module RfBeam
|
13
13
|
class Error < StandardError
|
14
14
|
end
|
data/rfbeam.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = 'Currently only tested with K-LD7 on MacOS & Raspian (bullseye)'
|
13
13
|
spec.homepage = 'https://gitlab.com/robcarruthers/rfbeam'
|
14
14
|
spec.license = 'MIT'
|
15
|
-
spec.required_ruby_version = '>= 3.2
|
15
|
+
spec.required_ruby_version = '>= 3.1.2'
|
16
16
|
|
17
17
|
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
18
18
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rfbeam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Carruthers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -62,6 +62,7 @@ extra_rdoc_files: []
|
|
62
62
|
files:
|
63
63
|
- ".DS_Store"
|
64
64
|
- ".rubocop.yml"
|
65
|
+
- ".streerc"
|
65
66
|
- ".tool-versions"
|
66
67
|
- CHANGELOG.md
|
67
68
|
- Gemfile
|
@@ -72,11 +73,12 @@ files:
|
|
72
73
|
- exe/rfbeam
|
73
74
|
- lib/rfbeam.rb
|
74
75
|
- lib/rfbeam/cli.rb
|
76
|
+
- lib/rfbeam/kld7/cli_formatter.rb
|
77
|
+
- lib/rfbeam/kld7/cli_output.rb
|
75
78
|
- lib/rfbeam/kld7/constants.rb
|
76
79
|
- lib/rfbeam/kld7/radar_messages.rb
|
77
80
|
- lib/rfbeam/kld7/radar_parameters.rb
|
78
81
|
- lib/rfbeam/kld7/serial_connection.rb
|
79
|
-
- lib/rfbeam/kld7/streamer.rb
|
80
82
|
- lib/rfbeam/version.rb
|
81
83
|
- node_modules/.bin/prettier
|
82
84
|
- node_modules/.yarn-integrity
|
@@ -183,14 +185,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
183
185
|
requirements:
|
184
186
|
- - ">="
|
185
187
|
- !ruby/object:Gem::Version
|
186
|
-
version: 3.2
|
188
|
+
version: 3.1.2
|
187
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
188
190
|
requirements:
|
189
191
|
- - ">="
|
190
192
|
- !ruby/object:Gem::Version
|
191
193
|
version: '0'
|
192
194
|
requirements: []
|
193
|
-
rubygems_version: 3.
|
195
|
+
rubygems_version: 3.3.7
|
194
196
|
signing_key:
|
195
197
|
specification_version: 4
|
196
198
|
summary: Ruby API and CLI for RFBeam doplar radar modules
|
data/lib/rfbeam/kld7/streamer.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
# rubocop:disable all
|
2
|
-
require 'unicode_plot'
|
3
|
-
require 'io/console'
|
4
|
-
require "stringio"
|
5
|
-
require 'tty-screen'
|
6
|
-
|
7
|
-
module RfBeam
|
8
|
-
module KLD7
|
9
|
-
class Streamer
|
10
|
-
attr_accessor :radar
|
11
|
-
|
12
|
-
def initialize(radar)
|
13
|
-
@radar = radar
|
14
|
-
end
|
15
|
-
|
16
|
-
def monitor_keypress
|
17
|
-
loop do
|
18
|
-
key = STDIN.getch
|
19
|
-
if key.downcase == "q"
|
20
|
-
@stop_streaming = true
|
21
|
-
break
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def rfft
|
27
|
-
out = StringIO.new
|
28
|
-
def out.tty?
|
29
|
-
true
|
30
|
-
end
|
31
|
-
|
32
|
-
Thread.new { monitor_keypress }
|
33
|
-
|
34
|
-
loop do
|
35
|
-
out.truncate(0)
|
36
|
-
|
37
|
-
plot = rfft_plot(@radar)
|
38
|
-
plot.render(out)
|
39
|
-
|
40
|
-
lines = out.string.lines
|
41
|
-
lines.each { |line| $stdout.print "\r#{line}" }
|
42
|
-
$stdout.print "\e[0J"
|
43
|
-
$stdout.flush
|
44
|
-
break if @stop_streaming
|
45
|
-
|
46
|
-
n = lines.count
|
47
|
-
$stdout.print "\e[#{n}F"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
private
|
52
|
-
|
53
|
-
def plot_data(data)
|
54
|
-
{ x: Array(-128...128), series1: data.shift(256).map { |value| value / 100 }, series2: data.shift(256).map { |value| value.to_i / 100 } }
|
55
|
-
end
|
56
|
-
|
57
|
-
def rfft_plot(radar)
|
58
|
-
width = TTY::Screen.width * 0.65
|
59
|
-
data = plot_data(radar.rfft)
|
60
|
-
plot = UnicodePlot.lineplot(
|
61
|
-
data[:x],
|
62
|
-
data[:series1],
|
63
|
-
name: 'IF1/2 Averaged',
|
64
|
-
title: 'Raw FFT',
|
65
|
-
height: 25,
|
66
|
-
width: width,
|
67
|
-
xlabel: "Speed (km/h)",
|
68
|
-
ylabel: 'Signal (db)', xlim: [-128, 128],
|
69
|
-
ylim: [0, 100])
|
70
|
-
UnicodePlot.lineplot!(plot, data[:x], data[:series2], name: "Threshold")
|
71
|
-
plot
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|