fit4ruby 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fit4ruby/Activity.rb +19 -0
- data/lib/fit4ruby/FileNameCoder.rb +2 -2
- data/lib/fit4ruby/GlobalFitDictionaries.rb +4 -0
- data/lib/fit4ruby/GlobalFitMessages.rb +25 -2
- data/lib/fit4ruby/Lap.rb +0 -15
- data/lib/fit4ruby/version.rb +1 -1
- data/tasks/changelog.rake +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1db7e14706602d5c1890a89e173ea889ffd14a71
|
4
|
+
data.tar.gz: b184b8cf98d082435663d4df5d674ab57e3c6cea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c4e23196bede4ab4d416fc7d8b732298a3ed97f573777a6f11f179ed269366bd7818d06296c27efc1797cce53bd5d07cebc1b3572232f345f1ed4b88ffd39c0
|
7
|
+
data.tar.gz: 537a25d36c77d7daabc2c2c0f0dcdc676bdee66269f58e02050349d030747d613eeba0db9929dd028b451c479123327891a303f8efcd2060e205e3ee4c97ed65
|
data/lib/fit4ruby/Activity.rb
CHANGED
@@ -80,6 +80,25 @@ module Fit4Ruby
|
|
80
80
|
"#{@sessions.length} session records were found in the "
|
81
81
|
"FIT file."
|
82
82
|
end
|
83
|
+
|
84
|
+
# Records must have consecutively growing timestamps and distances.
|
85
|
+
ts = Time.parse('1989-12-31')
|
86
|
+
distance = nil
|
87
|
+
@records.each do |r|
|
88
|
+
Log.fatal "Record has no timestamp" unless r.timestamp
|
89
|
+
if r.timestamp < ts
|
90
|
+
Log.fatal "Record has earlier timestamp than previous record"
|
91
|
+
end
|
92
|
+
if r.distance
|
93
|
+
if distance && r.distance < distance
|
94
|
+
Log.fatal "Record #{r.timestamp} has smaller distance " +
|
95
|
+
"(#{r.distance}) than an earlier record (#{distance})"
|
96
|
+
end
|
97
|
+
distance = r.distance
|
98
|
+
end
|
99
|
+
ts = r.timestamp
|
100
|
+
end
|
101
|
+
|
83
102
|
# Laps must have a consecutively growing message index.
|
84
103
|
@laps.each.with_index do |lap, index|
|
85
104
|
lap.check(index)
|
@@ -38,8 +38,8 @@ module Fit4Ruby
|
|
38
38
|
end
|
39
39
|
|
40
40
|
# Convert a FIT file name into the corresponding Time value.
|
41
|
-
# @param [String] FIT file name. This can be a full path name
|
42
|
-
# with a '.FIT' extension.
|
41
|
+
# @param file_name [String] FIT file name. This can be a full path name
|
42
|
+
# but must end with a '.FIT' extension.
|
43
43
|
# @return [Time] corresponding Time value
|
44
44
|
def FileNameCoder::decode(file_name)
|
45
45
|
base = File.basename(file_name.upcase)
|
@@ -234,14 +234,31 @@ module Fit4Ruby
|
|
234
234
|
field 5, 'uint32', 'distance', :scale => 100, :unit => 'm'
|
235
235
|
field 6, 'uint16', 'speed', :scale => 1000, :unit => 'm/s'
|
236
236
|
field 7, 'uint16', 'power', :unit => 'watts'
|
237
|
+
field 11, 'sint32', 'time_from_course', :scale => 1000, :unit => 's'
|
237
238
|
field 13, 'sint8', 'temperature', :unit => 'C'
|
239
|
+
field 29, 'uint32', 'accumulated_power', :unit => 'watts'
|
240
|
+
field 30, 'uint8', 'left_right_balance', :dict => 'left_right_balance'
|
238
241
|
field 39, 'uint16', 'vertical_oscillation', :scale => 10, :unit => 'mm'
|
239
242
|
field 40, 'uint16', 'stance_time_percent', :scale => 100, :unit => 'percent'
|
240
243
|
field 41, 'uint16', 'stance_time', :scale => 10, :unit => 'ms'
|
241
244
|
field 42, 'enum', 'activity_type', :dict => 'activity_type'
|
245
|
+
field 43, 'uint8', 'left_torque_effectiveness', :scale => 2, :unit => '%'
|
246
|
+
field 44, 'uint8', 'right_torque_effectiveness', :scale => 2, :unit => '%'
|
247
|
+
field 45, 'uint8', 'left_pedal_smoothness', :scale => 2, :unit => '%'
|
248
|
+
field 46, 'uint8', 'right_pedal_smoothness', :scale => 2, :unit => '%'
|
249
|
+
field 47, 'uint8', 'combined_pedal_smoothness', :scale => 2, :unit => '%'
|
242
250
|
field 53, 'uint8', 'fractional_cadence', :scale => 128
|
243
251
|
field 61, 'uint16', 'undefined_value_61'
|
252
|
+
field 63, 'uint16', 'undefined_value_63'
|
253
|
+
field 64, 'uint16', 'undefined_value_64'
|
254
|
+
field 65, 'uint16', 'undefined_value_65'
|
244
255
|
field 66, 'sint16', 'undefined_value_66'
|
256
|
+
field 67, 'sint8', 'left_pco', :unit => 'mm'
|
257
|
+
field 68, 'sint8', 'right_pco', :unit => 'mm'
|
258
|
+
field 69, 'uint8', 'left_power_phase', :scale => 0.7111111, :unit => 'degrees', :array => true
|
259
|
+
field 70, 'uint8', 'left_power_phase_peak', :scale => 0.7111111, :unit => 'degrees', :array => true
|
260
|
+
field 71, 'uint8', 'right_power_phase', :scale => 0.7111111, :unit => 'degrees', :array => true
|
261
|
+
field 72, 'uint8', 'right_power_phase_peak', :scale => 0.7111111, :unit => 'degrees', :array => true
|
245
262
|
field 83, 'uint16', 'vertical_ratio', :scale => 100, :unit => '%' # guessed
|
246
263
|
field 84, 'uint16', 'gct_balance', :scale => 100, :unit => '%' # guessed
|
247
264
|
field 85, 'uint16', 'stride_length', :scale => 10000, :unit => 'm' # guessed
|
@@ -378,11 +395,17 @@ module Fit4Ruby
|
|
378
395
|
field 19, 'uint16', 'active_calories', :unit => 'kcal'
|
379
396
|
field 24, 'byte', 'current_activity_type_intensity', :type => 'activity_intensity'
|
380
397
|
field 26, 'uint16', 'timestamp_16', :unit => 's'
|
398
|
+
field 27, 'uint8', 'heart_rate', :unit => 'bpm'
|
381
399
|
field 29, 'uint16', 'duration_min', :unit => 'min'
|
382
|
-
field
|
383
|
-
field
|
400
|
+
field 30, 'uint32', 'duration', :unit => 's'
|
401
|
+
field 31, 'uint32', 'ascent', :scale => 1000, :unit => 'm'
|
402
|
+
field 32, 'uint32', 'descent', :scale => 1000, :unit => 'm'
|
403
|
+
field 33, 'uint16', 'moderate_activity_minutes', :unit => 'minutes'
|
404
|
+
field 34, 'uint16', 'vigorous_activity_minutes', :unit => 'minutes'
|
384
405
|
field 35, 'uint32', 'undocumented_field_35'
|
385
406
|
field 36, 'uint32', 'undocumented_field_36'
|
407
|
+
field 37, 'uint16', 'weekly_moderate_activity_minutes', :unit => 'minutes' # just a guess
|
408
|
+
field 38, 'uint16', 'weekly_vigorous_activity_minutes', :unit => 'minutes' # just a guess
|
386
409
|
field 253, 'uint32', 'timestamp', :type => 'date_time'
|
387
410
|
|
388
411
|
message 72, 'training_file'
|
data/lib/fit4ruby/Lap.rb
CHANGED
@@ -47,21 +47,6 @@ module Fit4Ruby
|
|
47
47
|
unless @message_index == index
|
48
48
|
Log.fatal "message_index must be #{index}, not #{@message_index}"
|
49
49
|
end
|
50
|
-
ts = Time.parse('1989-12-31')
|
51
|
-
distance = nil
|
52
|
-
@records.each do |r|
|
53
|
-
Log.fatal "Record has no timestamp" unless r.timestamp
|
54
|
-
if r.timestamp < ts
|
55
|
-
Log.fatal "Record has earlier timestamp than previous record"
|
56
|
-
end
|
57
|
-
if r.distance
|
58
|
-
if distance && r.distance < distance
|
59
|
-
Log.fatal "Record has smaller distance than previous record"
|
60
|
-
end
|
61
|
-
distance = r.distance
|
62
|
-
end
|
63
|
-
ts = r.timestamp
|
64
|
-
end
|
65
50
|
end
|
66
51
|
|
67
52
|
# Compute the average stride length for this Session.
|
data/lib/fit4ruby/version.rb
CHANGED
data/tasks/changelog.rake
CHANGED
@@ -12,10 +12,10 @@ task :changelog do
|
|
12
12
|
@author = author
|
13
13
|
@time = time
|
14
14
|
@message = message
|
15
|
-
if (m = /New: (.*)
|
15
|
+
if (m = /New: (.*)/i.match(@message))
|
16
16
|
@type = :feature
|
17
17
|
@message = m[1]
|
18
|
-
elsif (m = /Fix: (.*)
|
18
|
+
elsif (m = /Fix: (.*)/i.match(@message))
|
19
19
|
@type = :bugfix
|
20
20
|
@message = m[1]
|
21
21
|
else
|
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: 0.0.
|
4
|
+
version: 0.0.11
|
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-
|
11
|
+
date: 2016-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bindata
|