summaryrefslogtreecommitdiff
path: root/utilities
diff options
context:
space:
mode:
authorStanley Huang <stanleyhuangyc@gmail.com>2014-09-27 22:51:57 +1000
committerStanley Huang <stanleyhuangyc@gmail.com>2014-09-27 22:51:57 +1000
commit3b54329b359c374da1dba7ceaedd11f65e951d20 (patch)
tree11bc56b7f8f1716fa8755fc3407a0010905f0d26 /utilities
parent0befafaac02ccf2aca7ab0e6a6a6ac03f2ea5950 (diff)
download2021-arduino-obd-3b54329b359c374da1dba7ceaedd11f65e951d20.tar.gz
2021-arduino-obd-3b54329b359c374da1dba7ceaedd11f65e951d20.tar.bz2
2021-arduino-obd-3b54329b359c374da1dba7ceaedd11f65e951d20.zip
Sync with latest data logging sketches
Diffstat (limited to 'utilities')
-rw-r--r--utilities/data2kml/README.txt4
-rw-r--r--utilities/data2kml/data2kml.cpp5
-rw-r--r--utilities/data2kml/logdata.h18
3 files changed, 14 insertions, 13 deletions
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 <stdlib.h>
#include <time.h>
#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, "</when>");
- fprintf(kd->fp, "<gx:coord>%f %f %f</gx:coord>", kd->datas.lon, kd->datas.lat, kd->datas.alt);
+ fprintf(kd->fp, "<gx:coord>%f %f %d</gx:coord>", 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