diff --git a/garmin_xt.cc b/garmin_xt.cc index b98f9fb94..45de0e9f9 100644 --- a/garmin_xt.cc +++ b/garmin_xt.cc @@ -153,9 +153,9 @@ format_garmin_xt_decrypt_trk_blk(int Count, uint8_t TrackBlock[]) { int j = 12; while (j<(Count-1)) { - for (uint8_t i = j; i < Count; i++) { + for (int i = j; i < Count; i++) { TrackBlock[i] = TrackBlock[i] >> 1; - if (i<(Count)) { + if (i<(Count-1)) { TrackBlock[i] = TrackBlock[i] + (TrackBlock[i+1] % 2) * 128; } } @@ -227,10 +227,10 @@ format_garmin_xt_proc_strk() { int Count = 0; // Used to obtain number of read bytes int TracksCompleted = 0; // Number of processed tracks - uint8_t TrackBlock[STRK_BLOCK_SIZE + 1]; // File Block + uint8_t TrackBlock[STRK_BLOCK_SIZE]; // File Block double Lat = 0, Lon = 0; // wpt data double PrevLat = 0, PrevLon = 0, PrevEle = 0; // wpt data - uint32_t Time = 0; // wpt data + uint32_t Time = 0, PrevTime = 0; // wpt data uint8_t trk_color = 0xff; // Skip 12 bytes from the BOF @@ -287,7 +287,7 @@ format_garmin_xt_proc_strk() wpt->latitude = PrevLat; /* Degrees */ wpt->longitude = PrevLon; /* Degrees */ wpt->altitude = PrevEle; /* Meters. */ - wpt->SetCreationTime(Time); /* Unix Time adjusted to Garmin time */ + wpt->SetCreationTime(PrevTime); /* Unix Time adjusted to Garmin time */ // add way point to the track track_add_wpt(tmp_track, wpt); @@ -296,6 +296,7 @@ format_garmin_xt_proc_strk() } PrevLat = Lat; PrevLon = Lon; + PrevTime = Time; } } @@ -312,7 +313,7 @@ format_garmin_xt_proc_strk() wpt->latitude = PrevLat; /* Degrees */ wpt->longitude = PrevLon; /* Degrees */ wpt->altitude = PrevEle; /* Meters. */ - wpt->SetCreationTime(Time); /* Unix Time adjusted to Garmin time */ + wpt->SetCreationTime(PrevTime); /* Unix Time adjusted to Garmin time */ // add way point to the track track_add_wpt(tmp_track, wpt); diff --git a/reference/track/garmin_xt_strk.gpx b/reference/track/garmin_xt_strk.gpx index afb3761f0..e2826966d 100644 --- a/reference/track/garmin_xt_strk.gpx +++ b/reference/track/garmin_xt_strk.gpx @@ -7,655 +7,655 @@ 74.135 - + 70.770 - + 61.638 - + 61.638 - + 40.489 - + 40.489 - + 41.451 - + 41.451 - + 42.412 - + 43.373 - + 43.854 - + 44.815 - + 45.296 - + 46.257 - + 47.218 - + 49.141 - + 50.102 - + 50.583 - + 51.064 - + 51.544 - + 52.505 - + 52.986 - + 52.986 - + 53.947 - + 53.947 - + 54.909 - + 54.909 - + 55.389 - + 55.870 - + 56.351 - + 56.351 - + 56.831 - + 57.793 - + 58.273 - + 58.273 - + 58.754 - + 58.273 - + 58.754 - + 58.754 - + 58.754 - + 58.754 - + 59.235 - + 58.754 - + 58.754 - + 59.235 - + 60.196 - + 60.677 - + 60.196 - + 60.196 - + 59.715 - + 60.196 - + 61.638 - + 61.638 - + 61.157 - + 61.157 - + 61.157 - + 60.196 - + 58.273 - + 57.312 - + 56.351 - + 56.351 - + 54.909 - + 55.389 - + 56.831 - + 57.793 - + 58.273 - + 58.754 - + 59.715 - + 60.196 - + 60.196 - + 60.677 - + 61.157 - + 61.157 - + 61.638 - + 62.599 - + 63.080 - + 64.041 - + 65.002 - + 65.483 - + 65.964 - + 65.964 - + 65.964 - + 65.964 - + 66.925 - + 66.925 - + 68.367 - + 69.328 - + 69.328 - + 70.290 - + 70.290 - + 70.770 - + 71.732 - + 72.693 - + 74.135 - + 73.654 - + 72.212 - + 70.770 - + 70.770 - + 69.809 - + 68.848 - + 68.367 - + 68.848 - + 69.328 - + 68.848 - + 68.848 - + 69.328 - + 69.809 - + 71.251 - + 72.693 - + 73.654 - + 76.057 - + 77.980 - + 78.941 - + 79.903 - + 79.903 - + 80.383 - + 80.383 - + 79.903 - + 78.941 - + 77.980 - + 77.499 - + 77.019 - + 76.538 - + 77.019 - + 77.499 - + 77.499 - + 77.499 - + 78.461 - + 78.461 - + 78.941 - + 79.422 - + 79.903 - + 80.383 - + 80.864 - + 81.345 - + 82.306 - + 84.709 - + 85.670 - + 86.151 - + 86.151 - + 86.151 - + 85.670 - + 85.670 - + 86.151 - + 86.151 - + 86.632 - + 87.112 - + 88.074 - + 87.593 - + 87.112 - + 86.151 - + 85.670 - + 84.709 - + 84.229 - + 83.267 - + 82.306 - + 82.306 - + 81.825 - + 81.825 - + 81.345 - + 81.345 - + 79.903 - + 78.941 - + 78.941 @@ -668,658 +668,662 @@ 74.135 - + 70.770 - + 61.638 - + 61.638 - + 40.489 - + 40.489 - + 41.451 - + 41.451 - + 42.412 - + 43.373 - + 43.854 - + 44.815 - + 45.296 - + 46.257 - + 47.218 - + 49.141 - + 50.102 - + 50.583 - + 51.064 - + 51.544 - + 52.505 - + 52.986 - + 52.986 - + 53.947 - + 53.947 - + 54.909 - + 54.909 - + 55.389 - + 55.870 - + 56.351 - + 56.351 - + 56.831 - + 57.793 - + 58.273 - + 58.273 - + 58.754 - + 58.273 - + 58.754 - + 58.754 - + 58.754 - + 58.754 - + 59.235 - + 58.754 - + 58.754 - + 59.235 - + 60.196 - + 60.677 - + 60.196 - + 60.196 - + 59.715 - + 60.196 - + 61.638 - + 61.638 - + 61.157 - + 61.157 - + 61.157 - + 60.196 - + 58.273 - + 57.312 - + 56.351 - + 56.351 - + 54.909 - + 55.389 - + 56.831 - + 57.793 - + 58.273 - + 58.754 - + 59.715 - + 60.196 - + 60.196 - + 60.677 - + 61.157 - + 61.157 - + 61.638 - + 62.599 - + 63.080 - + 64.041 - + 65.002 - + 65.483 - + 65.964 - + 65.964 - + 65.964 - + 65.964 - + 66.925 - + 66.925 - + 68.367 - + 69.328 - + 69.328 - + 70.290 - + 70.290 - + 70.770 - + 71.732 - + 72.693 - + 74.135 - + 73.654 - + 72.212 - + 70.770 - + 70.770 - + 69.809 - + 68.848 - + 68.367 - + 68.848 - + 69.328 - + 68.848 - + 68.848 - + 69.328 - + 69.809 - + 71.251 - + 72.693 - + 73.654 - + 76.057 - + 77.980 - + 78.941 - + 79.903 - + 79.903 - + 80.383 - + 80.383 - + 79.903 - + 78.941 - + 77.980 - + 77.499 - + 77.019 - + 76.538 - + 77.019 - + 77.499 - + 77.499 - + 77.499 - + 78.461 - + 78.461 - + 78.941 - + 79.422 - + 79.903 - + 80.383 - + 80.864 - + 81.345 - + 82.306 - + 84.709 - + 85.670 - + 86.151 - + 86.151 - + 86.151 - + 85.670 - + 85.670 - + 86.151 - + 86.151 - + 86.632 - + 87.112 - + 88.074 - + 87.593 - + 87.112 - + 86.151 - + 85.670 - + 84.709 - + 84.229 - + 83.267 - + 82.306 - + 82.306 - + 81.825 - + 81.825 - + 81.345 - + 81.345 - + 79.903 - + 78.941 - + 78.941 + + + + 69.809 @@ -1358,1288 +1362,1288 @@ 69.809 - - 69.809 - - 72.212 - + 71.251 - + 71.732 - + 71.251 - + 71.732 - + 72.693 - + 72.212 - + 72.693 - + 73.174 - + 73.174 - + 73.654 - + 74.135 - + 74.615 - + 74.615 - + 73.174 - + 72.693 - + 73.174 - + 72.693 - + 72.693 - + 72.212 - + 72.693 - + 72.693 - + 72.693 - + 72.212 - + 72.212 - + 72.212 - + 71.251 - + 70.290 - + 70.770 - + 70.290 - + 70.290 - + 69.328 - + 68.848 - + 68.367 - + 67.886 - + 67.886 - + 67.886 - + 68.367 - + 68.848 - + 69.328 - + 69.328 - + 70.290 - + 70.290 - + 70.770 - + 70.770 - + 70.770 - + 72.212 - + 72.693 - + 73.654 - + 73.174 - + 74.135 - + 75.096 - + 75.577 - + 75.577 - + 75.577 - + 75.096 - + 74.615 - + 75.096 - + 74.615 - + 75.096 - + 74.615 - + 74.615 - + 73.654 - + 73.174 - + 73.174 - + 73.174 - + 72.693 - + 72.212 - + 72.693 - + 73.174 - + 73.174 - + 72.693 - + 72.212 - + 71.251 - + 70.290 - + 70.770 - + 71.251 - + 71.251 - + 71.732 - + 71.732 - + 70.290 - + 69.328 - + 68.848 - + 68.848 - + 68.367 - + 67.886 - + 66.925 - + 66.444 - + 66.925 - + 66.925 - + 67.406 - + 67.886 - + 68.367 - + 68.367 - + 68.848 - + 68.848 - + 68.848 - + 68.367 - + 68.367 - + 67.886 - + 68.848 - + 69.809 - + 69.809 - + 70.770 - + 70.290 - + 70.770 - + 71.251 - + 71.732 - + 72.212 - + 73.174 - + 73.174 - + 73.654 - + 74.615 - + 74.615 - + 74.135 - + 74.615 - + 74.615 - + 74.615 - + 74.615 - + 75.096 - + 75.577 - + 75.577 - + 74.615 - + 74.615 - + 74.135 - + 73.654 - + 73.654 - + 73.654 - + 77.499 - + 77.499 - + 77.019 - + 76.538 - + 76.057 - + 75.577 - + 75.096 - + 75.096 - + 74.615 - + 73.174 - + 73.174 - + 72.693 - + 71.732 - + 70.770 - + 68.848 - + 68.848 - + 68.848 - + 68.848 - + 68.367 - + 68.367 - + 68.367 - + 68.367 - + 69.809 - + 69.809 - + 69.809 - + 70.770 - + 70.770 - + 68.848 - + 69.328 - + 69.809 - + 70.290 - + 70.290 - + 70.770 - + 70.770 - + 70.290 - + 70.290 - + 70.290 - + 70.770 - + 70.290 - + 69.328 - + 67.406 - + 66.925 - + 66.925 - + 66.925 - + 65.964 - + 65.483 - + 65.483 - + 65.002 - + 65.002 - + 65.483 - + 65.964 - + 65.964 - + 65.964 - + 65.964 - + 65.483 - + 65.002 - + 64.041 - + 64.522 - + 65.002 - + 65.002 - + 65.002 - + 65.483 - + 66.925 - + 66.925 - + 66.925 - + 66.925 - + 68.367 - + 67.886 - + 66.925 - + 65.483 - + 64.522 - + 64.041 - + 63.080 - + 62.119 - + 62.119 - + 61.638 - + 61.157 - + 60.196 - + 59.235 - + 57.793 - + 57.312 - + 55.870 - + 54.428 - + 53.947 - + 52.986 - + 51.064 - + 50.102 - + 50.583 - + 49.141 - + 47.218 - + 46.257 - + 44.815 - + 44.815 - + 45.296 - + 45.296 - + 45.296 - + 45.296 - + 44.815 - + 44.815 - + 44.815 - + 45.296 - + 45.296 - + 45.296 - + 46.257 - + 46.257 - + 46.257 - + 47.218 - + 46.738 - + 47.699 - + 47.699 - + 47.699 - + 47.699 - + 48.180 - + 48.180 - + 47.699 - + 47.699 - + 48.180 - + 48.660 - + 50.583 - + 52.025 - + 53.467 - + 53.947 - + 53.947 - + 53.947 - + 64.522 - + 64.041 - + 62.119 - + 61.638 - + 60.677 - + 63.080 - + 64.041 - + 63.560 - + 62.119 - + 59.235 - + 57.793 - + 57.793 - + 51.544 - + 51.544 - + 50.583 - + 49.622 - + 49.622 - + 50.102 - + 49.622 - + 49.141 - + 48.180 - + 48.180 - + 47.699 - + 47.699 - + 47.218 - + 47.699 - + 48.180 - + 51.064 - + 52.505 - + 53.947 - + 52.505 - + 52.025 - + 52.505 - + 54.909 - + 56.831 - + 58.754 - + 63.080 - + 69.328 - + 69.328 - + 114.510 - + 103.455 - + 103.455 - + 92.880 - + 92.880 - + 92.880 - + 85.190 - + 83.267 - + 79.903 - + 76.057 - + 73.654 - + 71.251 - + 71.251 - + 70.290 - + 68.848 - + 68.848 - + 69.328 - + 69.328 - + 69.328 - + 85.670 - + 87.112 - + 87.112 - + 87.112 - + 86.151 - + 86.151 - + 85.190 - + 82.306 - + 81.825 - + 80.383 + + + + 79.903 @@ -2650,12 +2654,12 @@ 79.903 - - 79.903 + + 66.925 - 66.925 + 66.444 @@ -2666,288 +2670,288 @@ 66.444 - - 66.444 - - 54.428 - + 53.467 - + 52.505 - + 53.467 - + 52.505 - + 50.583 - + 49.622 - + 49.622 - + 48.180 - + 47.218 - + 47.218 - + 47.218 - + 59.235 - + 58.754 - + 58.273 - + 58.273 - + 53.467 - + 53.947 - + 58.273 - + 59.715 - + 59.715 - + 79.903 - + 76.057 - + 70.770 - + 68.367 - + 65.964 - + 63.560 - + 64.041 - + 64.041 - + 59.235 - + 56.831 - + 52.986 - + 51.544 - + 51.544 - + 52.025 - + 52.986 - + 53.467 - + 52.505 - + 50.583 - + 48.660 - + 47.699 - + 46.738 - + 45.776 - + 45.776 - + 46.257 - + 48.180 - + 49.141 - + 50.583 - + 54.428 - + 52.986 - + 51.064 - + 51.064 - + 51.544 - + 49.141 - + 44.815 - + 44.815 - + 45.776 - + 47.218 - + 47.699 - + 47.699 - + 47.218 - + 47.218 - + 47.218 - + 49.622 - + 49.141 - + 50.102 - + 50.583 - + 50.583 - + 50.102 - + 50.102 + + + + 49.141 @@ -2978,865 +2982,861 @@ 49.141 - - 49.141 - - 55.870 - + 55.389 - + 55.389 - + 54.909 - + 54.909 - + 53.947 - + 53.467 - + 53.467 - + 54.428 - + 54.428 - + 51.544 - + 50.583 - + 47.218 - + 46.257 - + 44.815 - + 43.373 - + 43.373 - + 43.373 - + 43.373 - + 43.373 - + 42.892 - + 42.892 - + 44.815 - + 50.102 - + 51.544 - + 52.505 - + 56.831 - + 58.273 - + 59.715 - + 60.677 - + 60.677 - + 60.196 - + 60.196 - + 58.273 - + 57.793 - + 56.831 - + 55.870 - + 54.909 - + 52.986 - + 51.544 - + 49.141 - + 47.699 - + 47.218 - + 49.141 - + 50.583 - + 51.544 - + 50.102 - + 48.180 - + 42.892 - + 42.892 - + 43.854 - + 45.296 - + 47.218 - + 47.218 - + 47.218 - + 46.738 - + 45.776 - + 44.815 - + 44.334 - + 43.854 - + 43.373 - + 43.373 - + 42.892 - + 42.892 - + 43.373 - + 42.412 - + 40.970 - + 40.489 - + 40.489 - + 39.528 - + 39.047 - + 38.086 - + 38.567 - + 39.047 - + 39.047 - + 37.605 - + 37.605 - + 39.047 - + 38.567 - + 38.567 - + 39.047 - + 39.528 - + 40.489 - + 41.451 - + 41.931 - + 42.412 - + 41.931 - + 41.451 - + 40.489 - + 41.451 - + 43.854 - + 43.854 - + 43.373 - + 42.892 - + 42.412 - + 43.373 - + 43.373 - + 43.373 - + 43.373 - + 41.931 - + 41.931 - + 42.412 - + 42.412 - + 42.892 - + 43.373 - + 43.854 - + 45.296 - + 46.738 - + 47.699 - + 47.699 - + 47.699 - + 49.141 - + 49.141 - + 48.660 - + 50.583 - + 51.544 - + 51.544 - + 51.544 - + 52.505 - + 53.947 - + 55.870 - + 57.793 - + 58.273 - + 60.196 - + 61.157 - + 63.080 - + 65.002 - + 65.002 - + 67.406 - + 68.848 - + 68.848 - + 69.328 - + 69.809 - + 70.770 - + 70.770 - + 71.732 - + 72.212 - + 71.251 - + 69.809 - + 69.809 - + 68.848 - + 67.886 - + 66.925 - + 65.002 - + 65.002 - + 64.041 - + 65.483 - + 65.483 - + 65.964 - + 66.444 - + 66.444 - + 66.925 - + 67.886 - + 68.367 - + 68.367 - + 68.367 - + 69.328 - + 69.328 - + 70.770 - + 72.693 - + 71.732 - + 68.367 - + 68.848 - + 68.367 - + 69.809 - + 71.732 - + 73.174 - + 73.654 - + 75.577 - + 76.057 - + 76.538 - + 77.019 - + 77.980 - + 80.383 - + 80.383 - + 81.825 - + 82.306 - + 82.787 - + 82.787 - + 84.229 - + 84.709 - + 84.709 - + 84.709 - + 84.709 - + 84.709 - + 84.229 - + 84.229 - + 83.748 - + 84.709 - + 85.190 - + 86.151 - + 85.670 - + 85.670 - + 84.709 - + 84.709 - + 83.748 - + 83.748 - + 83.748 - + 83.748 - + 83.267 - + 83.267 - + 83.748 - + 84.229 - + 84.709 - + 84.709 - + 84.709 - + 85.190 - + 85.190 - + 84.709 - + 84.709 - + 84.229 - + 84.229 - + 83.267 - + 82.787 - + 83.267