From: Jordan Miller Date: Sat, 25 Apr 2009 21:01:11 +0000 (-0500) Subject: Adding Wali's 20090124 patch. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=673730e8913d77c5ec658865830087f44671dc01;p=gant Adding Wali's 20090124 patch. --- diff --git a/gant.c b/gant.c index 89a87c7..f4fdcf5 100644 --- a/gant.c +++ b/gant.c @@ -16,7 +16,7 @@ #include "antdefs.h" -char *releasetime = "Jan 21 2008, 12:00:00"; +char *releasetime = "Jan 24 2009, 16:10:12"; uint majorrelease = 0; uint minorrelease = 6; @@ -461,10 +461,9 @@ decode(ushort bloblen, ushort pkttype, ushort pktlen, int dsize, uchar *data) default: fprintf(tcxfile, "unknown value: %d", lapbuf[lap][40]); } fprintf(tcxfile, "\n"); - if (cad != 255) { - if (sporttyp_track[track_id-firsttrack_id] == 0) { - fprintf(tcxfile, " %d\n", cad); - } else { + // for bike the average cadence of this lap is here + if (sporttyp_track[track_id-firsttrack_id] == 1) { + if (cad != 255) { fprintf(tcxfile, " %d\n", cad); } } @@ -478,22 +477,26 @@ decode(ushort bloblen, ushort pkttype, ushort pktlen, int dsize, uchar *data) default: fprintf(tcxfile, "unknown value: %d", lapbuf[lap][42]); } fprintf(tcxfile, "\n"); + // I prefere the average run cadence here than at the end of this lap according windows ANTagent + if (sporttyp_track[track_id-firsttrack_id] == 0) { + if (cad != 255) { + fprintf(tcxfile, " \n"); + fprintf(tcxfile, " \n"); + fprintf(tcxfile, " %d\n", cad); + fprintf(tcxfile, " \n"); + fprintf(tcxfile, " \n"); + } + } fprintf(tcxfile, " \n"); lap++; - track_pause = 0; // if the previous trackpoint has same second as lap time display the trackpoint again if (dbg) printf("i %u tv %d tv_lap %d tv_previous %d\n", i, tv, tv_lap, tv_previous); if (tv_previous == tv_lap) { i -= 24; tv = tv_previous; } - } // end of if (tv >= tv_lap && lap <= lastlap) - if (track_pause) { - fprintf(tcxfile, " \n"); - fprintf(tcxfile, " \n"); track_pause = 0; - if (dbg) printf("track pause (stop and go)\n"); - } + } // end of if (tv >= tv_lap && lap <= lastlap) ttv = tv+631065600; // garmin epoch offset tmp = gmtime(&ttv); strftime(tbuf, sizeof tbuf, "%Y-%m-%dT%H:%M:%SZ", tmp); // format for printing @@ -509,6 +512,11 @@ decode(ushort bloblen, ushort pkttype, ushort pktlen, int dsize, uchar *data) u2 = data[doff+i+23]; if (dbg) printf("lat %.10g lon %.10g hr %d cad %d u1 %d u2 %d tv %d %s alt %f dist %f %02x %02x%02x%02x%02x\n", lat, lon, hr, cad, u1, u2, tv, tbuf, alt, dist, data[doff+i+3], data[doff+i+16], data[doff+i+17], data[doff+i+18], data[doff+i+19]); + // track pause only if following trackpoint is aswell 'timemarker' with utopic distance + if (track_pause && dist > (float)40000000) { + fprintf(tcxfile, " \n"); + fprintf(tcxfile, " \n"); + } fprintf(tcxfile, " \n"); fprintf(tcxfile, " \n",tbuf); if (lat < 90) { @@ -529,33 +537,40 @@ decode(ushort bloblen, ushort pkttype, ushort pktlen, int dsize, uchar *data) fprintf(tcxfile, " %d\n", hr); fprintf(tcxfile, " \n"); } - if (u1 > 0 && cad != 255) { - fprintf(tcxfile, " %d\n", cad); + // for bikes the cadence is written here and for the footpod in , why garmin? + if (sporttyp_track[track_id-firsttrack_id] == 1) { + if (cad != 255) { + fprintf(tcxfile, " %d\n", cad); + } } if (dist < (float)40000000) { fprintf(tcxfile, " %s\n", u1 ? "Present" : "Absent"); fprintf(tcxfile, " \n"); fprintf(tcxfile, " \n"); - fprintf(tcxfile, " %d\n", cad); - fprintf(tcxfile, " \n"); + if (sporttyp_track[track_id-firsttrack_id] == 1) { + fprintf(tcxfile, "Bike\"/>\n"); } else { - fprintf(tcxfile, "/>\n"); + fprintf(tcxfile, "Footpod\""); + if (cad != 255) { + fprintf(tcxfile, ">\n"); + fprintf(tcxfile, " %d\n", cad); + fprintf(tcxfile, " \n"); + } else { + fprintf(tcxfile, "/>\n"); + } } fprintf(tcxfile, " \n"); - } else { - // maybe if we recieve utopic position and distance this tells pause in the run (stop and go) - if (track_pause == 0) track_pause = 1; - else track_pause = 0; + track_pause = 0; } fprintf(tcxfile, " \n"); + // maybe if we recieve utopic position and distance this tells pause in the run (stop and go) if not begin or end of lap + if (dist > (float)40000000 && track_pause == 0) { + track_pause = 1; + if (dbg) printf("track pause (stop and go)\n"); + } else { + track_pause = 0; + } tv_previous = tv; } // end of for (i = 4; i < pktlen; i += 24) previoustrack_id = track_id;