summaryrefslogtreecommitdiff
path: root/utilities
diff options
context:
space:
mode:
authorStanley Huang <stanleyhuangyc@gmail.com>2016-02-24 17:16:01 +1100
committerStanley Huang <stanleyhuangyc@gmail.com>2016-02-24 17:16:01 +1100
commit61fb7f1c6723941767e1fe8ace90864896e5f891 (patch)
tree2503695677047d6c62a59f5888630dcff3f9495a /utilities
parentb0ac5bbb3b93b5ad65f1ad589c661d295b22ce50 (diff)
download2021-arduino-obd-61fb7f1c6723941767e1fe8ace90864896e5f891.tar.gz
2021-arduino-obd-61fb7f1c6723941767e1fe8ace90864896e5f891.tar.bz2
2021-arduino-obd-61fb7f1c6723941767e1fe8ace90864896e5f891.zip
Changed acceleration threshold for brake points
Diffstat (limited to 'utilities')
-rw-r--r--utilities/data2kml/data2kml.cpp12
1 files changed, 7 insertions, 5 deletions
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, "<gx:SimpleArrayData name=\"alt\">");
for (i = 0; i < kd->datacount; i++) {
- fprintf(kd->fp, "<gx:value>%.2f</gx:value>", (float)kd->dataset[i].alt / 100);
+ fprintf(kd->fp, "<gx:value>%d</gx:value>", kd->dataset[i].alt);
}
fprintf(kd->fp, "</gx:SimpleArrayData>");
@@ -271,7 +271,7 @@ void WriteKMLTail(KML_DATA* kd)
fprintf(kd->fp, "<gx:SimpleArrayData name=\"acc\">");
for (i = 0; i < kd->datacount; i++) {
- fprintf(kd->fp, "<gx:value>X:%d Y:%d Z:%d</gx:value>", kd->dataset[i].acc[0] / 64, kd->dataset[i].acc[1] / 64, kd->dataset[i].acc[2] / 64);
+ fprintf(kd->fp, "<gx:value>X:%d Y:%d Z:%d</gx:value>", kd->dataset[i].acc[0], kd->dataset[i].acc[1], kd->dataset[i].acc[2]);
}
fprintf(kd->fp, "</gx:SimpleArrayData>");
fprintf(kd->fp, "<gx:SimpleArrayData name=\"ts\">");
@@ -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, "<Placemark><name>#%d %u:%02u</name>", n, kd->dataset[i].timestamp / 60000, (kd->dataset[i].timestamp / 1000) % 60);
fprintf(kd->fp, "<styleUrl>#brakepoint</styleUrl><Point><coordinates>%f,%f</coordinates></Point>", 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 <http://freematics.com> \n\n");
+ printf("Data2KML (C)2013-16 Written by Stanley Huang <http://freematics.com> \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\