rfbeam 0.4.9 → 0.4.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a3ca645044245d21d0248633dc68c5ac8608102c0fe4d8a93d825b7735bc225f
4
- data.tar.gz: 5a443dad972d3c26d5e462597f166c7fa333bc2294ecd3b0529ad036fbe23375
3
+ metadata.gz: 1d9b598dd013b48a6c19e5755f4af6a687a1fd2b82ac2aaa3d38c3a8b98db2f8
4
+ data.tar.gz: d1bf6b228eb6c0cff37ae44a178c7eb9b1e80e033894d2ae2456e2882d6ac180
5
5
  SHA512:
6
- metadata.gz: 46e7f4cadd95cfabce4025d34e3cca666c655510b18e74edd451f3194ff70dfbd25bb116c88380873b34416c69f25274a2ee924ec45ac6913eb7cd76392d2c9d
7
- data.tar.gz: f22887f60570dfa98d0430de0a6a487a3da566f1a9776058466015baa09b259026b4d064be99804669fddb9e1703ef8afc5892d5f42e22e6ecca8394278fdc28
6
+ metadata.gz: 277a4e68325e439d64db8ffc1af15b5b1aeae5be8b9f9718100d6fd9cdd7bb228274c51a856960d775f8f3ecf041616e59b039acf22b029b990d4b5488793053
7
+ data.tar.gz: 54b6209b877a2304139c8ea615d9fe0437b3393ee75385c00735ffe24279d0940d29b061cf28f6fbe47cdd7c5a2b208aecffe97a49b266f2aa8fad751cf52ae2
data/Gemfile.lock CHANGED
@@ -9,7 +9,7 @@ GIT
9
9
  PATH
10
10
  remote: .
11
11
  specs:
12
- rfbeam (0.4.9)
12
+ rfbeam (0.4.10)
13
13
  activesupport (~> 6.1.0)
14
14
  rubyserial (~> 0.6.0)
15
15
  thor (~> 1.2.1)
data/README.md CHANGED
@@ -26,75 +26,90 @@ If bundler is not being used to manage dependencies, install the gem by executin
26
26
 
27
27
  The RfBeam class will return the path of any connected modules
28
28
 
29
- RfBeam.connected
29
+ ```ruby
30
+ RfBeam.connected
31
+ => ["/dev/ttyUSB0"]
32
+ ```
30
33
 
31
- Simple pass the path and baude rate to initialise a new radar object
34
+ Simple pass the path and optional baude rate (default: 115200) to initialise a new radar object
32
35
 
33
- RfBeam::KLD7.new("/dev/ttyUSB0", 115200) do |radar|
34
- puts radar.config
35
- end
36
+ ```ruby
37
+ RfBeam::KLD7.new("/dev/ttyUSB0") do |radar|
38
+ puts radar.config
39
+ end
40
+ =>
41
+ Software Version: K-LD7_APP-RFB-0103
42
+ Base Frequency: Low
43
+ Maximum Speed: 100km/h
44
+ Maximum Range: 100m
45
+ Threshold Offset: 30db
46
+ Tracking Filter Type: Long Visibility
47
+ Vibration Suppression: 16
48
+ Minimum Detection Distance: 0%
49
+ Maximum Detection Distance: 100%
50
+ Minimum Detection Angle: -10°
51
+ Maximum Detection Angle: 90°
52
+ Minimum Detection Speed: 0%
53
+ Maximum Detection Speed: 100%
54
+ Detection Direction: Both
55
+ Range Threshold: 10%
56
+ Angle Threshold: 0°
57
+ Speed Threshold: 50%
58
+ Digital Output 1: Direction
59
+ Digital Output 2: Angle
60
+ Digital Output 3: Range
61
+ Hold Time: 1s
62
+ Micro Detection Trigger: Off
63
+ Micro Detection Sensativity: 4
64
+ ```
36
65
 
37
- ## RfBeam::K_ld7 API
66
+ ## RfBeam::KLD7 API
38
67
 
39
68
  ### detection?
40
69
 
41
70
  Returns true if the module has a valid detection.
42
71
 
43
- radar.detection?
44
- => true
72
+ ```ruby
73
+ radar.detection?
74
+ => true
75
+ ```
45
76
 
46
77
  ### ddat
47
78
 
48
79
  Returns an array with the current detection values
49
80
 
50
- radar.ddat
51
- => ["DDAT", 6, 0, 0, 0, 0, 0, 0]
81
+ ```ruby
82
+ radar.ddat
83
+ => ["DDAT", 6, 0, 0, 0, 0, 0, 0]
84
+ ```
52
85
 
53
86
  ### tdat
54
87
 
55
88
  Returns a hash with the current tracked object values
56
89
 
57
- radar.tdat
58
- => {:dist=>68, :speed=>196, :angle=>469, :mag=>6303}
90
+ ```ruby
91
+ radar.tdat
92
+ => ["TDAT", 4, 68, 196, 469, 6303]
93
+ ```
59
94
 
60
95
  ### grps
61
96
 
62
97
  Returns the Parameter settings, values map to setting as detailed in the device datasheet.
63
98
 
64
- radar.grps
65
- => ["RPST", 42, "K-LD7_APP-RFB-0103", 1, 1, 1, 30, 0, 2, 0, 50, -90, 90, 0, 100, 2, 10, 0, 50, 0, 1, 2, 1, 0, 4]
99
+ ```ruby
100
+ radar.grps
101
+ => ["RPST", 42, "K-LD7_APP-RFB-0103", 1, 1, 1, 30, 0, 2, 0, 50, -90, 90, 0, 100, 2, 10, 0, 50, 0, 1, 2, 1, 0, 4]
102
+ ```
66
103
 
67
104
  ### config
68
105
 
69
106
  Returns a formatted String of all parameter settings. The only way to read parameter settings is with config
70
107
 
71
- radar.config
72
-
73
- Software Version: K-LD7_APP-RFB-0103
74
- Base Frequency: Low
75
- Maximum Speed: 100km/h
76
- Maximum Range: 100m
77
- Threshold Offset: 30db
78
- Tracking Filter Type: Long Visibility
79
- Vibration Suppression: 16
80
- Minimum Detection Distance: 0%
81
- Maximum Detection Distance: 100%
82
- Minimum Detection Angle: -10°
83
- Maximum Detection Angle: 90°
84
- Minimum Detection Speed: 0%
85
- Maximum Detection Speed: 100%
86
- Detection Direction: Both
87
- Range Threshold: 10%
88
- Angle Threshold: 0°
89
- Speed Threshold: 50%
90
- Digital Output 1: Direction
91
- Digital Output 2: Angle
92
- Digital Output 3: Range
93
- Hold Time: 1s
94
- Micro Detection Trigger: Off
95
- Micro Detection Sensativity: 4
96
-
97
- ## Parameter API
108
+ ```ruby
109
+ radar.config
110
+ ```
111
+
112
+ ## Radar Parameters
98
113
 
99
114
  ### Base Frequency
100
115
 
@@ -318,7 +333,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
318
333
 
319
334
  ## Contributing
320
335
 
321
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rfbeam.
336
+ Bug reports and pull requests are welcome on GitHub at https://github.com/robcarruthers/rfbeam.
322
337
 
323
338
  ## License
324
339
 
data/lib/rfbeam/cli.rb CHANGED
@@ -36,7 +36,7 @@ module RfBeam
36
36
 
37
37
  desc 'set_param <radar_id> <key> <value>', 'Set radar parameters, see readme for keys'
38
38
  def set_param(radar_id, param, value)
39
- return @logger.warn("Invalid param: '#{param}'") unless RfBeam::K_ld7::RADAR_PARAMETERS.include?(param.to_sym)
39
+ return @logger.warn("Invalid param: '#{param}'") unless Kld7::RADAR_PARAMETERS.include?(param.to_sym)
40
40
 
41
41
  r = radar(radar_id)
42
42
  r.send("#{param}=", value.to_i)
@@ -10,41 +10,41 @@ module RfBeam
10
10
  when :tdat
11
11
  tdat(data)
12
12
  when :pdat
13
- pdat_table(data)
13
+ pdat(data)
14
14
  when :ddat
15
15
  ddat(data)
16
16
  end
17
17
  end
18
- end
19
18
 
20
- def tdat(data)
21
- { dist: data[2], speed: data[3], angle: data[4], mag: data[5] }
22
- end
19
+ def tdat(data)
20
+ { dist: data[2], speed: data[3], angle: data[4], mag: data[5] }
21
+ end
23
22
 
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
23
+ def pdat_table(data)
24
+ table = TTY::Table.new header: ['index', 'dist (M)', 'speed (Km/h)', 'angle (°)', 'mag (db)']
25
+ count = data[1] / 8
26
+ data.shift(2)
27
+ count.times do |index|
28
+ values = data.shift(4).map { |value| value.to_f / 100.0 }
29
+ table << [index, values].flatten
30
+ end
31
+ table
31
32
  end
32
- table
33
- end
34
33
 
35
- private
34
+ private
36
35
 
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
36
+ def ddat(data)
37
+ labels = ['Detection', 'Micro Detection', 'Angle', 'Direction', 'Range', 'Speed']
38
+ labels
39
+ .map
40
+ .with_index { |label, index| "#{label}: #{DETECTION_FLAGS[to_symbol(label)][data[index + 2]]}" }
41
+ .join("\n")
42
+ end
44
43
 
45
- def to_symbol(string)
46
- modified_string = string.gsub(' ', '_').downcase
47
- modified_string.to_sym
44
+ def to_symbol(string)
45
+ modified_string = string.gsub(' ', '_').downcase
46
+ modified_string.to_sym
47
+ end
48
48
  end
49
49
  end
50
50
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RfBeam
4
- VERSION = '0.4.9'
4
+ VERSION = '0.4.10'
5
5
  end
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.9
4
+ version: 0.4.10
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-10 00:00:00.000000000 Z
11
+ date: 2023-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport