From: Jordan Miller Date: Mon, 23 Mar 2009 04:34:52 +0000 (-0500) Subject: Syncing to ant0_t3 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d7ae4908d175b43ecef9d9411e6b4dddcda04b9;p=gant Syncing to ant0_t3 --- diff --git a/antdefs.h b/antdefs.h index b258438..b3d3cf0 100644 --- a/antdefs.h +++ b/antdefs.h @@ -1,5 +1,5 @@ -// copyright 2008 paul@ant.sbrk.co.uk. released under GPLv3 -// vers 0.4t +// copyright 2008-2009 paul@ant.sbrk.co.uk. released under GPLv3 +// vers 0.6t typedef unsigned char uchar; typedef uchar (*RESPONSE_FUNC)(uchar chan, uchar msgid); typedef uchar (*CHANNEL_EVENT_FUNC)(uchar chan, uchar event); @@ -24,7 +24,7 @@ typedef uchar (*CHANNEL_EVENT_FUNC)(uchar chan, uchar event); #define MESG_CHANNEL_SEARCH_TIMEOUT_ID 0x44 #define MESG_CHANNEL_STATUS_ID 0x52 #define MESG_CLOSE_CHANNEL_ID 0x4c -#define MESG_DATA_SIZE 13 // due to dodgy msg from suunto +#define MESG_DATA_SIZE 30 #define MESG_EXT_ACKNOWLEDGED_DATA_ID 0x5e #define MESG_EXT_BROADCAST_DATA_ID 0x5d #define MESG_EXT_BURST_DATA_ID 0x5f diff --git a/antlib.c b/antlib.c index bc0f85c..1a22cb1 100644 --- a/antlib.c +++ b/antlib.c @@ -1,5 +1,5 @@ // copyright 2008 paul@ant.sbrk.co.uk. released under GPLv3 -// vers 0.4t +// vers 0.6t #include #include #include diff --git a/gant.c b/gant.c index e4f6248..5c732ae 100644 --- a/gant.c +++ b/gant.c @@ -16,7 +16,7 @@ #include "antdefs.h" -char *releasetime = "Jan 24 2009, 16:10:12"; +char *releasetime = "Jan 21 2008, 12:00:00"; uint majorrelease = 0; uint minorrelease = 6; @@ -461,9 +461,10 @@ decode(ushort bloblen, ushort pkttype, ushort pktlen, int dsize, uchar *data) default: fprintf(tcxfile, "unknown value: %d", lapbuf[lap][40]); } fprintf(tcxfile, "\n"); - // for bike the average cadence of this lap is here - if (sporttyp_track[track_id-firsttrack_id] == 1) { - if (cad != 255) { + if (cad != 255) { + if (sporttyp_track[track_id-firsttrack_id] == 0) { + fprintf(tcxfile, " %d\n", cad); + } else { fprintf(tcxfile, " %d\n", cad); } } @@ -477,26 +478,22 @@ 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; } - track_pause = 0; } // 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"); + } ttv = tv+631065600; // garmin epoch offset tmp = gmtime(&ttv); strftime(tbuf, sizeof tbuf, "%Y-%m-%dT%H:%M:%SZ", tmp); // format for printing @@ -512,11 +509,6 @@ 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) { @@ -537,40 +529,33 @@ decode(ushort bloblen, ushort pkttype, ushort pktlen, int dsize, uchar *data) fprintf(tcxfile, " %d\n", hr); fprintf(tcxfile, " \n"); } - // 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 (u1 > 0 && cad != 255) { + fprintf(tcxfile, " %d\n", cad); } if (dist < (float)40000000) { fprintf(tcxfile, " %s\n", u1 ? "Present" : "Absent"); fprintf(tcxfile, " \n"); fprintf(tcxfile, " \n"); + switch(sporttyp_track[track_id-firsttrack_id]) { + case 1: fprintf(tcxfile, "Bike\""); break; + case 0: + default: fprintf(tcxfile, "Footpod\""); break; + } + if (u1 == 0 && cad != 255) { + fprintf(tcxfile, ">\n"); + fprintf(tcxfile, " %d\n", cad); + fprintf(tcxfile, " \n"); } else { - fprintf(tcxfile, "Footpod\""); - if (cad != 255) { - fprintf(tcxfile, ">\n"); - fprintf(tcxfile, " %d\n", cad); - fprintf(tcxfile, " \n"); - } else { - fprintf(tcxfile, "/>\n"); - } + fprintf(tcxfile, "/>\n"); } fprintf(tcxfile, " \n"); - 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; + // 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; } + fprintf(tcxfile, " \n"); tv_previous = tv; } // end of for (i = 4; i < pktlen; i += 24) previoustrack_id = track_id; @@ -1195,4 +1180,3 @@ main(int ac, char *av[]) for(;;) sleep(10); } -