fit4ruby 1.0.1 → 1.1.0

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
  SHA1:
3
- metadata.gz: f403fc735e7bda18d7d23d3105ed5c0b2d5ca32f
4
- data.tar.gz: 12b973174eff309b24595ebce9651a6d1d2bfc1c
3
+ metadata.gz: 8ff21e0bc29baae59a7611f60f21f03c764a39d7
4
+ data.tar.gz: 0591aa35d271c7f817ce6e51fbe5a49cfd8e7827
5
5
  SHA512:
6
- metadata.gz: c1d98b48933b07c13ec0f50221c8de28512e29a1844c9cbdfd8f39f77ee955e9af4e5876d4883654991453e97d6220e4cc0fc01322051912d5ed9ade5904ec57
7
- data.tar.gz: cb795dad345888c54bf55f8fbe486191a2b5832cafb64a0bc641e7a2c8a99b9d5261f88c0df3b4dafe585fd94d9dac232647506f066542db3737a8c2a115f896
6
+ metadata.gz: f7f3aba8f4af977f471802d237487120cf8481d87f9501f7f16b5ed40fbe5c0f9af8e6aa6f9fd754126de2abd227ce3d1a79c5ab555ff09448b88b553d65c838
7
+ data.tar.gz: d9aa3f31e00c80ffa963f6f4d83109ca61a460659b2611d353b3347b50059db6ead9f9478c38af4c48dc0aaa927d9fc3338b11b057e03bdee7c69d64b395b0b6
@@ -334,6 +334,12 @@ module Fit4Ruby
334
334
  field 25, 'enum', 'source_type', :dict => 'source_type'
335
335
  field 253, 'uint32', 'timestamp', :type => 'date_time'
336
336
 
337
+ # This message was first seen on the Fenix3HR with firmware 3.0.
338
+ message 24, 'undocumented_24'
339
+ # The Array contains 16 bytes. Bytes 2(lsb) and 3(msb) seem to be a
340
+ # counter.
341
+ field 2, 'byte', 'undocumented_field_2', :array => true
342
+
337
343
  # Message 29 is just a guess. It's not officially documented.
338
344
  # Found in LCTNS.FIT on Fenix 3
339
345
  message 29, 'location'
@@ -403,8 +409,8 @@ module Fit4Ruby
403
409
  field 32, 'uint32', 'descent', :scale => 1000, :unit => 'm'
404
410
  field 33, 'uint16', 'moderate_activity_minutes', :unit => 'minutes'
405
411
  field 34, 'uint16', 'vigorous_activity_minutes', :unit => 'minutes'
406
- field 35, 'uint32', 'undocumented_field_35'
407
- field 36, 'uint32', 'undocumented_field_36'
412
+ field 35, 'uint32', 'floors_climbed', :scale => 1000, :unit => 'm' # just a guess, around 3.048m (10ft) per floor
413
+ field 36, 'uint32', 'floors_descended', :scale => 1000, :unit => 'm' # just a guess
408
414
  field 37, 'uint16', 'weekly_moderate_activity_minutes', :unit => 'minutes' # just a guess
409
415
  field 38, 'uint16', 'weekly_vigorous_activity_minutes', :unit => 'minutes' # just a guess
410
416
  field 253, 'uint32', 'timestamp', :type => 'date_time'
@@ -464,7 +470,7 @@ module Fit4Ruby
464
470
  field 0, 'uint32', 'local_time', :type => 'date_time'
465
471
  field 1, 'enum', 'activity_type', :array => true, :dict => 'activity_type'
466
472
  field 3, 'uint16', 'cycles_to_distance', :array => true, :scale => 5000, :unit => 'm/cycle'
467
- field 4, 'uint16', 'cycle_to_calories', :array => true, :scale => 5000, :unit => 'kcal/cycle'
473
+ field 4, 'uint16', 'cycles_to_calories', :array => true, :scale => 5000, :unit => 'kcal/cycle'
468
474
  field 5, 'uint16', 'resting_metabolic_rate', :unit => 'kcal/day'
469
475
  # Just a guess, not officially documented
470
476
  field 7, 'uint32', 'goal_cycles', :array => true
@@ -46,6 +46,7 @@ module Fit4Ruby
46
46
  # objects. Any errors will be reported via the Log object.
47
47
  def check
48
48
  last_timestamp = ts_16_offset = nil
49
+ last_ts_16 = nil
49
50
 
50
51
  # The timestamp_16 is a 2 byte time stamp value that is used instead of
51
52
  # the 4 byte timestamp field for monitoring records that have
@@ -54,11 +55,18 @@ module Fit4Ruby
54
55
  # to be included in the file. However, it can be approximated using the
55
56
  # surrounding timestamp values.
56
57
  @monitorings.each do |record|
58
+ if last_ts_16 && ts_16_offset && record.timestamp_16 &&
59
+ record.timestamp_16 < last_ts_16
60
+ # Detect timestamp_16 wrap-arounds. timestamp_16 is a 16 bit value.
61
+ # In case of a wrap-around we adjust the ts_16_offset accordingly.
62
+ ts_16_offset += 2 ** 16
63
+ end
57
64
  if ts_16_offset
58
65
  # We have already found the offset. Adjust all timestamps according
59
66
  # to 'offset + timestamp_16'
60
67
  if record.timestamp_16
61
68
  record.timestamp = ts_16_offset + record.timestamp_16
69
+ last_ts_16 = record.timestamp_16
62
70
  end
63
71
  else
64
72
  # We are still looking for the offset.
@@ -70,6 +78,7 @@ module Fit4Ruby
70
78
  # thinking here?
71
79
  ts_16_offset = last_timestamp + 60 - record.timestamp_16
72
80
  record.timestamp = ts_16_offset + record.timestamp_16
81
+ last_ts_16 = record.timestamp_16
73
82
  else
74
83
  # Just save the timestamp of the current record.
75
84
  last_timestamp = record.timestamp
@@ -1,4 +1,4 @@
1
1
  module Fit4Ruby
2
2
  # The version number of the library.
3
- VERSION = '1.0.1'
3
+ VERSION = '1.1.0'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fit4ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Schlaeger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-19 00:00:00.000000000 Z
11
+ date: 2016-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bindata