From 99696cfac0986ae754a9c40bafc83e350fbeea3a Mon Sep 17 00:00:00 2001 From: Bjorge Dijkstra Date: Thu, 18 Feb 2016 20:17:01 +0100 Subject: [PATCH 1/5] minor html syntax fixes for map view --- public_html/gmap.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/public_html/gmap.html b/public_html/gmap.html index 33b082e..a027f56 100644 --- a/public_html/gmap.html +++ b/public_html/gmap.html @@ -72,7 +72,7 @@ DUMP1090 - + @@ -146,7 +146,7 @@ Track: n/a - Last seen: n/a + Last seen: n/a @@ -161,6 +161,7 @@
+ @@ -171,6 +172,7 @@ + From 1d723b0731342969c0b8c2dfdac84ec3663f3cab Mon Sep 17 00:00:00 2001 From: Bjorge Dijkstra Date: Thu, 18 Feb 2016 20:20:35 +0100 Subject: [PATCH 2/5] Remove sensor parameter from google maps api url, it is no longer required. https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required --- public_html/gmap.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public_html/gmap.html b/public_html/gmap.html index a027f56..61daec7 100644 --- a/public_html/gmap.html +++ b/public_html/gmap.html @@ -5,7 +5,7 @@ - + From 3a98bf0d004249654f24048ec232abef3b9edf35 Mon Sep 17 00:00:00 2001 From: Bjorge Dijkstra Date: Thu, 18 Feb 2016 20:28:49 +0100 Subject: [PATCH 3/5] Remove invalid css property 'align' from timestamps div --- public_html/gmap.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public_html/gmap.html b/public_html/gmap.html index 61daec7..f62d063 100644 --- a/public_html/gmap.html +++ b/public_html/gmap.html @@ -42,7 +42,7 @@
ICAO FlightTrack Msgs Age
From a283ab2786d3c04afb35035618db77bc4337d886 Mon Sep 17 00:00:00 2001 From: Bjorge Dijkstra Date: Thu, 18 Feb 2016 20:47:17 +0100 Subject: [PATCH 4/5] Fix check for valid distance in drawCircle() --- public_html/script.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/public_html/script.js b/public_html/script.js index ce21e36..823f228 100644 --- a/public_html/script.js +++ b/public_html/script.js @@ -894,10 +894,11 @@ function resetMap() { function drawCircle(marker, distance) { if (typeof distance === 'undefined') { return false; - - if (!(!isNaN(parseFloat(distance)) && isFinite(distance)) || distance < 0) { - return false; - } + } + + distance = parseFloat(distance); + if (isNaN(distance) || !isFinite(distance) || distance < 0) { + return false; } distance *= 1000.0; From 214bc0e587fa70b7206c094e10e62c88bf387322 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Wed, 24 Feb 2016 11:51:45 +0000 Subject: [PATCH 5/5] Treat zero-or-missing signal levels as "no information" and don't include them in RSSI. --- net_io.c | 18 ++++++++++++------ track.c | 9 ++++++--- track.h | 1 + 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/net_io.c b/net_io.c index bff640f..1fa32f1 100644 --- a/net_io.c +++ b/net_io.c @@ -373,6 +373,7 @@ static void modesSendBeastOutput(struct modesMessage *mm) { char *p = prepareWrite(&Modes.beast_out, 2 + 2 * (7 + msgLen)); char ch; int j; + int sig; unsigned char *msg = (Modes.net_verbatim ? mm->verbatim : mm->msg); if (!p) @@ -402,7 +403,12 @@ static void modesSendBeastOutput(struct modesMessage *mm) { *p++ = (ch = (mm->timestampMsg)); if (0x1A == ch) {*p++ = ch; } - *p++ = ch = (char) round(sqrt(mm->signalLevel) * 255); + sig = round(sqrt(mm->signalLevel) * 255); + if (mm->signalLevel > 0 && sig < 1) + sig = 1; + if (sig > 255) + sig = 255; + *p++ = ch = (char)sig; if (0x1A == ch) {*p++ = ch; } for (j = 0; j < msgLen; j++) { @@ -729,8 +735,8 @@ static int decodeBinMessage(struct client *c, char *p) { clock_gettime(CLOCK_REALTIME, &mm.sysTimestampMsg); ch = *p++; // Grab the signal level - mm.signalLevel = ((unsigned char)ch / 256.0); - mm.signalLevel = mm.signalLevel * mm.signalLevel + 1e-5; + mm.signalLevel = ((unsigned char)ch / 255.0); + mm.signalLevel = mm.signalLevel * mm.signalLevel; if (0x1A == ch) {p++;} for (j = 0; j < msgLen; j++) { // and the data @@ -797,7 +803,7 @@ static int decodeHexMessage(struct client *c, char *hex) { // Mark messages received over the internet as remote so that we don't try to // pass them off as being received by this instance when forwarding them mm.remote = 1; - mm.signalLevel = 1e-5; + mm.signalLevel = 0; // Remove spaces on the left and on the right while(l && isspace(hex[l-1])) { @@ -814,8 +820,8 @@ static int decodeHexMessage(struct client *c, char *hex) { switch(hex[0]) { case '<': { - mm.signalLevel = ((hexDigitVal(hex[13])<<4) | hexDigitVal(hex[14])) / 256.0; - mm.signalLevel = mm.signalLevel * mm.signalLevel + 1e-5; + mm.signalLevel = ((hexDigitVal(hex[13])<<4) | hexDigitVal(hex[14])) / 255.0; + mm.signalLevel = mm.signalLevel * mm.signalLevel; hex += 15; l -= 16; // Skip <, timestamp and siglevel, and ; break;} diff --git a/track.c b/track.c index 8d1a4d0..4fc7763 100644 --- a/track.c +++ b/track.c @@ -66,8 +66,8 @@ struct aircraft *trackCreateAircraft(struct modesMessage *mm) { // Now initialise things that should not be 0/NULL to their defaults a->addr = mm->addr; for (i = 0; i < 8; ++i) - a->signalLevel[i] = mm->signalLevel; // First time, initialise everything - // to the first signal strength + a->signalLevel[i] = 1e-5; + a->signalNext = 0; // mm->msgtype 32 is used to represent Mode A/C. These values can never change, so // set them once here during initialisation, and don't bother to set them every @@ -478,7 +478,10 @@ struct aircraft *trackUpdateFromMessage(struct modesMessage *mm) Modes.aircrafts = a; } - a->signalLevel[a->messages & 7] = mm->signalLevel;// replace the 8th oldest signal strength + if (mm->signalLevel > 0) { + a->signalLevel[a->signalNext] = mm->signalLevel; + a->signalNext = (a->signalNext + 1) & 7; + } a->seen = now; a->messages++; diff --git a/track.h b/track.h index 9153050..21becb5 100644 --- a/track.h +++ b/track.h @@ -64,6 +64,7 @@ struct aircraft { uint32_t addr; // ICAO address char flight[16]; // Flight number double signalLevel[8]; // Last 8 Signal Amplitudes + int signalNext; // next index of signalLevel to use int altitude; // Altitude (Baro) int altitude_hae; // Altitude (HAE) int hae_delta; // Difference between HAE and Baro altitudes