Wahoo iOS app generated fit file isse
erwinfs opened this issue · comments
Hi,
Thank you for your very useful program.
I had an issue with a file generated by the Wahoo iOS app (files from my Garmin watch work fine).
I printed the field names and units in add_dev_field_description:
field_name: calibration
units: adc
field_name: charge
units: %
field_name: running_smoothness
units: %
field_name: time_ms
units: ms
field_name: ant_device_num
None
field_name: crank_length
units: mm x 10
field_name: glucose
units: mg/dL
field_name: avg_smoothness_x
units: avg per/step
field_name: avg_smoothness_y
units: avg per/step
field_name: avg_smoothness_z
units: avg per/step
field_name: travel_assist_level
None
field_name: lev_travel_assist_level_time_in_zone
units: ms
The fields that lack units cause the problem.
Replacing line 453 in records.py with the following solved the problem for me
if message.get('units'): units = message.get('units').raw_value else: units = ''
I have the same problem with a file recorded and exported from the Stava Android app.
It seems that some messages don't have the unit field such that message.get('units').raw_value fails as described above.
An example message is:
<DataMessage: field_description (#206) -- local mesg: #0, fields: [developer_data_index: 0, field_definition_number: 1, fit_base_type_id: string, field_name: activity_type]>
The issue can be fixed, by testing if the output from message.get('units') is equal to None.
if message.get('units') is not None:
units = message.get('units').raw_value
else:
units = None