Merge remote-tracking branch 'mutability/master' into dev

This commit is contained in:
Oliver Jowett 2016-07-25 13:13:07 +01:00
commit ad71d8b76c
5 changed files with 52 additions and 5 deletions

View file

@ -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;
}

View file

@ -119,9 +119,17 @@ ChartBundleLayers = false;
// 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;

View file

@ -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) {

View file

@ -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',

View file

@ -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);
}