rfbeam 0.4.8 → 0.4.9
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/Gemfile.lock +1 -1
- data/README.md +6 -3
- data/lib/rfbeam/kld7/cli_formatter.rb +34 -27
- data/lib/rfbeam/kld7/cli_output.rb +1 -1
- data/lib/rfbeam/kld7/constants.rb +1 -1
- data/lib/rfbeam/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3ca645044245d21d0248633dc68c5ac8608102c0fe4d8a93d825b7735bc225f
|
4
|
+
data.tar.gz: 5a443dad972d3c26d5e462597f166c7fa333bc2294ecd3b0529ad036fbe23375
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46e7f4cadd95cfabce4025d34e3cca666c655510b18e74edd451f3194ff70dfbd25bb116c88380873b34416c69f25274a2ee924ec45ac6913eb7cd76392d2c9d
|
7
|
+
data.tar.gz: f22887f60570dfa98d0430de0a6a487a3da566f1a9776058466015baa09b259026b4d064be99804669fddb9e1703ef8afc5892d5f42e22e6ecca8394278fdc28
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
# Rfbeam
|
2
2
|
|
3
|
-

|
4
3
|

|
5
4
|

|
6
5
|
|
7
|
-
|
8
|
-
|
6
|
+

|
7
|
+

|
8
|
+

|
9
|
+
|
10
|
+
RfBeam is a simple, high-level interface and CLI for the RFBeam radar modules.
|
11
|
+
The user can query/set radar parameters, raw detection data and stream data from the sensor.
|
9
12
|
|
10
13
|
At this stage it only works on Linux and Mac with the K-LD7 module.
|
11
14
|
|
@@ -5,39 +5,46 @@ require 'tty-table'
|
|
5
5
|
module RfBeam
|
6
6
|
module Kld7
|
7
7
|
class CliFormatter
|
8
|
-
def
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
count.times do |index|
|
17
|
-
values = data.shift(4).map { |value| value.to_f / 100.0 }
|
18
|
-
table << [index, values].flatten
|
8
|
+
def format(type, data)
|
9
|
+
case type
|
10
|
+
when :tdat
|
11
|
+
tdat(data)
|
12
|
+
when :pdat
|
13
|
+
pdat_table(data)
|
14
|
+
when :ddat
|
15
|
+
ddat(data)
|
19
16
|
end
|
20
|
-
table
|
21
17
|
end
|
18
|
+
end
|
22
19
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
20
|
+
def tdat(data)
|
21
|
+
{ dist: data[2], speed: data[3], angle: data[4], mag: data[5] }
|
22
|
+
end
|
23
|
+
|
24
|
+
def pdat_table(data)
|
25
|
+
table = TTY::Table.new header: ['index', 'dist (M)', 'speed (Km/h)', 'angle (°)', 'mag (db)']
|
26
|
+
count = data[1] / 8
|
27
|
+
data.shift(2)
|
28
|
+
count.times do |index|
|
29
|
+
values = data.shift(4).map { |value| value.to_f / 100.0 }
|
30
|
+
table << [index, values].flatten
|
33
31
|
end
|
32
|
+
table
|
33
|
+
end
|
34
34
|
|
35
|
-
|
35
|
+
private
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
def ddat(data)
|
38
|
+
labels = ['Detection', 'Micro Detection', 'Angle', 'Direction', 'Range', 'Speed']
|
39
|
+
labels
|
40
|
+
.map
|
41
|
+
.with_index { |label, index| "#{label}: #{DETECTION_FLAGS[to_symbol(label)][data[index + 2]]}" }
|
42
|
+
.join("\n")
|
43
|
+
end
|
44
|
+
|
45
|
+
def to_symbol(string)
|
46
|
+
modified_string = string.gsub(' ', '_').downcase
|
47
|
+
modified_string.to_sym
|
41
48
|
end
|
42
49
|
end
|
43
50
|
end
|
data/lib/rfbeam/version.rb
CHANGED
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.9
|
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-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|