spektrum-log 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dec4a1dd92edda247f52253077d7250e8c75ee85
4
+ data.tar.gz: 2fb34f2061464fded588dad071da60f6e8ebfc85
5
+ SHA512:
6
+ metadata.gz: 962ebb95317415c1e7493fd3a9309f02019387fc5eb9858b61ef54177f6d279882c073b49367fa9e656e13e947b6ac774727d37dc2910818318accfee30c1944
7
+ data.tar.gz: e1055ef8478a79ea14fc67a94d23a25c7e64142d398641609e4e6378deb6b156758b61a4a5ccb4d70bfbb458d7a64ad84ccbbe7825a53f5c076ee16856c95185
@@ -51,7 +51,7 @@ module Spektrum
51
51
  #
52
52
  # @return [String] model name
53
53
  def model_name
54
- @model_name ||= @headers.first.raw_data[8..18].unpack('Z*')[0].strip
54
+ @model_name ||= @headers.first.raw_data[8..27].unpack('Z*')[0].strip
55
55
  end
56
56
 
57
57
  # Gets the model's index from the transmitter.
@@ -175,13 +175,20 @@ module Spektrum
175
175
  end
176
176
  end
177
177
 
178
+ # + N, - S
178
179
  def latitude
179
180
  elements = 6.downto(3).map { |i| hex_byte_field(i) }
180
- @latitude ||= convert_latlon(elements)
181
+ @latitude ||= convert_latlon([0, elements].flatten)
181
182
  end
182
183
 
184
+ # + E, - W
183
185
  def longitude
184
186
  elements = 10.downto(7).map { |i| hex_byte_field(i) }
187
+
188
+ # upper nybble of 13th byte seems to change when 100+ longitude
189
+ # is encountered... this is a guess!!!
190
+ elements = [byte_field(13) >> 4, elements].flatten
191
+
185
192
  @longitude ||= convert_latlon(elements)
186
193
  end
187
194
 
@@ -196,8 +203,8 @@ module Spektrum
196
203
  private
197
204
 
198
205
  def convert_latlon elts
199
- raise ArgumentError unless elts.length == 4
200
- elts[0] + ("#{elts[1]}.#{elts[2]}#{elts[3]}".to_f / 60.0)
206
+ raise ArgumentError unless elts.length == 5
207
+ elts[0] * 100 + elts[1] + ("#{elts[2]}.#{elts[3]}#{elts[4]}".to_f / 60.0)
201
208
  end
202
209
 
203
210
  end
@@ -1,5 +1,5 @@
1
1
  module Spektrum
2
2
  module Log
3
- VERSION = "0.0.9"
3
+ VERSION = "0.0.10"
4
4
  end
5
5
  end
data/spec/flight_spec.rb CHANGED
@@ -82,12 +82,54 @@ describe Spektrum::Log::Flight do
82
82
 
83
83
  its(:bind_type) { should eql('DSMX') }
84
84
 
85
- its(:model_name) { should eql('Voodoo 600') }
85
+ its(:model_name) { should eql('Voodoo 600 SK540') }
86
86
 
87
87
  its(:model_number) { should eql(1) }
88
88
 
89
89
  its(:model_type) { should eql('Helicopter') }
90
90
 
91
+ its(:to_kml?) { should be_false }
92
+
93
+ end
94
+
95
+ context 'flight 305' do
96
+
97
+ subject { reader.flights[304] }
98
+
99
+ its(:model_name) { should eql('ERW|N XL ULTRALIGHT') }
100
+
101
+ its(:to_kml?) { should be_true }
102
+
103
+ end
104
+
105
+ context 'flight 306' do
106
+
107
+ subject { reader.flights[305] }
108
+
109
+ its(:model_name) { should eql('ERW|N XL ULTRALIGHT') }
110
+
111
+ its(:to_kml?) { should be_true }
112
+
113
+ end
114
+
115
+ context 'flight 308' do
116
+
117
+ subject { reader.flights[307] }
118
+
119
+ its(:model_name) { should eql('ERW|N XL ULTRALIGHT') }
120
+
121
+ its(:to_kml?) { should be_true }
122
+
123
+ end
124
+
125
+ context 'flight 312' do
126
+
127
+ subject { reader.flights[311] }
128
+
129
+ its(:model_name) { should eql('ERW|N XL ULTRALIGHT') }
130
+
131
+ its(:to_kml?) { should be_true }
132
+
91
133
  end
92
134
 
93
135
  end
@@ -18,7 +18,7 @@ describe Spektrum::Log::GPSRecord1 do
18
18
  subject.altitude(:meters).should be_within(0.1).of(8.7)
19
19
  end
20
20
 
21
- its(:heading) { should be_within(0.01).of(334.6)}
21
+ its(:heading) { should be_within(0.1).of(334.6)}
22
22
 
23
23
  its(:latitude) { should be_within(0.000001).of(54.670307) }
24
24
 
@@ -36,7 +36,43 @@ describe Spektrum::Log::GPSRecord1 do
36
36
  subject.altitude(:meters).should be_within(0.1).of(26.6)
37
37
  end
38
38
 
39
- its(:heading) { should be_within(0.01).of(303.0)}
39
+ its(:heading) { should be_within(0.1).of(303.0)}
40
+
41
+ end
42
+
43
+ context 'data set 3' do
44
+
45
+ let(:raw_data) { ["00130052242101046851036804153F"].pack('H*') }
46
+
47
+ its(:altitude) { should be_within(0.1).of(4.3) }
48
+
49
+ it 'should allow altitude in meters' do
50
+ subject.altitude(:meters).should be_within(0.1).of(1.3)
51
+ end
52
+
53
+ its(:heading) { should be_within(0.1).of(46.8)}
54
+
55
+ its(:latitude) { should be_within(0.000001).of(1.354086) }
56
+
57
+ its(:longitude) { should be_within(0.000001).of(103.861399) }
58
+
59
+ end
60
+
61
+ context 'data set 4' do
62
+
63
+ let(:raw_data) { ["00560359222101676651038623141F"].pack('H*') }
64
+
65
+ its(:altitude) { should be_within(0.1).of(116.8) }
66
+
67
+ it 'should allow altitude in meters' do
68
+ subject.altitude(:meters).should be_within(0.1).of(35.6)
69
+ end
70
+
71
+ its(:heading) { should be_within(0.1).of(238.6)}
72
+
73
+ its(:latitude) { should be_within(0.000001).of(1.353765) }
74
+
75
+ its(:longitude) { should be_within(0.000001).of(103.861111) }
40
76
 
41
77
  end
42
78
 
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spektrum-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
5
- prerelease:
4
+ version: 0.0.10
6
5
  platform: ruby
7
6
  authors:
8
7
  - Nick Veys
@@ -14,7 +13,6 @@ dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: awesome_print
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: bundler
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: ci_reporter
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - '='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - '='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rspec
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ~>
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ~>
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: simplecov
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ! '>='
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ! '>='
108
95
  - !ruby/object:Gem::Version
@@ -110,7 +97,6 @@ dependencies:
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: simplecov-gem-adapter
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
101
  - - ! '>='
116
102
  - !ruby/object:Gem::Version
@@ -118,7 +104,6 @@ dependencies:
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
108
  - - ! '>='
124
109
  - !ruby/object:Gem::Version
@@ -126,7 +111,6 @@ dependencies:
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: simplecov-rcov
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
115
  - - ! '>='
132
116
  - !ruby/object:Gem::Version
@@ -134,7 +118,6 @@ dependencies:
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
122
  - - ! '>='
140
123
  - !ruby/object:Gem::Version
@@ -142,7 +125,6 @@ dependencies:
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: ruby_kml
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
129
  - - ~>
148
130
  - !ruby/object:Gem::Version
@@ -150,7 +132,6 @@ dependencies:
150
132
  type: :runtime
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
136
  - - ~>
156
137
  - !ruby/object:Gem::Version
@@ -191,27 +172,26 @@ files:
191
172
  homepage: ''
192
173
  licenses:
193
174
  - MIT
175
+ metadata: {}
194
176
  post_install_message:
195
177
  rdoc_options: []
196
178
  require_paths:
197
179
  - lib
198
180
  required_ruby_version: !ruby/object:Gem::Requirement
199
- none: false
200
181
  requirements:
201
182
  - - ! '>='
202
183
  - !ruby/object:Gem::Version
203
184
  version: '0'
204
185
  required_rubygems_version: !ruby/object:Gem::Requirement
205
- none: false
206
186
  requirements:
207
187
  - - ! '>='
208
188
  - !ruby/object:Gem::Version
209
189
  version: '0'
210
190
  requirements: []
211
191
  rubyforge_project:
212
- rubygems_version: 1.8.22
192
+ rubygems_version: 2.0.3
213
193
  signing_key:
214
- specification_version: 3
194
+ specification_version: 4
215
195
  summary: Spektrum TLM log file reader
216
196
  test_files:
217
197
  - spec/basic_data_record_spec.rb
@@ -221,3 +201,4 @@ test_files:
221
201
  - spec/gps_record2_spec.rb
222
202
  - spec/reader_spec.rb
223
203
  - spec/spec_helper.rb
204
+ has_rdoc: