jeti-log 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -137,6 +137,8 @@ describe Jeti::Log::File do
137
137
  expect(loc.course).to eql(0)
138
138
  end
139
139
 
140
+ its(:mezon_data?) { should be_false }
141
+
140
142
  its(:to_kml?) { should be_true }
141
143
 
142
144
  its(:to_kml) { should be_a(String) }
@@ -165,31 +167,34 @@ describe Jeti::Log::File do
165
167
 
166
168
  its(:antenna2_signals?) { should be_true }
167
169
 
168
- its(:bec_voltages?) { should be_true }
169
-
170
- it 'should have some select bec voltages' do
171
- expect(subject.bec_voltages[0]).to eql([1009713, 5.5])
172
- expect(subject.bec_voltages[10]).to eql([1012219, 5.5])
173
- expect(subject.bec_voltages[35]).to eql([1018579, 5.5])
174
- end
175
-
176
- its(:esc_voltages?) { should be_true }
177
-
178
- it 'should have some select esc voltages' do
179
- expect(subject.esc_voltages[0]).to eql([1009713, 22.9])
180
- expect(subject.esc_voltages[10]).to eql([1011179, 22.9])
181
- expect(subject.esc_voltages[50]).to eql([1016099, 22.9])
182
- expect(subject.esc_voltages[60]).to eql([1017179, 22.9])
183
- end
184
-
185
- its(:esc_temperatures?) { should be_true }
186
-
187
170
  its(:rx_voltages?) { should be_true }
188
171
 
189
172
  its(:signal_qualities?) { should be_true }
190
173
 
191
174
  its(:mgps_locations?) { should be_false }
192
175
 
176
+ its(:mezon_data?) { should be_true }
177
+
178
+ it 'should have some select mezon data' do
179
+ d = subject.mezon_data[0]
180
+ expect(d.battery_current).to be_within(0.1).of(0)
181
+ expect(d.battery_voltage).to be_within(0.1).of(22.9)
182
+ expect(d.bec_current).to be_within(0.1).of(0.1)
183
+ expect(d.bec_voltage).to be_within(0.1).of(5.5)
184
+
185
+ d = subject.mezon_data[35]
186
+ expect(d.battery_current).to be_within(0.1).of(0)
187
+ expect(d.battery_voltage).to be_within(0.1).of(22.9)
188
+ expect(d.bec_current).to be_within(0.1).of(0.1)
189
+ expect(d.bec_voltage).to be_within(0.1).of(5.5)
190
+
191
+ d = subject.mezon_data[60]
192
+ expect(d.battery_current).to be_within(0.1).of(0)
193
+ expect(d.battery_voltage).to be_within(0.1).of(22.9)
194
+ expect(d.bec_current).to be_within(0.1).of(0.1)
195
+ expect(d.bec_voltage).to be_within(0.1).of(5.5)
196
+ end
197
+
193
198
  its(:to_kml?) { should be_false }
194
199
 
195
200
  specify { expect { subject.to_kml }.to raise_error }
@@ -212,34 +217,61 @@ describe Jeti::Log::File do
212
217
 
213
218
  its(:antenna2_signals?) { should be_true }
214
219
 
215
- its(:bec_voltages?) { should be_true }
220
+ its(:rx_voltages?) { should be_true }
216
221
 
217
- it 'should have some select bec voltages' do
218
- expect(subject.bec_voltages[0]).to eql([304210, 5.5])
219
- expect(subject.bec_voltages[10]).to eql([306719, 5.5])
220
- expect(subject.bec_voltages[50]).to eql([316519, 5.5])
221
- expect(subject.bec_voltages[120]).to eql([333722, 5.5])
222
- end
222
+ its(:signal_qualities?) { should be_true }
223
223
 
224
- its(:esc_voltages?) { should be_true }
224
+ its(:mgps_locations?) { should be_false }
225
225
 
226
- it 'should have some select esc voltages' do
227
- expect(subject.esc_voltages[0]).to eql([304210, 46.2])
228
- expect(subject.esc_voltages[10]).to eql([305578, 46.2])
229
- expect(subject.esc_voltages[50]).to eql([310319, 46.2])
230
- expect(subject.esc_voltages[160]).to eql([323800, 46.2])
226
+ its(:mezon_data?) { should be_true }
227
+
228
+ it 'should have some select mezon data' do
229
+ d = subject.mezon_data[0]
230
+ expect(d.battery_current).to be_within(0.1).of(0)
231
+ expect(d.battery_voltage).to be_within(0.1).of(46.2)
232
+ expect(d.bec_current).to be_within(0.1).of(0.1)
233
+ expect(d.bec_voltage).to be_within(0.1).of(5.5)
234
+ expect(d.temperature(:c)).to be_within(0.1).of(17)
235
+ expect(d.temperature(:f)).to be_within(0.1).of(62.6)
236
+
237
+ d = subject.mezon_data[20]
238
+ expect(d.battery_current).to be_within(0.1).of(0)
239
+ expect(d.battery_voltage).to be_within(0.1).of(46.2)
240
+ expect(d.bec_current).to be_within(0.1).of(0.1)
241
+ expect(d.bec_voltage).to be_within(0.1).of(5.5)
242
+ expect(d.temperature(:c)).to be_within(0.1).of(17)
243
+ expect(d.temperature(:f)).to be_within(0.1).of(62.6)
244
+
245
+ d = subject.mezon_data[220]
246
+ expect(d.battery_current).to be_within(0.1).of(0)
247
+ expect(d.battery_voltage).to be_within(0.1).of(46.1)
248
+ expect(d.bec_current).to be_within(0.1).of(0.1)
249
+ expect(d.bec_voltage).to be_within(0.1).of(5.5)
250
+ expect(d.temperature(:c)).to be_within(0.1).of(16)
251
+ expect(d.temperature(:f)).to be_within(0.1).of(60.8)
231
252
  end
232
253
 
233
- its(:esc_temperatures?) { should be_true }
254
+ its(:to_kml?) { should be_false }
234
255
 
235
- it 'should have some select esc temperatures' do
236
- expect(subject.esc_temperatures(:c)[0]).to eql([304210, 17])
237
- expect(subject.esc_temperatures(:f)[0]).to eql([304210, 62.6])
238
- expect(subject.esc_temperatures(:c)[10]).to eql([310018, 17])
239
- expect(subject.esc_temperatures(:f)[10]).to eql([310018, 62.6])
240
- expect(subject.esc_temperatures(:c)[50]).to eql([334623, 16])
241
- expect(subject.esc_temperatures(:f)[50]).to eql([334623, 60.8])
242
- end
256
+ specify { expect { subject.to_kml }.to raise_error }
257
+
258
+ specify { expect { subject.to_kml_file }.to raise_error }
259
+
260
+ specify { expect { subject.to_kml_placemark }.to raise_error }
261
+
262
+ end
263
+
264
+ context 'with data file mezon-3.log' do
265
+
266
+ before(:all) { @file = Jeti::Log::File.new(data_file('mezon-3.log')) }
267
+
268
+ subject { @file }
269
+
270
+ its(:duration) { should be_within(1).of(371) }
271
+
272
+ its(:antenna1_signals?) { should be_true }
273
+
274
+ its(:antenna2_signals?) { should be_true }
243
275
 
244
276
  its(:rx_voltages?) { should be_true }
245
277
 
@@ -247,6 +279,75 @@ describe Jeti::Log::File do
247
279
 
248
280
  its(:mgps_locations?) { should be_false }
249
281
 
282
+ its(:mezon_data?) { should be_true }
283
+
284
+ it 'should have some select mezon data' do
285
+ d = subject.mezon_data[0]
286
+ expect(d.time).to eql(180401)
287
+ expect(d.battery_current).to eql(0)
288
+ expect(d.battery_voltage).to be_within(0.1).of(49.8)
289
+ expect(d.bec_current).to be_within(0.1).of(0.0)
290
+ expect(d.bec_voltage).to be_within(0.1).of(5.5)
291
+ expect(d.temperature(:c)).to be_within(0.1).of(21)
292
+ expect(d.temperature(:f)).to be_within(0.1).of(69.8)
293
+ expect(d.capacity).to eql(0)
294
+ expect(d.rpm).to eql(0)
295
+ expect(d.run_time).to eql(0)
296
+ expect(d.pwm).to eql(0)
297
+
298
+ d = subject.mezon_data[200]
299
+ expect(d.time).to eql(200528)
300
+ expect(d.battery_current).to eql(5)
301
+ expect(d.battery_voltage).to be_within(0.1).of(49.4)
302
+ expect(d.bec_current).to be_within(0.1).of(0.0)
303
+ expect(d.bec_voltage).to be_within(0.1).of(5.5)
304
+ expect(d.temperature(:c)).to be_within(0.1).of(23)
305
+ expect(d.temperature(:f)).to be_within(0.1).of(73.4)
306
+ expect(d.capacity).to eql(10)
307
+ expect(d.rpm).to eql(1732)
308
+ expect(d.run_time).to eql(14)
309
+ expect(d.pwm).to eql(26)
310
+
311
+ d = subject.mezon_data[500]
312
+ expect(d.time).to eql(230044)
313
+ expect(d.battery_current).to eql(9)
314
+ expect(d.battery_voltage).to be_within(0.1).of(48.6)
315
+ expect(d.bec_current).to be_within(0.1).of(0.0)
316
+ expect(d.bec_voltage).to be_within(0.1).of(5.5)
317
+ expect(d.temperature(:c)).to be_within(0.1).of(25)
318
+ expect(d.temperature(:f)).to be_within(0.1).of(77)
319
+ expect(d.capacity).to eql(81)
320
+ expect(d.rpm).to eql(2543)
321
+ expect(d.run_time).to eql(44)
322
+ expect(d.pwm).to eql(88)
323
+
324
+ d = subject.mezon_data[1000]
325
+ expect(d.time).to eql(279377)
326
+ expect(d.battery_current).to eql(9)
327
+ expect(d.battery_voltage).to be_within(0.1).of(48.2)
328
+ expect(d.bec_current).to be_within(0.1).of(0.0)
329
+ expect(d.bec_voltage).to be_within(0.1).of(5.5)
330
+ expect(d.temperature(:c)).to be_within(0.1).of(28)
331
+ expect(d.temperature(:f)).to be_within(0.1).of(82.4)
332
+ expect(d.capacity).to eql(206)
333
+ expect(d.rpm).to eql(2522)
334
+ expect(d.run_time).to eql(93)
335
+ expect(d.pwm).to eql(88)
336
+
337
+ d = subject.mezon_data[1500]
338
+ expect(d.time).to eql(328599)
339
+ expect(d.battery_current).to eql(9)
340
+ expect(d.battery_voltage).to be_within(0.1).of(47.9)
341
+ expect(d.bec_current).to be_within(0.1).of(0.0)
342
+ expect(d.bec_voltage).to be_within(0.1).of(5.5)
343
+ expect(d.temperature(:c)).to be_within(0.1).of(31)
344
+ expect(d.temperature(:f)).to be_within(0.1).of(87.8)
345
+ expect(d.capacity).to eql(329)
346
+ expect(d.rpm).to eql(2516)
347
+ expect(d.run_time).to eql(142)
348
+ expect(d.pwm).to eql(88)
349
+ end
350
+
250
351
  its(:to_kml?) { should be_false }
251
352
 
252
353
  specify { expect { subject.to_kml }.to raise_error }
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe Jeti::Log::MezonData do
4
+
5
+ subject { Jeti::Log::MezonData.new(25, 15.1, 5, 5.4, 1, 250, 1000, 25, 150, 99) }
6
+
7
+ its(:time) { should eql(25) }
8
+
9
+ its(:battery_voltage) { should be_within(0.1).of(15.1) }
10
+
11
+ its(:battery_current) { should be_within(0.1).of(5) }
12
+
13
+ its(:bec_voltage) { should be_within(0.1).of(5.4) }
14
+
15
+ its(:bec_current) { should be_within(0.1).of(1) }
16
+
17
+ its(:capacity) { should eql(250) }
18
+
19
+ its(:rpm) { should eql(1000) }
20
+
21
+ its(:temperature) { should be_within(0.1).of(25) }
22
+
23
+ it 'should convert temperature to F' do
24
+ expect(subject.temperature(:f)).to be_within(0.1).of(77)
25
+ end
26
+
27
+ its(:run_time) { should eql(150) }
28
+
29
+ its(:pwm) { should eql(99) }
30
+
31
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe Jeti::Log::MuiData do
4
+
5
+ it 'does stuff'
6
+
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jeti-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Veys
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-07 00:00:00.000000000 Z
11
+ date: 2013-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -156,6 +156,8 @@ files:
156
156
  - lib/jeti/log/entry.rb
157
157
  - lib/jeti/log/file.rb
158
158
  - lib/jeti/log/header.rb
159
+ - lib/jeti/log/mezon_data.rb
160
+ - lib/jeti/log/mui_data.rb
159
161
  - lib/jeti/log/version.rb
160
162
  - spec/coordinate_spec.rb
161
163
  - spec/data/1min-tx-rx.log
@@ -169,7 +171,10 @@ files:
169
171
  - spec/data/invalid/spektrum/1.TLM
170
172
  - spec/data/mezon-1.log
171
173
  - spec/data/mezon-2.log
174
+ - spec/data/mezon-3.log
172
175
  - spec/file_spec.rb
176
+ - spec/mezon_data_spec.rb
177
+ - spec/mui_data_spec.rb
173
178
  - spec/spec_helper.rb
174
179
  homepage: ''
175
180
  licenses:
@@ -208,5 +213,8 @@ test_files:
208
213
  - spec/data/invalid/spektrum/1.TLM
209
214
  - spec/data/mezon-1.log
210
215
  - spec/data/mezon-2.log
216
+ - spec/data/mezon-3.log
211
217
  - spec/file_spec.rb
218
+ - spec/mezon_data_spec.rb
219
+ - spec/mui_data_spec.rb
212
220
  - spec/spec_helper.rb