Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hopefully the real fix for garmin_xt tool issues. #781

Merged
merged 1 commit into from
Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions garmin_xt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -296,6 +296,7 @@ format_garmin_xt_proc_strk()
}
PrevLat = Lat;
PrevLon = Lon;
PrevTime = Time;
}
}

Expand All @@ -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);
Expand Down
Loading