From 3b54329b359c374da1dba7ceaedd11f65e951d20 Mon Sep 17 00:00:00 2001 From: Stanley Huang Date: Sat, 27 Sep 2014 22:51:57 +1000 Subject: Sync with latest data logging sketches --- utilities/data2kml/README.txt | 4 ++-- utilities/data2kml/data2kml.cpp | 5 ++++- utilities/data2kml/logdata.h | 18 ++++++++---------- 3 files changed, 14 insertions(+), 13 deletions(-) (limited to 'utilities/data2kml') diff --git a/utilities/data2kml/README.txt b/utilities/data2kml/README.txt index e14c021..2a99d35 100644 --- a/utilities/data2kml/README.txt +++ b/utilities/data2kml/README.txt @@ -1,2 +1,2 @@ -Data2KML is an open-source command line utility written by Stanley Huang for Arduino Telematics Kits(http://freematics.com). -Simply drag and drop a data log CSV file to the data2kml.exe and a KML file will be generated. +Data2KML is an open-source command line utility written by Stanley Huang for Freematics OBD-II Telematics Kit (http://freematics.com/products). +Simply drag and drop a data log CSV file to the data2kml.exe and a KML file will be generated. \ No newline at end of file diff --git a/utilities/data2kml/data2kml.cpp b/utilities/data2kml/data2kml.cpp index 0875503..cbcded5 100644 --- a/utilities/data2kml/data2kml.cpp +++ b/utilities/data2kml/data2kml.cpp @@ -11,6 +11,7 @@ #include #include #include "logdata.h" +#include "kmlhead.h" typedef struct { uint32_t timestamp; @@ -114,7 +115,7 @@ void WriteKMLData(KML_DATA* kd, uint32_t timestamp, uint16_t pid, float value[]) fprintf(kd->fp, "T%02u:%02u:%02u.%03uZ", kd->curTime / 10000000, (kd->curTime / 100000) % 100, (kd->curTime / 1000) % 100, kd->curTime % 1000); } fprintf(kd->fp, ""); - fprintf(kd->fp, "%f %f %f", kd->datas.lon, kd->datas.lat, kd->datas.alt); + fprintf(kd->fp, "%f %f %d", kd->datas.lon, kd->datas.lat, kd->datas.alt); kd->datas.timestamp = timestamp; kd->dataset = (DATASET*)realloc(kd->dataset, sizeof(DATASET) * (kd->datacount + 1)); @@ -284,6 +285,7 @@ int ConvertToKML(const char* logfile, const char* kmlfile, uint32_t startpos, ui KML_DATA* kd = (KML_DATA*)calloc(1, sizeof(KML_DATA)); kd->fp = fopen(kmlfile, "w"); + //fprintf(kd->fp, "%s", kmlhead); AppendFile(kd->fp, "kmlhead.txt"); int elapsed; @@ -328,6 +330,7 @@ int ConvertToKML(const char* logfile, const char* kmlfile, uint32_t startpos, ui WriteKMLTail(kd); Cleanup(kd); + fclose(fp); return 0; } diff --git a/utilities/data2kml/logdata.h b/utilities/data2kml/logdata.h index 68eb36f..46c1d39 100644 --- a/utilities/data2kml/logdata.h +++ b/utilities/data2kml/logdata.h @@ -19,8 +19,6 @@ #define PID_TIME_TIME 0xF002 #define PID_TIME_PLAY_SPEED 0xF003 -#define PID_TURBO_BOOST 0xF108 - #define PID_STAT_0_60 0xF100 #define PID_STAT_0_100 0xF101 #define PID_STAT_0_160 0xF102 @@ -59,15 +57,15 @@ enum { PID_DEVICE_TEMP, }; -#define PID_GPS_COORDINATES 0xF00A -#define PID_GPS_ALTITUDE 0xF00C -#define PID_GPS_SPEED 0xF00D -#define PID_GPS_HEADING 0xF00E -#define PID_GPS_SAT_COUNT 0xF00F -#define PID_GPS_TIME 0xF010 +#define PID_GPS_COORDINATES 0xA +#define PID_GPS_ALTITUDE 0xC +#define PID_GPS_SPEED 0xD +#define PID_GPS_HEADING 0xE +#define PID_GPS_SAT_COUNT 0xF +#define PID_GPS_TIME 0x10 -#define PID_ACC 0xF020 -#define PID_GYRO 0xF021 +#define PID_ACC 0x20 +#define PID_GYRO 0x21 #define PID_VIDEO_FRAME 0xFF00 -- cgit v1.2.3