Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

import problem: 2 garmin .fit files with similar timestamps

2013-10-27
2014-04-02
  • admiralbulli
    admiralbulli
    2013-10-27

    Dear Wolfgang and Team,
    at first a huge THANK YOU for that great tool! You guys are doing a
    really great job!

    My Problem:
    I am using a Garmin EDGE 800 and my wife has a Forerunner 610.
    We are using the same database with 2 users.
    Importing any .fit file of the devices works like a charm - normally.

    Today, for the first time we were using our devices while biking
    together. So now we have two .fit files from different devices, that
    start and end at approximately the same time. Also the GPS tracks are
    quite similar as we were riding together.
    Now I can import one .fit file into MyTourbook. That works as usual. But
    if I try to import the second .fit file, MyTourbook shows me the already
    imported file and fails to import the second as an individual entry.

    I deleted them again and tried the other way round - same result but I
    could see that those are surely different files as the curves looked
    different.

    After having a short look into your sources, it looks to me as if the
    'tourId', generated from our files is the same in for both.

    net.tourbook.device.garmin.fit.....FitActivityContext.java:
    final Long tourId =
    tourData.createTourId(Util.UNIQUE_ID_SUFFIX_GARMIN_FIT);
    if (_alreadyImportedTours.containsKey(tourId) == false) {
    tourData.createTimeSeries(timeDataList, false);

                                        //tourData.computeTourDrivingTime();
                                        tourData.computeComputedValues();
                                        tourData.computeAltimeterGradientSerie();
    
                                        tourData.setTourMarkers(tourMarkerSet);
    
                                        _newlyImportedTours.put(tourId, tourData);
                                }
    

    unfortunately my eclipse and java knowlege is very limited so I could
    not find the part where the 'tourId' is actually generated.

    Any help would be greatly appreciated!

    If you need the files, please tell me where to e-mail them.

    Best regards,
    admiralbulli

     
    Last edit: admiralbulli 2013-10-27
  • Wolfgang
    Wolfgang
    2013-10-28

    'normally' a tour id is created from the tour start time (year, month, day, hour, minute).

    For gpx/tcx files also the tour distance (meter) and the tour recording time (seconds) is used to created a tour id when this option is selected in the tour import view menu.

    For .fit files this option is not yet available.

     
  • admiralbulli
    admiralbulli
    2013-10-28

    Wolfgang,
    thank you very much for this detailed answer.

    As I understood from your sources, the ID is calculated as a type long variable in TourData.java line 3663ff:

    tourIdKey = Short.toString(startYear)
    + Short.toString(startMonth)
    + Short.toString(startDay)
    + Short.toString(startHour)
    + Short.toString(startMinute)
    //
    + uniqueKeySuffix;
    
    tourId = Long.valueOf(tourIdKey);
    

    at that time, when importing .fit files (at least from the two named devices FORERUNNER610 and EDGE800) the variable

    devicePluginId
    

    is available, carrying the GARMIN serial (in my case a 10 digit number)

    Also available is

    _dateTimeStart //in Millis
    

    Up to now I have not found the database type of the tourID field but I guess this is also "long"? Otherwise I would propose to add the deviceID somehow like that

    tourIdKey = Int.toString(devicePluginId) //Int since 10 digit deviceID
        + Long.toString(_dateTimeStart)
    
    tourId = Long.valueOf(tourIdKey);
    

    for Garmin .fit devices.

    I am sure I forgot some major things, bringing up severe problems, but:
    Is this worth a feature request?

    May I somehow support the project with my limited programming skills?

    Thanks again,
    admiralbulli

    P.S.: GarminProduct.java:
    adding our 2 devices would result in something like this:

    public enum GarminProduct {
    
    FR405(717), FR50(782), FR60(988), FR310XT(1018), EDGE500(1036), FR110(1124), EDGE800(1169), FR610(1345);
    
     
    Last edit: admiralbulli 2013-10-29
  • admiralbulli
    admiralbulli
    2013-10-31

    Thanks Wolfgang,
    I will try to find some code solution for this and come back later on...
    Regards,
    admiralbulli

     
  • M. Ritscher
    M. Ritscher
    2014-03-26

    I do have the same problem now, wanting to import two files, generated by two different Garmin 800.
    Since a friend of mine and I ride the same routes for a week at the moment, we have identical starting times and track lengths. However, I want to be able to compare parts of the courses (how much faster rode my friend uphill and the like).
    Has the above been implemented and if so, how may I enable it?

     
  • Wolfgang
    Wolfgang
    2014-04-02

    I'll implement this feature in the next version