spektrum-log 0.0.11 → 0.0.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d12a83ac543c601321ea4e302f68675bac9fe13c
4
- data.tar.gz: e92ea2f69badd802397c35324fc7167edc4907d5
3
+ metadata.gz: 29e09913bbcf8a10fdf8ca401cdd3d8560eb76e5
4
+ data.tar.gz: 996e2b67693ebbf1a22dc68bafb074647c592cc9
5
5
  SHA512:
6
- metadata.gz: 9fb5e5cad6d308a92031d7c2b90c77008eec37d401aa6f854f26eaac99510954fa9f7394eb0b9c8008e01578f59d52ae86bf1b19e0e23cc372713e94ef452bb0
7
- data.tar.gz: 0d8c3a79b51fb6f9a38d8a0ddf391e61517e495adf433d295d9751bbb63937911c65cdf723d09650cc9a7d5133546f8ddce752dfd6a6203b3216990a6352ec48
6
+ metadata.gz: 01a4d6d4f016ce368b756cee96afcfe45df6dce84fdd49dd9a0a0ada5ecbc1452f3af1fb74db5bab44d0f419eee8e0c676d1376a6cddb61290586a46abc3f099
7
+ data.tar.gz: f2d43b65a285a547c89cbf4c2f60cfe4047f499b65144afc5f1fe25c96e7f8d40f223f83d747bf1a66ffedaa09fea2789993c8ee43517451024e172207e986ff
data/data/GPS2.TLM ADDED
Binary file
@@ -185,9 +185,10 @@ module Spektrum
185
185
  def longitude
186
186
  elements = 10.downto(7).map { |i| hex_byte_field(i) }
187
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
188
+ # 100+ longitude indicator guesses
189
+ # - upper nybble of 13th byte seemed right, nope...
190
+ # - current guess: 2nd bit of 14th byte...
191
+ elements = [((byte_field(14) & 0x04) == 0x04) ? 1 : 0, elements].flatten
191
192
 
192
193
  @longitude ||= convert_latlon(elements)
193
194
  end
@@ -1,5 +1,5 @@
1
1
  module Spektrum
2
2
  module Log
3
- VERSION = "0.0.11"
3
+ VERSION = "0.0.12"
4
4
  end
5
5
  end
data/spec/flight_spec.rb CHANGED
@@ -342,4 +342,38 @@ describe Spektrum::Log::Flight do
342
342
 
343
343
  end
344
344
 
345
+ context 'data file GPS2.TLM' do
346
+
347
+ let(:reader) { Spektrum::Log::Reader.new(data_file('GPS2.TLM')) }
348
+
349
+ context 'flight 1' do
350
+
351
+ subject { reader.flights[0] }
352
+
353
+ its(:duration) { should be_within(1).of(129) }
354
+
355
+ its(:gps1_records?) { should be_true }
356
+
357
+ its(:gps2_records?) { should be_true }
358
+
359
+ its(:to_kml?) { should be_true }
360
+
361
+ end
362
+
363
+ context 'flight 2' do
364
+
365
+ subject { reader.flights[1] }
366
+
367
+ its(:duration) { should be_within(1).of(89) }
368
+
369
+ its(:gps1_records?) { should be_true }
370
+
371
+ its(:gps2_records?) { should be_true }
372
+
373
+ its(:to_kml?) { should be_true }
374
+
375
+ end
376
+
377
+ end
378
+
345
379
  end
@@ -76,4 +76,22 @@ describe Spektrum::Log::GPSRecord1 do
76
76
 
77
77
  end
78
78
 
79
+ context 'data set 5' do
80
+
81
+ let(:raw_data) { ["00142125250249434045084625183B"].pack('H*') }
82
+
83
+ its(:altitude) { should be_within(0.1).of(693.6) }
84
+
85
+ it 'should allow altitude in meters' do
86
+ subject.altitude(:meters).should be_within(0.1).of(211.4)
87
+ end
88
+
89
+ its(:heading) { should be_within(0.1).of(254.6)}
90
+
91
+ its(:latitude) { should be_within(0.000001).of(49.037542) }
92
+
93
+ its(:longitude) { should be_within(0.000001).of(8.756738) }
94
+
95
+ end
96
+
79
97
  end
data/spec/reader_spec.rb CHANGED
@@ -52,6 +52,16 @@ describe Spektrum::Log::Reader do
52
52
 
53
53
  end
54
54
 
55
+ context 'data file GPS2.TLM' do
56
+
57
+ subject { Spektrum::Log::Reader.new(data_file('GPS2.TLM')) }
58
+
59
+ it { should have(2).flights }
60
+
61
+ its(:duration) { should be_within(0.1).of(217.8) }
62
+
63
+ end
64
+
55
65
  it 'should raise on bad input' do
56
66
  expect { Spektrum::Log::Reader.new(__FILE__) }.to raise_error
57
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spektrum-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Veys
@@ -155,6 +155,7 @@ files:
155
155
  - data/3.TLM
156
156
  - data/4.TLM
157
157
  - data/GPS.TLM
158
+ - data/GPS2.TLM
158
159
  - lib/spektrum/log.rb
159
160
  - lib/spektrum/log/flight.rb
160
161
  - lib/spektrum/log/headers.rb