grimbough / FITfileR

R package for reading data from FIT files using only native R code, rather than relying on external libraries.

Home Page:https://msmith.de/FITfileR

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid 'n' argument (fenix 7x)

moreron opened this issue · comments

Hi Mike, been using this library with a number of devices largely with an issue (the odd Coros fit file aside, though I need to contact Coros about those as other applications/services also find them troublesome). Just tried to read a fit file from a new fenix 7x and got what appears to the same error as was reported and resolve a while back.

On a readFitFile() this is returned -

Error in readBin(con = con, what = "raw", n = 3 * n_fields, size = 1, :
invalid 'n' argument

Offending file here -
8309711287_ACTIVITY.zip

Thanks so much for this library.

Regards,
Ron

Thanks for reporting this. It was an overflow error caused by reading an integer a signed rather than unsigned. Should be fixed in version 0.1.5

> readFitFile("~/Downloads/8309711287_ACTIVITY.fit")
Fit File
├╴File created: 2022-02-17 00:15:22
├╴Device: garmin 3907
└╴Number of data messages: 9096

@grimbough Hello!

I'm facing the same error trying to read this file:
Afternoon_Ride.fit.zip

My sessioninfo:

R version 4.2.2 Patched (2022-11-10 r83330)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux bookworm/sid

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.11.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.11.0

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
character(0)

other attached packages:
[1] FITfileR_0.1.6

loaded via a namespace (and not attached):
[1] Rcpp_1.0.9 pillar_1.8.1 compiler_4.2.2 fitdc_0.0.1
[5] prettyunits_1.1.1 methods_4.2.2 remotes_2.4.2 utils_4.2.2
[9] tools_4.2.2 grDevices_4.2.2 pkgbuild_1.3.1 jsonlite_1.8.0
[13] lifecycle_1.0.3 tibble_3.1.8 gtable_0.3.1 lattice_0.20-45
[17] pkgconfig_2.0.3 png_0.1-7 rlang_1.0.6 Matrix_1.4-1
[21] DBI_1.1.3 cli_3.6.0 curl_4.3.2 withr_2.5.0
[25] dplyr_1.0.10 generics_0.1.3 vctrs_0.5.2 graphics_4.2.2
[29] datasets_4.2.2 stats_4.2.2 hms_1.1.1 rappdirs_0.3.3
[33] rprojroot_2.0.2 grid_4.2.2 tidyselect_1.2.0 reticulate_1.27
[37] glue_1.6.2 base_4.2.2 here_1.0.1 R6_2.5.1
[41] processx_3.5.3 fansi_1.0.4 callr_3.7.0 tidyr_1.2.1
[45] tzdb_0.2.0 ggplot2_3.3.6 readr_2.1.2 purrr_0.3.4
[49] magrittr_2.0.3 ps_1.6.0 scales_1.2.1 ellipsis_0.3.2
[53] assertthat_0.2.1 colorspace_2.0-3 utf8_1.2.2 munsell_0.5.0
[57] crayon_1.5.1

Hi @vriffel ,

Thanks for the report. After some initial diagnosis it looks like a different problem from this original issue, so I've opened a new one at #26