rfbeam 0.4.1 → 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 +1 -1
- data/.tool-versions +1 -1
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +57 -33
- data/lib/rfbeam/kld7/constants.rb +4 -4
- data/lib/rfbeam/kld7/radar_parameters.rb +97 -97
- data/lib/rfbeam/version.rb +1 -1
- data/rfbeam.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f97b41caa1ea2bb28202406b3c2ae9ab2cec96977f7238e3638407f7aa2e2fad
|
4
|
+
data.tar.gz: 12ecf75b483f934c2436a799405598ffd611d858acd15d099d00bcd73a4de30e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4a69f4f0501b19f05eb57887129089ac549a327f6fcb7ded1ffad3186f36260cb71ec766ef69916532447fd0138db5843111f4fad1b5b6c57c1d5c08466fb17
|
7
|
+
data.tar.gz: a7e7dc0c45b862dd2d37f28424e712236f4220bdef87ed4faccdb65b96f0e9cdf4984e3ff7c792940bb91b5896c32ac4f9cb678db45ba25a5f138bf6d475ecb1
|
data/.rubocop.yml
CHANGED
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 3.2
|
1
|
+
ruby 3.1.2
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Rfbeam
|
2
2
|
|
3
3
|

|
4
|
-

|
5
5
|

|
6
6
|
|
7
7
|
RfBeam is a simple, high-level interface for the RFBeam radar modules.
|
@@ -67,12 +67,12 @@ Returns a formatted String of all parameter settings. The only way to read param
|
|
67
67
|
|
68
68
|
radar.config
|
69
69
|
|
70
|
-
Software Version: K-LD7_APP-RFB-0103
|
71
|
-
Base Frequency: Low
|
72
|
-
Maximum Speed: 100km/h
|
73
|
-
Maximum Range: 100m
|
74
|
-
Threshold Offset: 30db
|
75
|
-
Tracking Filter Type: Long Visibility
|
70
|
+
Software Version: K-LD7_APP-RFB-0103
|
71
|
+
Base Frequency: Low
|
72
|
+
Maximum Speed: 100km/h
|
73
|
+
Maximum Range: 100m
|
74
|
+
Threshold Offset: 30db
|
75
|
+
Tracking Filter Type: Long Visibility
|
76
76
|
Vibration Suppression: 16
|
77
77
|
Minimum Detection Distance: 0%
|
78
78
|
Maximum Detection Distance: 100%
|
@@ -91,7 +91,7 @@ Returns a formatted String of all parameter settings. The only way to read param
|
|
91
91
|
Micro Detection Trigger: Off
|
92
92
|
Micro Detection Sensativity: 4
|
93
93
|
|
94
|
-
## Parameter
|
94
|
+
## Parameter API
|
95
95
|
|
96
96
|
### Base Frequency
|
97
97
|
|
@@ -100,7 +100,7 @@ Returns a formatted String of all parameter settings. The only way to read param
|
|
100
100
|
alias :rbfr
|
101
101
|
|
102
102
|
```ruby
|
103
|
-
|
103
|
+
radar.radar.base_frequency = 1
|
104
104
|
```
|
105
105
|
|
106
106
|
### Maximum Speed
|
@@ -108,7 +108,7 @@ set_base_frequency(1)
|
|
108
108
|
0 = 12.5km/h, 1 = 25km/h (default), 2 = 50km/h, 3 = 100km/h, alias :rspi
|
109
109
|
|
110
110
|
```ruby
|
111
|
-
|
111
|
+
radar.max_speed = 1
|
112
112
|
```
|
113
113
|
|
114
114
|
### Maximum Range
|
@@ -116,7 +116,7 @@ set_max_speed(1)
|
|
116
116
|
0 = 5m, 1 = 10m (default), 2 = 30m, 3 = 100m, alias :rrai
|
117
117
|
|
118
118
|
```ruby
|
119
|
-
|
119
|
+
radar.max_range = 1
|
120
120
|
```
|
121
121
|
|
122
122
|
### Threshold Offset
|
@@ -124,7 +124,7 @@ set_max_range(1)
|
|
124
124
|
10 - 60db, (default = 30), alias :thof
|
125
125
|
|
126
126
|
```ruby
|
127
|
-
|
127
|
+
radar.threshold_offset = 30
|
128
128
|
```
|
129
129
|
|
130
130
|
### Tracking filter type
|
@@ -132,7 +132,7 @@ set_threshold_offset(30)
|
|
132
132
|
0 = Standard (Default), 1 = Fast Tracking, 2 = Long visibility, alias :trtf
|
133
133
|
|
134
134
|
```ruby
|
135
|
-
|
135
|
+
radar.tracking_filter = 0
|
136
136
|
```
|
137
137
|
|
138
138
|
### Vibration suppression
|
@@ -140,7 +140,7 @@ set_tracking_filter(0)
|
|
140
140
|
0 - 16, 0 = No Suppression, 16 = High Suppression, default = 2, alias :visu
|
141
141
|
|
142
142
|
```ruby
|
143
|
-
|
143
|
+
radar.vibration_suppression = 2
|
144
144
|
```
|
145
145
|
|
146
146
|
### Minimum Detection distance
|
@@ -148,7 +148,7 @@ set_vibration_suppression(2)
|
|
148
148
|
0 - 100% of Range setting, default = 0, alias :mira
|
149
149
|
|
150
150
|
```ruby
|
151
|
-
|
151
|
+
radar.min_detection_distance = 0
|
152
152
|
```
|
153
153
|
|
154
154
|
### Maximum Detection distance
|
@@ -156,7 +156,7 @@ set_min_detection_distance(0)
|
|
156
156
|
0 - 100% of Range setting, default = 50, alias :mara
|
157
157
|
|
158
158
|
```ruby
|
159
|
-
|
159
|
+
radar.max_detection_distance = 50
|
160
160
|
```
|
161
161
|
|
162
162
|
### Minimum Detection Angle
|
@@ -164,7 +164,7 @@ set_max_detection_distance(50)
|
|
164
164
|
-90° - 90°, default = -90, alias :mian
|
165
165
|
|
166
166
|
```ruby
|
167
|
-
|
167
|
+
radar.min_detection_angle = -90
|
168
168
|
```
|
169
169
|
|
170
170
|
### Maximum Detection Angle
|
@@ -172,7 +172,7 @@ set_min_detection_angle(-90
|
|
172
172
|
-90° - 90°, default = 90, alias :maan
|
173
173
|
|
174
174
|
```ruby
|
175
|
-
|
175
|
+
radar.min_detection_angle = 90
|
176
176
|
```
|
177
177
|
|
178
178
|
### Minimum Detection Speed
|
@@ -180,7 +180,7 @@ set_min_detection_angle(90)
|
|
180
180
|
0 - 100% of Speed setting, default = 0, alias :misp
|
181
181
|
|
182
182
|
```ruby
|
183
|
-
|
183
|
+
radar.min_detection_speed = 0
|
184
184
|
```
|
185
185
|
|
186
186
|
### Maximum Detection Speed
|
@@ -188,7 +188,7 @@ set_min_detection_speed(0)
|
|
188
188
|
0 - 100% of Speed setting, default = 100, alias :masp
|
189
189
|
|
190
190
|
```ruby
|
191
|
-
|
191
|
+
radar.max_detection_speed = 100
|
192
192
|
```
|
193
193
|
|
194
194
|
### Detection Direction
|
@@ -196,7 +196,7 @@ set_max_detection_speed(100)
|
|
196
196
|
0 = Receding, 1 = Approaching, 2 = Both (default), alias :dedi
|
197
197
|
|
198
198
|
```ruby
|
199
|
-
|
199
|
+
radar. detection_direction = 2
|
200
200
|
```
|
201
201
|
|
202
202
|
### Range Threshold
|
@@ -204,7 +204,7 @@ set_max_detection_speed(100)
|
|
204
204
|
0 - 100% of Range setting, default = 10, alias :rath
|
205
205
|
|
206
206
|
```ruby
|
207
|
-
|
207
|
+
radar. range_threshold = 10
|
208
208
|
```
|
209
209
|
|
210
210
|
### Angle Threshold
|
@@ -212,7 +212,7 @@ set_max_detection_speed(100)
|
|
212
212
|
-90° to 90°, default = 0, alias :anth
|
213
213
|
|
214
214
|
```ruby
|
215
|
-
|
215
|
+
radar. range_threshold = 0
|
216
216
|
```
|
217
217
|
|
218
218
|
### Speed Threshold
|
@@ -220,37 +220,37 @@ set_max_detection_speed(100)
|
|
220
220
|
0 - 100% of speed setting, default = 50, alias :spth
|
221
221
|
|
222
222
|
```ruby
|
223
|
-
|
223
|
+
radar. angle_threshold = 50
|
224
224
|
```
|
225
225
|
|
226
226
|
### Digital output 1
|
227
227
|
|
228
228
|
0 = Direction, 1 = Angle, 2 = Range, 3 = Speed, 4 = Micro Detection, default = 0
|
229
229
|
|
230
|
-
alias :dig1
|
230
|
+
alias :dig1
|
231
231
|
|
232
232
|
```ruby
|
233
|
-
|
233
|
+
radar.digital_output1 = 0
|
234
234
|
```
|
235
235
|
|
236
236
|
### Digital output 2
|
237
237
|
|
238
238
|
0 = Direction, 1 = Angle, 2 = Range, 3 = Speed, 4 = Micro Detection, default = 1
|
239
239
|
|
240
|
-
alias :dig2
|
240
|
+
alias :dig2
|
241
241
|
|
242
242
|
```ruby
|
243
|
-
|
243
|
+
radar.digital_output2 = 1
|
244
244
|
```
|
245
245
|
|
246
246
|
### Digital output 3
|
247
247
|
|
248
248
|
0 = Direction, 1 = Angle, 2 = Range, 3 = Speed, 4 = Micro Detection, default = 2
|
249
249
|
|
250
|
-
alias :dig3
|
250
|
+
alias :dig3
|
251
251
|
|
252
252
|
```ruby
|
253
|
-
|
253
|
+
radar.digital_output3 = 2
|
254
254
|
```
|
255
255
|
|
256
256
|
### Hold Time
|
@@ -260,7 +260,7 @@ set_dio_3(2)
|
|
260
260
|
alias :hold
|
261
261
|
|
262
262
|
```ruby
|
263
|
-
|
263
|
+
radar.hold_time = 1
|
264
264
|
```
|
265
265
|
|
266
266
|
### Micro Detection retrigger
|
@@ -270,7 +270,7 @@ set_hold_time(1)
|
|
270
270
|
alias: :mide
|
271
271
|
|
272
272
|
```ruby
|
273
|
-
|
273
|
+
radar.micro_detection_retrigger = 0
|
274
274
|
```
|
275
275
|
|
276
276
|
### Micro Detection sensitivity
|
@@ -280,7 +280,31 @@ set_micro_detection_retrigger(0)
|
|
280
280
|
alias: :mids
|
281
281
|
|
282
282
|
```ruby
|
283
|
-
|
283
|
+
radar.micro_detection_sensitivty = 4
|
284
|
+
```
|
285
|
+
|
286
|
+
## CLI
|
287
|
+
|
288
|
+
``` fish
|
289
|
+
❯ bundle exec rfbeam list
|
290
|
+
|
291
|
+
+--+------------+------------------+
|
292
|
+
|id|Path |Version |
|
293
|
+
+--+------------+------------------+
|
294
|
+
|0 |/dev/ttyUSB0|K-LD7_APP-RFB-0103|
|
295
|
+
+--+------------+------------------+
|
296
|
+
|
297
|
+
❯ bundle exec rfbeam help
|
298
|
+
Commands:
|
299
|
+
rfbeam config <radar_id> # Shows the parameter setting for the Radar module
|
300
|
+
rfbeam ddat <radar_id> -s, [--stream] # stream any valid detections, stop stream with q and enter
|
301
|
+
rfbeam help [COMMAND] # Describe available commands or one specific command
|
302
|
+
rfbeam list # List available radar modules
|
303
|
+
rfbeam pdat <radar_id> # Display Tracked Targets
|
304
|
+
rfbeam reset <radar_id> # Shows the parameter setting for the Radar module
|
305
|
+
rfbeam rfft <radar_id> -s, [--stream] # Display the dopplar radar data as a plot
|
306
|
+
rfbeam set_param <radar_id> <key> <value> # Set radar parameters, see readme for keys
|
307
|
+
rfbeam tdat <radar_id> # Display tracked target data
|
284
308
|
```
|
285
309
|
|
286
310
|
## Development
|
@@ -23,8 +23,8 @@ module RfBeam
|
|
23
23
|
|
24
24
|
# The angle, direction, range and speed flags are only valid if the detection flag is 1.
|
25
25
|
DETECTION_FLAGS = {
|
26
|
-
detection: [
|
27
|
-
micro_detection: [
|
26
|
+
detection: %w[No Yes],
|
27
|
+
micro_detection: %w[No Yes],
|
28
28
|
angle: %w[Left Right],
|
29
29
|
direction: %w[Receding Approaching],
|
30
30
|
range: %w[Far Near],
|
@@ -32,9 +32,9 @@ module RfBeam
|
|
32
32
|
}.freeze
|
33
33
|
|
34
34
|
Param =
|
35
|
-
|
35
|
+
Struct.new(:name, :grps_index, :description, :default, :units, :values) do
|
36
36
|
def initialize(name:, grps_index:, description: nil, default: nil, units: nil, values: [])
|
37
|
-
super(name
|
37
|
+
super(name, grps_index, description, default, units, values)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -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/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,7 +1,7 @@
|
|
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
|
@@ -185,14 +185,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
185
|
requirements:
|
186
186
|
- - ">="
|
187
187
|
- !ruby/object:Gem::Version
|
188
|
-
version: 3.2
|
188
|
+
version: 3.1.2
|
189
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
190
|
requirements:
|
191
191
|
- - ">="
|
192
192
|
- !ruby/object:Gem::Version
|
193
193
|
version: '0'
|
194
194
|
requirements: []
|
195
|
-
rubygems_version: 3.
|
195
|
+
rubygems_version: 3.3.7
|
196
196
|
signing_key:
|
197
197
|
specification_version: 4
|
198
198
|
summary: Ruby API and CLI for RFBeam doplar radar modules
|