From 6f3f2e205b9ee309714b704d37b2e2cc56cfc84e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberts=20Saul=C4=ABtis?= Date: Wed, 7 Oct 2015 20:19:48 +0300 Subject: [PATCH 1/2] Display metric on web page if --metric was defined antirez/dump1090#82 --- dump1090.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dump1090.c b/dump1090.c index 7fa5327a3..7764b6514 100644 --- a/dump1090.c +++ b/dump1090.c @@ -2155,8 +2155,8 @@ char *aircraftsToJson(int *len) { "{\"hex\":\"%s\", \"flight\":\"%s\", \"lat\":%f, " "\"lon\":%f, \"altitude\":%d, \"track\":%d, " "\"speed\":%d},\n", - a->hexaddr, a->flight, a->lat, a->lon, a->altitude, a->track, - a->speed); + a->hexaddr, a->flight, a->lat, a->lon, altitude, a->track, + speed); p += l; buflen -= l; /* Resize if needed. */ if (buflen < 256) { From f342094d1698ac37806a225512e34859654152f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberts=20Saul=C4=ABtis?= Date: Wed, 7 Oct 2015 20:48:13 +0300 Subject: [PATCH 2/2] Show rights units in web interface --- dump1090.c | 4 ++-- gmap.html | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dump1090.c b/dump1090.c index 7764b6514..3f032c8a2 100644 --- a/dump1090.c +++ b/dump1090.c @@ -2154,9 +2154,9 @@ char *aircraftsToJson(int *len) { l = snprintf(p,buflen, "{\"hex\":\"%s\", \"flight\":\"%s\", \"lat\":%f, " "\"lon\":%f, \"altitude\":%d, \"track\":%d, " - "\"speed\":%d},\n", + "\"speed\":%d, \"metric\":%d},\n", a->hexaddr, a->flight, a->lat, a->lon, altitude, a->track, - speed); + speed, Modes.metric); p += l; buflen -= l; /* Resize if needed. */ if (buflen < 256) { diff --git a/gmap.html b/gmap.html index b39a30a22..229cf6559 100644 --- a/gmap.html +++ b/gmap.html @@ -90,8 +90,14 @@ if (p.flight.length) { html += ''+p.flight+'
'; } - html += 'Altitude: '+p.altitude+' feet
'; - html += 'Speed: '+p.speed+' knots
'; + if (p.metric) { + html += 'Altitude: '+p.altitude+' meters
'; + html += 'Speed: '+p.speed+' km/h
'; + } + else { + html += 'Altitude: '+p.altitude+' feet
'; + html += 'Speed: '+p.speed+' knots
'; + } html += 'Coordinates: '+p.lat+', '+p.lon+'
'; i.innerHTML = html; } @@ -118,6 +124,7 @@ myplane.lon = plane.lon; myplane.track = plane.track; myplane.flight = plane.flight; + myplane.metric = plane.metric; if (myplane.hex == Selected) refreshSelectedInfo(); } else {