spektrum-log 0.0.13 → 0.0.14

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: 3273a5b15027e4c72b4447bd283dc345dd4dc005
4
+ data.tar.gz: ed6cde1b8223a9cd2191c940a297c503748951c9
5
+ SHA512:
6
+ metadata.gz: bcda6474caa68201bef60f8b99533b41a6b5d8ae10e3b562660930af6015b6b826f415f5b0cec0c1bd77659cc19f425f439fedc50e8854061c87e413081d50e6
7
+ data.tar.gz: 0a9ae4eec82b6792136d301e8435e29e14eee18de7158e0f6052b4fdc9c63075e8013dfcd4ba7c6d72f16b3735fc7568aca7f5188c984cbbafc84523c568ee90
data/data/X5-GPS1.TLM ADDED
Binary file
@@ -193,12 +193,17 @@ module Spektrum
193
193
  def longitude
194
194
  elements = 10.downto(7).map { |i| hex_byte_field(i) }
195
195
 
196
- # 100+ longitude indicator guesses
197
- # - upper nybble of 13th byte seemed right, nope...
198
- # - current guess: 2nd bit of 14th byte...
199
- elements = [((byte_field(14) & 0x04) == 0x04) ? 1 : 0, elements].flatten
196
+ # 100+ longitude indicator guesses (X marks proven invalid guess):
197
+ # X upper nybble of 13th byte
198
+ # - 2nd bit of 14th byte
199
+ hundreds = ((byte_field(14) & 0x04) == 0x04) ? 1 : 0
200
200
 
201
- @longitude ||= convert_latlon(elements)
201
+ # +/- longitude indicator guesses (X marks proven invalid guess):
202
+ # - 1st bit of 14th byte (1 - pos, 0 - neg)
203
+ multiplier = ((byte_field(14) & 0x02) == 0x02) ? 1 : -1
204
+
205
+ elements = [hundreds, elements].flatten
206
+ @longitude ||= multiplier * convert_latlon(elements)
202
207
  end
203
208
 
204
209
  def coordinate
@@ -1,5 +1,5 @@
1
1
  module Spektrum
2
2
  module Log
3
- VERSION = "0.0.13"
3
+ VERSION = "0.0.14"
4
4
  end
5
5
  end
data/spec/flight_spec.rb CHANGED
@@ -390,4 +390,28 @@ describe Spektrum::Log::Flight do
390
390
 
391
391
  end
392
392
 
393
+ context 'data file X5-GPS1.TLM' do
394
+
395
+ let(:reader) { Spektrum::Log::Reader.new(data_file('X5-GPS1.TLM')) }
396
+
397
+ its 'flights should contain some gps coordinates' do
398
+
399
+ reader.flights.select { |f| f.gps1_records? }.should have(4).flights
400
+
401
+ end
402
+
403
+ its 'longitudes should all be negative' do
404
+
405
+ reader.flights.each do |flight|
406
+
407
+ flight.gps1_records.each do |gps1|
408
+ gps1.longitude.should be < 0.0
409
+ end
410
+
411
+ end
412
+
413
+ end
414
+
415
+ end
416
+
393
417
  end
@@ -94,4 +94,40 @@ describe Spektrum::Log::GPSRecord1 do
94
94
 
95
95
  end
96
96
 
97
+ context 'data set 6' do
98
+
99
+ let(:raw_data) { ["007430561011417459009672350939"].pack('H*') }
100
+
101
+ its(:altitude) { should be_within(0.1).of(1008.5) }
102
+
103
+ it 'should allow altitude in meters' do
104
+ subject.altitude(:meters).should be_within(0.1).of(307.4)
105
+ end
106
+
107
+ its(:heading) { should be_within(0.1).of(357.2)}
108
+
109
+ its(:latitude) { should be_within(0.000001).of(41.185093) }
110
+
111
+ its(:longitude) { should be_within(0.000001).of(-96.009956) }
112
+
113
+ end
114
+
115
+ context 'data set 7' do
116
+
117
+ let(:raw_data) { ["005518231111415959009602100939"].pack('H*') }
118
+
119
+ its(:altitude) { should be_within(0.1).of(608.6) }
120
+
121
+ it 'should allow altitude in meters' do
122
+ subject.altitude(:meters).should be_within(0.1).of(185.5)
123
+ end
124
+
125
+ its(:heading) { should be_within(0.1).of(100.2)}
126
+
127
+ its(:latitude) { should be_within(0.000001).of(41.185205) }
128
+
129
+ its(:longitude) { should be_within(0.000001).of(-96.009932) }
130
+
131
+ end
132
+
97
133
  end
metadata CHANGED
@@ -1,36 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spektrum-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
5
- prerelease:
4
+ version: 0.0.14
6
5
  platform: ruby
7
6
  authors:
8
7
  - Nick Veys
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-27 00:00:00.000000000 Z
11
+ date: 2013-07-01 00:00:00.000000000 Z
13
12
  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
21
19
  version: '0'
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
29
26
  version: '0'
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,55 +83,48 @@ 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
101
89
  version: '0'
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
109
96
  version: '0'
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
117
103
  version: '0'
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
125
110
  version: '0'
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
133
117
  version: '0'
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
141
124
  version: '0'
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
@@ -175,6 +156,7 @@ files:
175
156
  - data/4.TLM
176
157
  - data/GPS.TLM
177
158
  - data/GPS2.TLM
159
+ - data/X5-GPS1.TLM
178
160
  - lib/spektrum/log.rb
179
161
  - lib/spektrum/log/flight.rb
180
162
  - lib/spektrum/log/headers.rb
@@ -192,33 +174,26 @@ files:
192
174
  homepage: ''
193
175
  licenses:
194
176
  - MIT
177
+ metadata: {}
195
178
  post_install_message:
196
179
  rdoc_options: []
197
180
  require_paths:
198
181
  - lib
199
182
  required_ruby_version: !ruby/object:Gem::Requirement
200
- none: false
201
183
  requirements:
202
- - - ! '>='
184
+ - - '>='
203
185
  - !ruby/object:Gem::Version
204
186
  version: '0'
205
- segments:
206
- - 0
207
- hash: 1818794528585278686
208
187
  required_rubygems_version: !ruby/object:Gem::Requirement
209
- none: false
210
188
  requirements:
211
- - - ! '>='
189
+ - - '>='
212
190
  - !ruby/object:Gem::Version
213
191
  version: '0'
214
- segments:
215
- - 0
216
- hash: 1818794528585278686
217
192
  requirements: []
218
193
  rubyforge_project:
219
- rubygems_version: 1.8.25
194
+ rubygems_version: 2.0.3
220
195
  signing_key:
221
- specification_version: 3
196
+ specification_version: 4
222
197
  summary: Spektrum TLM log file reader
223
198
  test_files:
224
199
  - spec/basic_data_record_spec.rb