From a06b13d42aa3e864685d862972ea264595d28014 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Sun, 24 Jul 2016 15:05:52 +0100 Subject: [PATCH 1/5] Relax the A/C quiet threshold; this seems to pick up a lot more A/C messages. --- demod_2400.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/demod_2400.c b/demod_2400.c index 8f5ace7..e85db98 100644 --- a/demod_2400.c +++ b/demod_2400.c @@ -528,6 +528,7 @@ void demodulate2400AC(struct mag_buf *mag) // ----- X1/X2/X3 average noise float midpoint = sqrtf(x1x2x3_noise * f1f2_signal); // so that signal/midpoint == midpoint/noise + unsigned quiet_threshold = (unsigned) midpoint; unsigned noise_threshold = (unsigned) (midpoint * 0.707107 + 0.5); // -3dB from midpoint unsigned signal_threshold = (unsigned) (midpoint * 1.414214 + 0.5); // +3dB from midpoint @@ -563,8 +564,8 @@ void demodulate2400AC(struct mag_buf *mag) noisy_bits <<= 1; // check for excessive noise in the quiet period - if (m[sample+2] >= noise_threshold) { - //fprintf(stderr, "bit %u was not quiet (%u > %u)\n", bit, m[sample+2], signal_threshold); + if (m[sample+2] >= quiet_threshold) { + //fprintf(stderr, "bit %u was not quiet (%u > %u)\n", bit, m[sample+2], quiet_threshold); noisy_bits |= 1; continue; } From d3565b407e0e2e1a20c63e8301fb775e099b3598 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Sun, 24 Jul 2016 16:13:04 +0100 Subject: [PATCH 2/5] Generate geodesic circles for range rings. Turns out that OL3's circles aren't geodesic circles so the ranges are all off if you're anywhere but on the equator. So generate our own LineStrings that approximate a circle. Should fix #133 --- public_html/script.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/public_html/script.js b/public_html/script.js index dd4e687..09d19fb 100644 --- a/public_html/script.js +++ b/public_html/script.js @@ -316,6 +316,30 @@ function end_load_history() { } +// Make a LineString with 'points'-number points +// that is a closed circle on the sphere such that the +// great circle distance from 'center' to each point is +// 'radius' meters +function make_geodesic_circle(center, radius, points) { + var angularDistance = radius / 6378137.0; + var lon1 = center[0] * Math.PI / 180.0; + var lat1 = center[1] * Math.PI / 180.0; + var geom = new ol.geom.LineString(); + for (var i = 0; i <= points; ++i) { + var bearing = i * 2 * Math.PI / points; + + var lat2 = Math.asin( Math.sin(lat1)*Math.cos(angularDistance) + + Math.cos(lat1)*Math.sin(angularDistance)*Math.cos(bearing) ); + var lon2 = lon1 + Math.atan2(Math.sin(bearing)*Math.sin(angularDistance)*Math.cos(lat1), + Math.cos(angularDistance)-Math.sin(lat1)*Math.sin(lat2)); + + lat2 = lat2 * 180.0 / Math.PI; + lon2 = lon2 * 180.0 / Math.PI; + geom.appendCoordinate([lon2, lat2]); + } + return geom; +} + // Initalizes the map and starts up our timers to call various functions function initialize_map() { // Load stored map settings if present @@ -489,7 +513,9 @@ function initialize_map() { distance *= 1.852; } - var feature = new ol.Feature(new ol.geom.Circle(ol.proj.fromLonLat(SitePosition), distance)); + var circle = make_geodesic_circle(SitePosition, distance, 360); + circle.transform('EPSG:4326', 'EPSG:3857'); + var feature = new ol.Feature(circle); feature.setStyle(circleStyle); StaticFeatures.push(feature); } From 4305c99b01487552b4e8efba40eeabcf81e9fa60 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Sun, 24 Jul 2016 16:25:14 +0100 Subject: [PATCH 3/5] Add Bing roadmap layer (if you have a key) --- public_html/layers.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/public_html/layers.js b/public_html/layers.js index 329cd6d..4e7e13e 100644 --- a/public_html/layers.js +++ b/public_html/layers.js @@ -26,6 +26,15 @@ function createBaseLayers() { title: 'Bing Aerial', type: 'base', })); + world.push(new ol.layer.Tile({ + source: new ol.source.BingMaps({ + key: BingMapsAPIKey, + imagerySet: 'Road' + }), + name: 'bing_roads', + title: 'Bing Roads', + type: 'base', + })); } if (MapzenAPIKey) { From 426e77a2529be987159d302a89bd8e4a5cb39f1c Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Sun, 24 Jul 2016 16:58:13 +0100 Subject: [PATCH 4/5] Don't choke when selecting positionless planes in the table. --- public_html/planeObject.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public_html/planeObject.js b/public_html/planeObject.js index 13be440..44abb47 100644 --- a/public_html/planeObject.js +++ b/public_html/planeObject.js @@ -392,7 +392,7 @@ PlaneObject.prototype.clearMarker = function() { // Update our marker on the map PlaneObject.prototype.updateMarker = function(moved) { - if (!this.visible) { + if (!this.visible || this.position == null) { this.clearMarker(); return; } @@ -414,7 +414,10 @@ PlaneObject.prototype.updateMarker = function(moved) { PlaneObject.prototype.updateLines = function() { if (!this.selected) return; - + + if (this.track_linesegs.length == 0) + return; + var estimateStyle = new ol.style.Style({ stroke: new ol.style.Stroke({ color: '#a08080', From ca3c4979f54d9bb1b9b83bf77ad2699395d3a60f Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Sun, 24 Jul 2016 21:15:21 +0100 Subject: [PATCH 5/5] Add a note about quoting keys in config.js --- public_html/config.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/public_html/config.js b/public_html/config.js index 3764210..339fb73 100644 --- a/public_html/config.js +++ b/public_html/config.js @@ -119,9 +119,17 @@ ChartBundleLayers = true; // Provide a Bing Maps API key here to enable the Bing imagery layer. // You can obtain a free key (with usage limits) at // https://www.bingmapsportal.com/ (you need a "basic key") +// +// Be sure to quote your key: +// BingMapsAPIKey = "your key here"; +// BingMapsAPIKey = null; // Provide a Mapzen API key here to enable the Mapzen vector tile layer. // You can obtain a free key at https://mapzen.com/developers/ // (you need a "vector tiles" key) +// +// Be sure to quote your key: +// MapzenAPIKey = "your key here"; +// MapzenAPIKey = null;