Merge remote-tracking branch 'mutability/master' into dev
This commit is contained in:
commit
ad71d8b76c
|
@ -528,6 +528,7 @@ void demodulate2400AC(struct mag_buf *mag)
|
||||||
// ----- X1/X2/X3 average noise
|
// ----- X1/X2/X3 average noise
|
||||||
|
|
||||||
float midpoint = sqrtf(x1x2x3_noise * f1f2_signal); // so that signal/midpoint == midpoint/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 noise_threshold = (unsigned) (midpoint * 0.707107 + 0.5); // -3dB from midpoint
|
||||||
unsigned signal_threshold = (unsigned) (midpoint * 1.414214 + 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;
|
noisy_bits <<= 1;
|
||||||
|
|
||||||
// check for excessive noise in the quiet period
|
// check for excessive noise in the quiet period
|
||||||
if (m[sample+2] >= noise_threshold) {
|
if (m[sample+2] >= quiet_threshold) {
|
||||||
//fprintf(stderr, "bit %u was not quiet (%u > %u)\n", bit, m[sample+2], signal_threshold);
|
//fprintf(stderr, "bit %u was not quiet (%u > %u)\n", bit, m[sample+2], quiet_threshold);
|
||||||
noisy_bits |= 1;
|
noisy_bits |= 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,9 +119,17 @@ ChartBundleLayers = false;
|
||||||
// Provide a Bing Maps API key here to enable the Bing imagery layer.
|
// Provide a Bing Maps API key here to enable the Bing imagery layer.
|
||||||
// You can obtain a free key (with usage limits) at
|
// You can obtain a free key (with usage limits) at
|
||||||
// https://www.bingmapsportal.com/ (you need a "basic key")
|
// https://www.bingmapsportal.com/ (you need a "basic key")
|
||||||
|
//
|
||||||
|
// Be sure to quote your key:
|
||||||
|
// BingMapsAPIKey = "your key here";
|
||||||
|
//
|
||||||
BingMapsAPIKey = null;
|
BingMapsAPIKey = null;
|
||||||
|
|
||||||
// Provide a Mapzen API key here to enable the Mapzen vector tile layer.
|
// 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 can obtain a free key at https://mapzen.com/developers/
|
||||||
// (you need a "vector tiles" key)
|
// (you need a "vector tiles" key)
|
||||||
|
//
|
||||||
|
// Be sure to quote your key:
|
||||||
|
// MapzenAPIKey = "your key here";
|
||||||
|
//
|
||||||
MapzenAPIKey = null;
|
MapzenAPIKey = null;
|
||||||
|
|
|
@ -26,6 +26,15 @@ function createBaseLayers() {
|
||||||
title: 'Bing Aerial',
|
title: 'Bing Aerial',
|
||||||
type: 'base',
|
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) {
|
if (MapzenAPIKey) {
|
||||||
|
|
|
@ -392,7 +392,7 @@ PlaneObject.prototype.clearMarker = function() {
|
||||||
|
|
||||||
// Update our marker on the map
|
// Update our marker on the map
|
||||||
PlaneObject.prototype.updateMarker = function(moved) {
|
PlaneObject.prototype.updateMarker = function(moved) {
|
||||||
if (!this.visible) {
|
if (!this.visible || this.position == null) {
|
||||||
this.clearMarker();
|
this.clearMarker();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -414,7 +414,10 @@ PlaneObject.prototype.updateMarker = function(moved) {
|
||||||
PlaneObject.prototype.updateLines = function() {
|
PlaneObject.prototype.updateLines = function() {
|
||||||
if (!this.selected)
|
if (!this.selected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (this.track_linesegs.length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
var estimateStyle = new ol.style.Style({
|
var estimateStyle = new ol.style.Style({
|
||||||
stroke: new ol.style.Stroke({
|
stroke: new ol.style.Stroke({
|
||||||
color: '#a08080',
|
color: '#a08080',
|
||||||
|
|
|
@ -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
|
// Initalizes the map and starts up our timers to call various functions
|
||||||
function initialize_map() {
|
function initialize_map() {
|
||||||
// Load stored map settings if present
|
// Load stored map settings if present
|
||||||
|
@ -489,7 +513,9 @@ function initialize_map() {
|
||||||
distance *= 1.852;
|
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);
|
feature.setStyle(circleStyle);
|
||||||
StaticFeatures.push(feature);
|
StaticFeatures.push(feature);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue