jmackie / fitdc

R package for decoding Garmin FIT files
Other
8 stars 7 forks source link

Unrecognised format string #1

Open jamesdunham opened 7 years ago

jamesdunham commented 7 years ago

When I try read_fit() with any of the FIT files I have on hand, I get an Unrecognised format string error. Do any suggestions come to mind?

Thanks!

Error in unpack(field_def$base_type$fmt, fit_file$conn, endianness
, n_to_read) :
  Unrecognised format string.
> traceback()
8: stop("Unrecognised format string.")
7: unpack(field_def$base_type$fmt, fit_file$conn, endianness, n_to
_read)
6: FUN(X[[i]], ...)
5: lapply(field_defs, parse_field_data_value, fit_file, endianness
)
4: parse_field_data_values(field_defs, fit_file, endianness)
3: read_fit_data_message(fit_file, mesg_header)
2: read_fit_message(fit_file)
1: read_fit(fits[6])
jmackie commented 7 years ago

I think I know why that's happening, could you send me an offending file?

jmackie commented 7 years ago

Does b74fc2e fix it?

jamesdunham commented 7 years ago

Thanks, it looks like that got me further than before. I'll upload a test file.

I now run into this:

Error in vapply(conditions, eval_subfield_condition, logical(1), parsed_field_data,  :
  values must be length 1,
 but FUN(X[[1]]) result is length 0
> traceback()
6: vapply(conditions, eval_subfield_condition, logical(1), parsed_field_data,
       USE.NAMES = FALSE)
5: match_subfield(field_defs[[i]], parsed_field_data)
4: resolve_subfields(field_defs, which(dynamic_fields), parsed_field_data)
3: read_fit_data_message(fit_file, mesg_header)
2: read_fit_message(fit_file)
1: read_fit(f)
>
jmackie commented 7 years ago

Not so sure what's causing that. I've been away from this code base (and R) for a while, so it won't be an easy fix. When I have some head space I'll look into it. Feel free to have a crack yourself in the meantime! :)

jamesdunham commented 7 years ago

Sure, I'll let you know!