From 61fb7f1c6723941767e1fe8ace90864896e5f891 Mon Sep 17 00:00:00 2001 From: Stanley Huang Date: Wed, 24 Feb 2016 17:16:01 +1100 Subject: Changed acceleration threshold for brake points --- utilities/data2kml/data2kml.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'utilities/data2kml') diff --git a/utilities/data2kml/data2kml.cpp b/utilities/data2kml/data2kml.cpp index fa167f7..4aff0e5 100644 --- a/utilities/data2kml/data2kml.cpp +++ b/utilities/data2kml/data2kml.cpp @@ -257,7 +257,7 @@ void WriteKMLTail(KML_DATA* kd) fprintf(kd->fp, ""); for (i = 0; i < kd->datacount; i++) { - fprintf(kd->fp, "%.2f", (float)kd->dataset[i].alt / 100); + fprintf(kd->fp, "%d", kd->dataset[i].alt); } fprintf(kd->fp, ""); @@ -271,7 +271,7 @@ void WriteKMLTail(KML_DATA* kd) fprintf(kd->fp, ""); for (i = 0; i < kd->datacount; i++) { - fprintf(kd->fp, "X:%d Y:%d Z:%d", kd->dataset[i].acc[0] / 64, kd->dataset[i].acc[1] / 64, kd->dataset[i].acc[2] / 64); + fprintf(kd->fp, "X:%d Y:%d Z:%d", kd->dataset[i].acc[0], kd->dataset[i].acc[1], kd->dataset[i].acc[2]); } fprintf(kd->fp, ""); fprintf(kd->fp, ""); @@ -298,7 +298,8 @@ void WriteKMLTail(KML_DATA* kd) else continue; - if (g <= -0.15f) { + // determine brake point + if (g <= -0.2f) { n++; fprintf(kd->fp, "#%d %u:%02u", n, kd->dataset[i].timestamp / 60000, (kd->dataset[i].timestamp / 1000) % 60); fprintf(kd->fp, "#brakepoint%f,%f", kd->dataset[i].lng, kd->dataset[i].lat); @@ -405,12 +406,13 @@ int ConvertToKML(const char* logfile, const char* kmlfile, uint32_t startpos, ui if (!p++) continue; char* value = p; - printf("Time=%.2f %X=%s\n", (float)ts / 1000, pid, value); + printf("Time=%02u:%02u.%03u %X=%s\t\t\r", ts / 60000, (ts % 60000) / 1000, ts % 1000, pid, value); if (!kd->fp) { kd->fp = fopen(kmlfile, "w"); //fprintf(kd->fp, "%s", kmlhead); AppendFile(kd->fp, "kmlhead.txt"); } + WriteKMLData(kd, ts, pid, value); count++; @@ -435,7 +437,7 @@ int main(int argc, const char* argv[]) int endpos = 0; char outfile[256]; - printf("Data2KML (C)2013-14 Written by Stanley Huang \n\n"); + printf("Data2KML (C)2013-16 Written by Stanley Huang \n\n"); if (argc <= 1) { printf("Usage: %s [Input file] [Output file] [Start Pos] [End Pos]\n\n", argv[0]); printf("Description about the arguments:\n\n\ -- cgit v1.2.3