mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-25 17:25:14 +03:00
fixes
This commit is contained in:
parent
841b05ccd7
commit
d18b72b3dc
3 changed files with 104 additions and 92 deletions
|
@ -65,7 +65,7 @@ let FwApproach = function (number, approachAltAsl = 0, landAltAsl = 0, approachD
|
||||||
self.setIsSeaLevelRef = function (data) {
|
self.setIsSeaLevelRef = function (data) {
|
||||||
isSeaLevelRef = data;
|
isSeaLevelRef = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.getElevation = function() {
|
self.getElevation = function() {
|
||||||
return elevation;
|
return elevation;
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ let FwApproach = function (number, approachAltAsl = 0, landAltAsl = 0, approachD
|
||||||
self.getElevationFromServer = async function (lon, lat, globalSettings) {
|
self.getElevationFromServer = async function (lon, lat, globalSettings) {
|
||||||
let elevation = "N/A";
|
let elevation = "N/A";
|
||||||
if (globalSettings.mapProviderType == 'bing') {
|
if (globalSettings.mapProviderType == 'bing') {
|
||||||
let elevationEarthModel = $('#elevationEarthModel').prop("checked") ? "sealevel" : "ellipsoid";
|
let elevationEarthModel = $('#elevationEarthModel').prop("checked") ? "ellipsoid" : "sealevel";
|
||||||
|
|
||||||
const response = await fetch('http://dev.virtualearth.net/REST/v1/Elevation/List?points='+lat+','+lon+'&heights='+elevationEarthModel+'&key='+globalSettings.mapApiKey);
|
const response = await fetch('http://dev.virtualearth.net/REST/v1/Elevation/List?points='+lat+','+lon+'&heights='+elevationEarthModel+'&key='+globalSettings.mapApiKey);
|
||||||
const myJson = await response.json();
|
const myJson = await response.json();
|
||||||
|
|
|
@ -442,7 +442,7 @@ let WaypointCollection = function () {
|
||||||
|
|
||||||
let elevation = "N/A";
|
let elevation = "N/A";
|
||||||
if (globalSettings.mapProviderType == 'bing') {
|
if (globalSettings.mapProviderType == 'bing') {
|
||||||
let elevationEarthModel = $('#elevationEarthModel').prop("checked") ? "sealevel" : "ellipsoid";
|
let elevationEarthModel = $('#elevationEarthModel').prop("checked") ? "ellipsoid" : "sealevel";
|
||||||
|
|
||||||
if (point2measure.length >1) {
|
if (point2measure.length >1) {
|
||||||
const response = await fetch('http://dev.virtualearth.net/REST/v1/Elevation/Polyline?points='+point2measure+'&heights='+elevationEarthModel+'&samples='+String(samples+1)+'&key='+globalSettings.mapApiKey);
|
const response = await fetch('http://dev.virtualearth.net/REST/v1/Elevation/Polyline?points='+point2measure+'&heights='+elevationEarthModel+'&samples='+String(samples+1)+'&key='+globalSettings.mapApiKey);
|
||||||
|
|
|
@ -80,8 +80,8 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
let textFeature;
|
let textFeature;
|
||||||
var textGeom;
|
var textGeom;
|
||||||
let isOffline = false;
|
let isOffline = false;
|
||||||
let rthUpdateInterval = 0;
|
let rthUpdateInterval = 0;
|
||||||
let settings = { speed: 0, alt: 5000, safeRadiusSH : 50, maxDistSH : 0, fwApproachLength: 0, fwApproachAlt: 60, fwLandAlt: 5, fwLoiterRadius: 0};
|
let settings = {speed: 0, alt: 5000, safeRadiusSH: 50, fwApproachAlt: 60, fwLandAlt: 5, maxDistSH: 0, fwApproachLength: 0, fwLoiterRadius: 0, bingDemModel: false};
|
||||||
|
|
||||||
if (GUI.active_tab != 'mission_control') {
|
if (GUI.active_tab != 'mission_control') {
|
||||||
GUI.active_tab = 'mission_control';
|
GUI.active_tab = 'mission_control';
|
||||||
|
@ -102,7 +102,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
},
|
},
|
||||||
function (callback) {
|
function (callback) {
|
||||||
mspHelper.getSetting("safehome_max_distance").then((data) => {
|
mspHelper.getSetting("safehome_max_distance").then((data) => {
|
||||||
settings.maxDistSH = parseInt(data.value) / 100;
|
settings.maxDistSH = parseInt(data.value) / 100;
|
||||||
}).then(callback);
|
}).then(callback);
|
||||||
},
|
},
|
||||||
function (callback) {
|
function (callback) {
|
||||||
|
@ -390,9 +390,9 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
var lines = []; // Layer for lines between waypoints
|
var lines = []; // Layer for lines between waypoints
|
||||||
var safehomeMarkers = []; // layer for Safehome points
|
var safehomeMarkers = []; // layer for Safehome points
|
||||||
var safehomeMarkers = []; // layer for Safehome points
|
var safehomeMarkers = []; // layer for Safehome points
|
||||||
var approachLayers = [] // Layers for FW approach
|
var approachLayers = [] // Layers for FW approach
|
||||||
var safehomeMarkers = []; // layer for Safehome points
|
var safehomeMarkers = []; // layer for Safehome points
|
||||||
var approachLayers = [] // Layers for FW approach
|
var approachLayers = [] // Layers for FW approach
|
||||||
|
|
||||||
var map;
|
var map;
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// define & init parameters for default Settings
|
// define & init parameters for default Settings
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -468,8 +468,15 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
function loadSettings() {
|
function loadSettings() {
|
||||||
chrome.storage.local.get('missionPlannerSettings', function (result) {
|
chrome.storage.local.get('missionPlannerSettings', function (result) {
|
||||||
if (result.missionPlannerSettings) {
|
if (result.missionPlannerSettings) {
|
||||||
|
if (result.missionPlannerSettings.fwApproachLength == undefined && settings.fwApproachLength) {
|
||||||
|
result.missionPlannerSettings.fwApproachLength = settings.fwApproachLength;
|
||||||
|
result.missionPlannerSettings.maxDistSH = settings.maxDistSH;
|
||||||
|
result.missionPlannerSettings.fwLoiterRadius = settings.fwLoiterRadius;
|
||||||
|
}
|
||||||
|
saveSettings();
|
||||||
settings = result.missionPlannerSettings;
|
settings = result.missionPlannerSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshSettings();
|
refreshSettings();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -572,14 +579,14 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function paintApproachLine(pos1, pos2, color, layers)
|
function paintApproachLine(pos1, pos2, color, layers)
|
||||||
{
|
{
|
||||||
var line = new ol.geom.LineString([ol.proj.fromLonLat([pos1.lon, pos1.lat]), ol.proj.fromLonLat([pos2.lon, pos2.lat])]);
|
var line = new ol.geom.LineString([ol.proj.fromLonLat([pos1.lon, pos1.lat]), ol.proj.fromLonLat([pos2.lon, pos2.lat])]);
|
||||||
|
|
||||||
var feature = new ol.Feature({
|
var feature = new ol.Feature({
|
||||||
geometry: line
|
geometry: line
|
||||||
});
|
});
|
||||||
|
|
||||||
var styles = [ new ol.style.Style({
|
var styles = [ new ol.style.Style({
|
||||||
stroke: new ol.style.Stroke({
|
stroke: new ol.style.Stroke({
|
||||||
color: color,
|
color: color,
|
||||||
|
@ -593,7 +600,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
var dx = end[0] - start[0];
|
var dx = end[0] - start[0];
|
||||||
var dy = end[1] - start[1];
|
var dy = end[1] - start[1];
|
||||||
var rotation = Math.atan2(dy, dx);
|
var rotation = Math.atan2(dy, dx);
|
||||||
|
|
||||||
styles.push(new ol.style.Style({
|
styles.push(new ol.style.Style({
|
||||||
geometry: new ol.geom.Point(distanceOnLine(start, end, -8)),
|
geometry: new ol.geom.Point(distanceOnLine(start, end, -8)),
|
||||||
image: new ol.style.RegularShape({
|
image: new ol.style.RegularShape({
|
||||||
|
@ -611,24 +618,24 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
var vectorSource = new ol.source.Vector({
|
var vectorSource = new ol.source.Vector({
|
||||||
features: [feature]
|
features: [feature]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var vectorLayer = new ol.layer.Vector({
|
var vectorLayer = new ol.layer.Vector({
|
||||||
source: vectorSource
|
source: vectorSource
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
vectorLayer.kind = "approachline";
|
vectorLayer.kind = "approachline";
|
||||||
vectorLayer.selection = false;
|
vectorLayer.selection = false;
|
||||||
|
|
||||||
|
|
||||||
approachLayers.push(vectorLayer);
|
approachLayers.push(vectorLayer);
|
||||||
|
|
||||||
approachLayers.push(vectorLayer);
|
approachLayers.push(vectorLayer);
|
||||||
map.addLayer(vectorLayer);
|
map.addLayer(vectorLayer);
|
||||||
layers.push(vectorLayer);
|
layers.push(vectorLayer);
|
||||||
|
|
||||||
return vectorLayer;
|
return vectorLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -643,20 +650,20 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var pos2 = calculate_new_cooridatnes(pos1, direction, Math.max(settings.fwLoiterRadius * 4, settings.fwApproachLength / 2));
|
var pos2 = calculate_new_cooridatnes(pos1, direction, Math.max(settings.fwLoiterRadius * 4, settings.fwApproachLength / 2));
|
||||||
|
|
||||||
paintApproachLine(landCoord, pos2, '#0025a1', layers);
|
paintApproachLine(landCoord, pos2, '#0025a1', layers);
|
||||||
paintApproachLine(pos2, pos1, '#0025a1', layers);
|
paintApproachLine(pos2, pos1, '#0025a1', layers);
|
||||||
paintApproachLine(pos1, landCoord, '#f78a05', layers);
|
paintApproachLine(pos1, landCoord, '#f78a05', layers);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addFwApproach(lon, lat, fwApproach, layers)
|
function addFwApproach(lon, lat, fwApproach, layers)
|
||||||
{
|
{
|
||||||
if (fwApproach.getLandHeading1() != 0) {
|
if (fwApproach.getLandHeading1() != 0) {
|
||||||
let bearing = wrap_360(Math.abs(fwApproach.getLandHeading1()) + 180);
|
let bearing = wrap_360(Math.abs(fwApproach.getLandHeading1()) + 180);
|
||||||
paintApproach({lat: lat, lon: lon}, settings.fwApproachLength, bearing, fwApproach.getApproachDirection(), layers);
|
paintApproach({lat: lat, lon: lon}, settings.fwApproachLength, bearing, fwApproach.getApproachDirection(), layers);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fwApproach.getLandHeading1() > 0) {
|
if (fwApproach.getLandHeading1() > 0) {
|
||||||
let direction = fwApproach.getApproachDirection() == ApproachDirection.LEFT ? ApproachDirection.RIGHT : ApproachDirection.LEFT;
|
let direction = fwApproach.getApproachDirection() == ApproachDirection.LEFT ? ApproachDirection.RIGHT : ApproachDirection.LEFT;
|
||||||
paintApproach({lat: lat, lon: lon}, settings.fwApproachLength, fwApproach.getLandHeading1(), direction, layers);
|
paintApproach({lat: lat, lon: lon}, settings.fwApproachLength, fwApproach.getLandHeading1(), direction, layers);
|
||||||
}
|
}
|
||||||
|
@ -672,7 +679,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addSafehomeCircles(safehome) {
|
function addSafehomeCircles(safehome) {
|
||||||
/*
|
/*
|
||||||
* add safehome on Map
|
* add safehome on Map
|
||||||
*/
|
*/
|
||||||
|
@ -727,7 +734,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
vectorLayer.selection = false;
|
vectorLayer.selection = false;
|
||||||
|
|
||||||
safehomeMarkers.push(vectorLayer);
|
safehomeMarkers.push(vectorLayer);
|
||||||
map.addLayer(vectorLayer);
|
map.addLayer(vectorLayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addSafeHomeMarker(safehome) {
|
function addSafeHomeMarker(safehome) {
|
||||||
|
@ -1277,7 +1284,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
$('#missionDistance').text(lengthMission[lengthMission.length -1] != -1 ? lengthMission[lengthMission.length -1].toFixed(1) : 'infinite');
|
$('#missionDistance').text(lengthMission[lengthMission.length -1] != -1 ? lengthMission[lengthMission.length -1].toFixed(1) : 'infinite');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function paintLine(pos1, pos2, pos2ID, color='#1497f1', lineDash=0, lineText="", selection=true, arrow=false) {
|
function paintLine(pos1, pos2, pos2ID, color='#1497f1', lineDash=0, lineText="", selection=true, arrow=false) {
|
||||||
|
@ -1385,7 +1392,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
map.addLayer(addWaypointMarker(element));
|
map.addLayer(addWaypointMarker(element));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1398,19 +1405,19 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
|
|
||||||
function renderSafeHomeOptions() {
|
function renderSafeHomeOptions() {
|
||||||
if (selectedSafehome && selectedFwApproachSh) {
|
if (selectedSafehome && selectedFwApproachSh) {
|
||||||
|
|
||||||
lockShExclHeading = true;
|
lockShExclHeading = true;
|
||||||
if (!$('#missionPlannerSafehome').is(':visible')) {
|
if (!$('#missionPlannerSafehome').is(':visible')) {
|
||||||
$('#missionPlannerSafehome').fadeIn(300);
|
$('#missionPlannerSafehome').fadeIn(300);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#SafehomeContentBox').show();
|
$('#SafehomeContentBox').show();
|
||||||
|
|
||||||
if (selectedFwApproachSh.getLandHeading1() == 0 && selectedFwApproachSh.getLandHeading1() == 0 && selectedFwApproachSh.getApproachAltAsl() == 0 && selectedFwApproachSh.getLandAltAsl() == 0) {
|
if (selectedFwApproachSh.getLandHeading1() == 0 && selectedFwApproachSh.getLandHeading1() == 0 && selectedFwApproachSh.getApproachAltAsl() == 0 && selectedFwApproachSh.getLandAltAsl() == 0) {
|
||||||
selectedFwApproachSh.setApproachAltAsl(settings.fwApproachAlt * 100);
|
selectedFwApproachSh.setApproachAltAsl(settings.fwApproachAlt * 100);
|
||||||
selectedFwApproachSh.setLandAltAsl(settings.fwLandAlt * 100);
|
selectedFwApproachSh.setLandAltAsl(settings.fwLandAlt * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedFwApproachSh.getElevation() == 0) {
|
if (selectedFwApproachSh.getElevation() == 0) {
|
||||||
(async () => {
|
(async () => {
|
||||||
const elevation = await selectedFwApproachSh.getElevationFromServer(selectedSafehome.getLonMap(), selectedSafehome.getLatMap(), globalSettings) * 100;
|
const elevation = await selectedFwApproachSh.getElevationFromServer(selectedSafehome.getLonMap(), selectedSafehome.getLatMap(), globalSettings) * 100;
|
||||||
|
@ -1418,7 +1425,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
$('#safehomeElevation').text(selectedFwApproachSh.getElevation() / 100 + " m");
|
$('#safehomeElevation').text(selectedFwApproachSh.getElevation() / 100 + " m");
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
const $safehomeBox = $safehomeContentBox.find('.missionPlannerSafehomeBox:last-child');
|
const $safehomeBox = $safehomeContentBox.find('.missionPlannerSafehomeBox:last-child');
|
||||||
$safehomeBox.find('.spacer_box_title').text(chrome.i18n.getMessage('safehomeEdit') + ' ' + (selectedSafehome.getNumber() + 1));
|
$safehomeBox.find('.spacer_box_title').text(chrome.i18n.getMessage('safehomeEdit') + ' ' + (selectedSafehome.getNumber() + 1));
|
||||||
|
|
||||||
|
@ -1781,7 +1788,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
if (tempMarker.kind == "safehomecircle") {
|
if (tempMarker.kind == "safehomecircle") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var map = evt.map;
|
var map = evt.map;
|
||||||
|
|
||||||
var feature = map.forEachFeatureAtPixel(evt.pixel,
|
var feature = map.forEachFeatureAtPixel(evt.pixel,
|
||||||
|
@ -1789,7 +1796,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
return feature;
|
return feature;
|
||||||
});
|
});
|
||||||
|
|
||||||
var deltaX = evt.coordinate[0] - this.coordinate_[0];
|
var deltaX = evt.coordinate[0] - this.coordinate_[0];
|
||||||
var deltaY = evt.coordinate[1] - this.coordinate_[1];
|
var deltaY = evt.coordinate[1] - this.coordinate_[1];
|
||||||
|
|
||||||
var geometry = /** @type {ol.geom.SimpleGeometry} */
|
var geometry = /** @type {ol.geom.SimpleGeometry} */
|
||||||
|
@ -1798,7 +1805,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
geometry.translate(deltaX, deltaY);
|
geometry.translate(deltaX, deltaY);
|
||||||
this.coordinate_[0] = evt.coordinate[0];
|
this.coordinate_[0] = evt.coordinate[0];
|
||||||
this.coordinate_[1] = evt.coordinate[1];
|
this.coordinate_[1] = evt.coordinate[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
let coord = ol.proj.toLonLat(geometry.getCoordinates());
|
let coord = ol.proj.toLonLat(geometry.getCoordinates());
|
||||||
if (tempMarker.kind == "waypoint") {
|
if (tempMarker.kind == "waypoint") {
|
||||||
|
@ -1871,7 +1878,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
if (mission.getWaypoint(tempMarker.number).getAction() == MWNP.WPTYPE.LAND) {
|
if (mission.getWaypoint(tempMarker.number).getAction() == MWNP.WPTYPE.LAND) {
|
||||||
let approach = FW_APPROACH.get()[SAFEHOMES.getMaxSafehomeCount() + mission.getWaypoint(tempMarker.number).getMultiMissionIdx()];
|
let approach = FW_APPROACH.get()[SAFEHOMES.getMaxSafehomeCount() + mission.getWaypoint(tempMarker.number).getMultiMissionIdx()];
|
||||||
if (approach.getIsSeaLevelRef()) {
|
if (approach.getIsSeaLevelRef()) {
|
||||||
if (approach.getElevation() != 0) {
|
if (approach.getElevation() != 0) {
|
||||||
approach.setApproachAltAsl(approach.getApproachAltAsl() - approach.getElevation() + elevationAtWP * 100);
|
approach.setApproachAltAsl(approach.getApproachAltAsl() - approach.getElevation() + elevationAtWP * 100);
|
||||||
approach.setLandAltAsl(approach.getLandAltAsl() - approach.getElevation() + elevationAtWP * 100);
|
approach.setLandAltAsl(approach.getLandAltAsl() - approach.getElevation() + elevationAtWP * 100);
|
||||||
}
|
}
|
||||||
|
@ -1879,10 +1886,10 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
$('#wpApproachAlt').val(approach.getApproachAltAsl());
|
$('#wpApproachAlt').val(approach.getApproachAltAsl());
|
||||||
$('#wpLandAlt').val(approach.getLandAltAsl);
|
$('#wpLandAlt').val(approach.getLandAltAsl);
|
||||||
$('#wpLandAltM').text(approach.getLandAltAsl() / 100 + " m");
|
$('#wpLandAltM').text(approach.getLandAltAsl() / 100 + " m");
|
||||||
$('#wpApproachAltM').text(approach.getApproachAltAsl() / 100 + " m");
|
$('#wpApproachAltM').text(approach.getApproachAltAsl() / 100 + " m");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plotElevation();
|
plotElevation();
|
||||||
})()
|
})()
|
||||||
}
|
}
|
||||||
|
@ -1900,15 +1907,15 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
let approach = FW_APPROACH.get()[tempMarker.number];
|
let approach = FW_APPROACH.get()[tempMarker.number];
|
||||||
let safehome = SAFEHOMES.get()[tempMarker.number];
|
let safehome = SAFEHOMES.get()[tempMarker.number];
|
||||||
const elevation = await approach.getElevationFromServer(safehome.getLonMap(), safehome.getLatMap(), globalSettings) * 100;
|
const elevation = await approach.getElevationFromServer(safehome.getLonMap(), safehome.getLatMap(), globalSettings) * 100;
|
||||||
$('#safehomeElevation').text(elevation / 100 + " m");
|
$('#safehomeElevation').text(elevation / 100 + " m");
|
||||||
if (approach.getIsSeaLevelRef()) {
|
if (approach.getIsSeaLevelRef()) {
|
||||||
if (approach.getElevation() != 0) {
|
if (approach.getElevation() != 0) {
|
||||||
approach.setApproachAltAsl(approach.getApproachAltAsl() - approach.getElevation() + elevation);
|
approach.setApproachAltAsl(approach.getApproachAltAsl() - approach.getElevation() + elevation);
|
||||||
approach.setLandAltAsl(approach.getLandAltAsl() - approach.getElevation() + elevation);
|
approach.setLandAltAsl(approach.getLandAltAsl() - approach.getElevation() + elevation);
|
||||||
}
|
}
|
||||||
approach.setElevation(elevation);
|
approach.setElevation(elevation);
|
||||||
}
|
}
|
||||||
renderSafeHomeOptions();
|
renderSafeHomeOptions();
|
||||||
})()
|
})()
|
||||||
}
|
}
|
||||||
this.coordinate_ = null;
|
this.coordinate_ = null;
|
||||||
|
@ -2030,7 +2037,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
if (selectedFeature && tempMarker.kind == "waypoint") {
|
if (selectedFeature && tempMarker.kind == "waypoint") {
|
||||||
$("#editMission").hide();
|
$("#editMission").hide();
|
||||||
selectedMarker = mission.getWaypoint(tempMarker.number);
|
selectedMarker = mission.getWaypoint(tempMarker.number);
|
||||||
|
|
||||||
selectedFwApproachWp = FW_APPROACH.get()[SAFEHOMES.getMaxSafehomeCount() + selectedMarker.getMultiMissionIdx()];
|
selectedFwApproachWp = FW_APPROACH.get()[SAFEHOMES.getMaxSafehomeCount() + selectedMarker.getMultiMissionIdx()];
|
||||||
|
|
||||||
if (selectedFwApproachWp.getLandHeading1() == 0 && selectedFwApproachWp.getLandHeading1() == 0 && selectedFwApproachWp.getApproachAltAsl() == 0 && selectedFwApproachWp.getLandAltAsl() == 0) {
|
if (selectedFwApproachWp.getLandHeading1() == 0 && selectedFwApproachWp.getLandHeading1() == 0 && selectedFwApproachWp.getApproachAltAsl() == 0 && selectedFwApproachWp.getLandAltAsl() == 0) {
|
||||||
|
@ -2052,9 +2059,9 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
changeSwitchery($('#pointP3UserAction4'), TABS.mission_control.isBitSet(P3Value, MWNP.P3.USER_ACTION_4));
|
changeSwitchery($('#pointP3UserAction4'), TABS.mission_control.isBitSet(P3Value, MWNP.P3.USER_ACTION_4));
|
||||||
|
|
||||||
var altitudeMeters = app.ConvertCentimetersToMeters(selectedMarker.getAlt());
|
var altitudeMeters = app.ConvertCentimetersToMeters(selectedMarker.getAlt());
|
||||||
|
|
||||||
if (selectedMarker.getAction() == MWNP.WPTYPE.LAND) {
|
if (selectedMarker.getAction() == MWNP.WPTYPE.LAND) {
|
||||||
$('#wpFwLanding').fadeIn(300);
|
$('#wpFwLanding').fadeIn(300);
|
||||||
} else {
|
} else {
|
||||||
$('#wpFwLanding').fadeOut(300);
|
$('#wpFwLanding').fadeOut(300);
|
||||||
}
|
}
|
||||||
|
@ -2072,7 +2079,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
selectedFwApproachWp.setApproachDirection(selectedFwApproachWp.getApproachDirection() + elevationAtWP * 100);
|
selectedFwApproachWp.setApproachDirection(selectedFwApproachWp.getApproachDirection() + elevationAtWP * 100);
|
||||||
selectedFwApproachWp.setLandAltAsl(selectedFwApproachWp.getLandAltAsl() + elevationAtWP * 100);
|
selectedFwApproachWp.setLandAltAsl(selectedFwApproachWp.getLandAltAsl() + elevationAtWP * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
selectedFwApproachWp.setIsSeaLevelRef(TABS.mission_control.isBitSet(P3Value, MWNP.P3.ALT_TYPE) ? 1 : 0);
|
selectedFwApproachWp.setIsSeaLevelRef(TABS.mission_control.isBitSet(P3Value, MWNP.P3.ALT_TYPE) ? 1 : 0);
|
||||||
|
@ -2096,17 +2103,17 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
$('#pointP1').val(selectedMarker.getP1());
|
$('#pointP1').val(selectedMarker.getP1());
|
||||||
$('#pointP2').val(selectedMarker.getP2());
|
$('#pointP2').val(selectedMarker.getP2());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#wpApproachDirection').val(selectedFwApproachWp.getApproachDirection());
|
$('#wpApproachDirection').val(selectedFwApproachWp.getApproachDirection());
|
||||||
$('#wpLandHeading1').val(Math.abs(selectedFwApproachWp.getLandHeading1()));
|
$('#wpLandHeading1').val(Math.abs(selectedFwApproachWp.getLandHeading1()));
|
||||||
changeSwitchery($('#wpLandHeading1Excl'), selectedFwApproachWp.getLandHeading1() < 0);
|
changeSwitchery($('#wpLandHeading1Excl'), selectedFwApproachWp.getLandHeading1() < 0);
|
||||||
$('#wpLandHeading2').val(Math.abs(selectedFwApproachWp.getLandHeading2()));
|
$('#wpLandHeading2').val(Math.abs(selectedFwApproachWp.getLandHeading2()));
|
||||||
changeSwitchery($('#wpLandHeading2Excl'), selectedFwApproachWp.getLandHeading2() < 0);
|
changeSwitchery($('#wpLandHeading2Excl'), selectedFwApproachWp.getLandHeading2() < 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#wpApproachDirection').val(selectedFwApproachWp.getApproachDirection());
|
$('#wpApproachDirection').val(selectedFwApproachWp.getApproachDirection());
|
||||||
$('#wpLandHeading1').val(Math.abs(selectedFwApproachWp.getLandHeading1()));
|
$('#wpLandHeading1').val(Math.abs(selectedFwApproachWp.getLandHeading1()));
|
||||||
changeSwitchery($('#wpLandHeading1Excl'), selectedFwApproachWp.getLandHeading1() < 0);
|
changeSwitchery($('#wpLandHeading1Excl'), selectedFwApproachWp.getLandHeading1() < 0);
|
||||||
|
@ -2131,7 +2138,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
let tempWpCoord = ol.proj.toLonLat(evt.coordinate);
|
let tempWpCoord = ol.proj.toLonLat(evt.coordinate);
|
||||||
let tempWp = new Waypoint(tempMarker.number, MWNP.WPTYPE.WAYPOINT, Math.round(tempWpCoord[1] * 10000000), Math.round(tempWpCoord[0] * 10000000), alt=Number(settings.alt), p1=Number(settings.speed));
|
let tempWp = new Waypoint(tempMarker.number, MWNP.WPTYPE.WAYPOINT, Math.round(tempWpCoord[1] * 10000000), Math.round(tempWpCoord[0] * 10000000), alt=Number(settings.alt), p1=Number(settings.speed));
|
||||||
tempWp.setMultiMissionIdx(mission.getWaypoint(0).getMultiMissionIdx());
|
tempWp.setMultiMissionIdx(mission.getWaypoint(0).getMultiMissionIdx());
|
||||||
|
|
||||||
if (homeMarkers.length && HOME.getAlt() != "N/A") {
|
if (homeMarkers.length && HOME.getAlt() != "N/A") {
|
||||||
(async () => {
|
(async () => {
|
||||||
const elevationAtWP = await tempWp.getElevation(globalSettings);
|
const elevationAtWP = await tempWp.getElevation(globalSettings);
|
||||||
|
@ -2151,7 +2158,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
else if (selectedFeature && tempMarker.kind == "safehome" && tempMarker.selection) {
|
else if (selectedFeature && tempMarker.kind == "safehome" && tempMarker.selection) {
|
||||||
updateSelectedShAndFwAp(tempMarker.number);
|
updateSelectedShAndFwAp(tempMarker.number);
|
||||||
//renderSafeHomeOptions();
|
//renderSafeHomeOptions();
|
||||||
}
|
}
|
||||||
else if (selectedFeature && tempMarker.kind == "home" && tempMarker.selection) {
|
else if (selectedFeature && tempMarker.kind == "home" && tempMarker.selection) {
|
||||||
selectedMarker = HOME;
|
selectedMarker = HOME;
|
||||||
|
@ -2163,14 +2170,14 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
else if (!disableMarkerEdit) {
|
else if (!disableMarkerEdit) {
|
||||||
let tempWpCoord = ol.proj.toLonLat(evt.coordinate);
|
let tempWpCoord = ol.proj.toLonLat(evt.coordinate);
|
||||||
let tempWp = new Waypoint(mission.get().length, MWNP.WPTYPE.WAYPOINT, Math.round(tempWpCoord[1] * 10000000), Math.round(tempWpCoord[0] * 10000000), alt=Number(settings.alt), p1=Number(settings.speed));
|
let tempWp = new Waypoint(mission.get().length, MWNP.WPTYPE.WAYPOINT, Math.round(tempWpCoord[1] * 10000000), Math.round(tempWpCoord[0] * 10000000), alt=Number(settings.alt), p1=Number(settings.speed));
|
||||||
|
|
||||||
if (mission.get().length == 0) {
|
if (mission.get().length == 0) {
|
||||||
tempWp.setMultiMissionIdx(multimissionCount == 0 ? 0 : multimissionCount - 1);
|
tempWp.setMultiMissionIdx(multimissionCount == 0 ? 0 : multimissionCount - 1);
|
||||||
FW_APPROACH.clean(SAFEHOMES.getMaxSafehomeCount() + tempWp.getMultiMissionIdx());
|
FW_APPROACH.clean(SAFEHOMES.getMaxSafehomeCount() + tempWp.getMultiMissionIdx());
|
||||||
} else {
|
} else {
|
||||||
tempWp.setMultiMissionIdx(mission.getWaypoint(mission.get().length - 1).getMultiMissionIdx());
|
tempWp.setMultiMissionIdx(mission.getWaypoint(mission.get().length - 1).getMultiMissionIdx());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (homeMarkers.length && HOME.getAlt() != "N/A") {
|
if (homeMarkers.length && HOME.getAlt() != "N/A") {
|
||||||
(async () => {
|
(async () => {
|
||||||
const elevationAtWP = await tempWp.getElevation(globalSettings);
|
const elevationAtWP = await tempWp.getElevation(globalSettings);
|
||||||
|
@ -2315,7 +2322,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
$('#pointType').on('change', (event) => {
|
$('#pointType').on('change', (event) => {
|
||||||
if (selectedMarker) {
|
if (selectedMarker) {
|
||||||
if (Number($('#pointType').val()) == MWNP.WPTYPE.LAND) {
|
if (Number($('#pointType').val()) == MWNP.WPTYPE.LAND) {
|
||||||
let found = false;
|
let found = false;
|
||||||
mission.get().forEach(wp => {
|
mission.get().forEach(wp => {
|
||||||
if (wp.getAction() == MWNP.WPTYPE.LAND) {
|
if (wp.getAction() == MWNP.WPTYPE.LAND) {
|
||||||
alert(chrome.i18n.getMessage('MissionPlannerOnlyOneLandWp'));
|
alert(chrome.i18n.getMessage('MissionPlannerOnlyOneLandWp'));
|
||||||
|
@ -2323,15 +2330,15 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
$(event.currentTarget).val(selectedMarker.getAction());
|
$(event.currentTarget).val(selectedMarker.getAction());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
$('#wpFwLanding').fadeIn(300);
|
$('#wpFwLanding').fadeIn(300);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$('#wpFwLanding').fadeOut(300);
|
$('#wpFwLanding').fadeOut(300);
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedMarker.setAction(Number($('#pointType').val()));
|
selectedMarker.setAction(Number($('#pointType').val()));
|
||||||
if ([MWNP.WPTYPE.SET_POI,MWNP.WPTYPE.POSHOLD_TIME,MWNP.WPTYPE.LAND].includes(selectedMarker.getAction())) {
|
if ([MWNP.WPTYPE.SET_POI,MWNP.WPTYPE.POSHOLD_TIME,MWNP.WPTYPE.LAND].includes(selectedMarker.getAction())) {
|
||||||
selectedMarker.setP1(0.0);
|
selectedMarker.setP1(0.0);
|
||||||
|
@ -2429,12 +2436,16 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
if ($('#pointP3Alt').prop("checked")) {
|
if ($('#pointP3Alt').prop("checked")) {
|
||||||
selectedMarker.setAlt(groundClearance + elevationAtWP * 100);
|
selectedMarker.setAlt(groundClearance + elevationAtWP * 100);
|
||||||
} else {
|
} else {
|
||||||
selectedMarker.setAlt(altitude - Number(elevationAtWP) * 100);
|
let elevationAtHome = HOME.getAlt();
|
||||||
|
if (isNaN(elevationAtHome)) {
|
||||||
|
elevationAtHome = elevationAtWP;
|
||||||
|
}
|
||||||
|
selectedMarker.setAlt(groundClearance + 100 * (elevationAtWP - elevationAtHome));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedMarker.getAction() == MWNP.WPTYPE.LAND && selectedFwApproachWp && selectedFwApproachWp.getIsSeaLevelRef() != $('#pointP3Alt').prop("checked")) {
|
if (selectedMarker.getAction() == MWNP.WPTYPE.LAND && selectedFwApproachWp && selectedFwApproachWp.getIsSeaLevelRef() != $('#pointP3Alt').prop("checked")) {
|
||||||
|
|
||||||
let oldElevation = 0;
|
let oldElevation = 0;
|
||||||
if (selectedFwApproachWp.getIsSeaLevelRef()) {
|
if (selectedFwApproachWp.getIsSeaLevelRef()) {
|
||||||
oldElevation = selectedFwApproachWp.getElevation();
|
oldElevation = selectedFwApproachWp.getElevation();
|
||||||
}
|
}
|
||||||
|
@ -2449,7 +2460,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
selectedFwApproachWp.setElevation(elevationAtWP * 100);
|
selectedFwApproachWp.setElevation(elevationAtWP * 100);
|
||||||
selectedFwApproachWp.setIsSeaLevelRef($('#pointP3Alt').prop("checked") ? 1 : 0);
|
selectedFwApproachWp.setIsSeaLevelRef($('#pointP3Alt').prop("checked") ? 1 : 0);
|
||||||
$('#wpApproachAlt').val(selectedFwApproachWp.getApproachAltAsl());
|
$('#wpApproachAlt').val(selectedFwApproachWp.getApproachAltAsl());
|
||||||
$('#wpLandAlt').val(selectedFwApproachWp.getLandAltAsl());
|
$('#wpLandAlt').val(selectedFwApproachWp.getLandAltAsl());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2459,10 +2470,10 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
$('#pointAlt').val(selectedMarker.getAlt());
|
$('#pointAlt').val(selectedMarker.getAlt());
|
||||||
altitudeMeters = app.ConvertCentimetersToMeters(selectedMarker.getAlt());
|
altitudeMeters = app.ConvertCentimetersToMeters(selectedMarker.getAlt());
|
||||||
$('#altitudeInMeters').text(` ${altitudeMeters}m`);
|
$('#altitudeInMeters').text(` ${altitudeMeters}m`);
|
||||||
|
|
||||||
$('#wpLandAltM').text(selectedFwApproachWp.getLandAltAsl() / 100 + " m");
|
$('#wpLandAltM').text(selectedFwApproachWp.getLandAltAsl() / 100 + " m");
|
||||||
$('#wpApproachAltM').text(selectedFwApproachWp.getApproachAltAsl() / 100 + " m");
|
$('#wpApproachAltM').text(selectedFwApproachWp.getApproachAltAsl() / 100 + " m");
|
||||||
|
|
||||||
if (selectedFwApproachWp && selectedFwApproachWp.getIsSeaLevelRef() != $('#pointP3Alt').prop("checked")) {
|
if (selectedFwApproachWp && selectedFwApproachWp.getIsSeaLevelRef() != $('#pointP3Alt').prop("checked")) {
|
||||||
selectedFwApproachWp.setIsSeaLevelRef($('#pointP3Alt').prop("checked"));
|
selectedFwApproachWp.setIsSeaLevelRef($('#pointP3Alt').prop("checked"));
|
||||||
selectedFwApproachWp.setElevation(elevationAtWP * 100);
|
selectedFwApproachWp.setElevation(elevationAtWP * 100);
|
||||||
|
@ -2475,12 +2486,12 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#wpApproachAlt').val(selectedFwApproachWp.getApproachAltAsl());
|
$('#wpApproachAlt').val(selectedFwApproachWp.getApproachAltAsl());
|
||||||
$('#wpLandAlt').val(selectedFwApproachWp.getLandAltAsl());
|
$('#wpLandAlt').val(selectedFwApproachWp.getLandAltAsl());
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#wpLandAltM').text(selectedFwApproachWp.getLandAltAsl() / 100 + " m");
|
$('#wpLandAltM').text(selectedFwApproachWp.getLandAltAsl() / 100 + " m");
|
||||||
$('#wpApproachAltM').text(selectedFwApproachWp.getApproachAltAsl() / 100 + " m");
|
$('#wpApproachAltM').text(selectedFwApproachWp.getApproachAltAsl() / 100 + " m");
|
||||||
|
|
||||||
mission.updateWaypoint(selectedMarker);
|
mission.updateWaypoint(selectedMarker);
|
||||||
mission.update(singleMissionActive());
|
mission.update(singleMissionActive());
|
||||||
redrawLayer();
|
redrawLayer();
|
||||||
|
@ -2587,7 +2598,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
val = 0;
|
val = 0;
|
||||||
$('#wpLandHeading1').val(0);
|
$('#wpLandHeading1').val(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($('#wpLandHeading1Excl').prop('checked')) {
|
if ($('#wpLandHeading1Excl').prop('checked')) {
|
||||||
val *= -1;
|
val *= -1;
|
||||||
}
|
}
|
||||||
|
@ -2598,7 +2609,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#wpLandHeading1Excl').on('change', (event) => {
|
$('#wpLandHeading1Excl').on('change', (event) => {
|
||||||
|
|
||||||
if (selectedMarker && selectedFwApproachWp) {
|
if (selectedMarker && selectedFwApproachWp) {
|
||||||
if (disableMarkerEdit) {
|
if (disableMarkerEdit) {
|
||||||
changeSwitchery($('#wpLandHeading1Excl'), selectedFwApproachWp.getLandHeading1() < 0);
|
changeSwitchery($('#wpLandHeading1Excl'), selectedFwApproachWp.getLandHeading1() < 0);
|
||||||
|
@ -2610,7 +2621,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
} else {
|
} else {
|
||||||
selectedFwApproachWp.setLandHeading1(Math.abs(selectedFwApproachWp.getLandHeading1()));
|
selectedFwApproachWp.setLandHeading1(Math.abs(selectedFwApproachWp.getLandHeading1()));
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshLayers();
|
refreshLayers();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2626,7 +2637,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
val = 0;
|
val = 0;
|
||||||
$('#wpLandHeading2').val(0);
|
$('#wpLandHeading2').val(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($('#wpLandHeading2Excl').prop('checked')) {
|
if ($('#wpLandHeading2Excl').prop('checked')) {
|
||||||
val *= -1;
|
val *= -1;
|
||||||
}
|
}
|
||||||
|
@ -2691,7 +2702,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
alert(chrome.i18n.getMessage('missionSafehomeMaxSafehomesReached'));
|
alert(chrome.i18n.getMessage('missionSafehomeMaxSafehomesReached'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mapCenter = map.getView().getCenter();
|
let mapCenter = map.getView().getCenter();
|
||||||
let midLon = Math.round(ol.proj.toLonLat(mapCenter)[0] * 1e7);
|
let midLon = Math.round(ol.proj.toLonLat(mapCenter)[0] * 1e7);
|
||||||
let midLat = Math.round(ol.proj.toLonLat(mapCenter)[1] * 1e7);
|
let midLat = Math.round(ol.proj.toLonLat(mapCenter)[1] * 1e7);
|
||||||
|
@ -2720,7 +2731,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
} else {
|
} else {
|
||||||
selectedSafehome = null;
|
selectedSafehome = null;
|
||||||
selectedFwApproachSh = null;
|
selectedFwApproachSh = null;
|
||||||
}
|
}
|
||||||
renderSafeHomeOptions();
|
renderSafeHomeOptions();
|
||||||
cleanSafehomeLayers();
|
cleanSafehomeLayers();
|
||||||
renderSafehomesOnMap();
|
renderSafehomesOnMap();
|
||||||
|
@ -2735,7 +2746,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
$('#saveEepromSafehomeButton').on('click', function() {
|
$('#saveEepromSafehomeButton').on('click', function() {
|
||||||
$(this).addClass('disabled');
|
$(this).addClass('disabled');
|
||||||
GUI.log(chrome.i18n.getMessage('startSendingSafehomePoints'));
|
GUI.log(chrome.i18n.getMessage('startSendingSafehomePoints'));
|
||||||
|
|
||||||
var saveChainer = new MSPChainerClass();
|
var saveChainer = new MSPChainerClass();
|
||||||
saveChainer.setChain([
|
saveChainer.setChain([
|
||||||
mspHelper.saveSafehomes,
|
mspHelper.saveSafehomes,
|
||||||
|
@ -2788,7 +2799,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#safehomeSeaLevelRef').on('change', event => {
|
$('#safehomeSeaLevelRef').on('change', event => {
|
||||||
|
|
||||||
let isChecked = $(event.currentTarget).prop('checked') ? 1 : 0;
|
let isChecked = $(event.currentTarget).prop('checked') ? 1 : 0;
|
||||||
if (selectedSafehome && selectedFwApproachSh && isChecked != selectedFwApproachSh.getIsSeaLevelRef()) {
|
if (selectedSafehome && selectedFwApproachSh && isChecked != selectedFwApproachSh.getIsSeaLevelRef()) {
|
||||||
selectedFwApproachSh.setIsSeaLevelRef(isChecked);
|
selectedFwApproachSh.setIsSeaLevelRef(isChecked);
|
||||||
|
@ -2796,16 +2807,16 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
(async () => {
|
(async () => {
|
||||||
const elevation = await selectedFwApproachSh.getElevationFromServer(selectedSafehome.getLonMap(), selectedSafehome.getLatMap(), globalSettings) * 100;
|
const elevation = await selectedFwApproachSh.getElevationFromServer(selectedSafehome.getLonMap(), selectedSafehome.getLatMap(), globalSettings) * 100;
|
||||||
selectedFwApproachSh.setElevation(elevation);
|
selectedFwApproachSh.setElevation(elevation);
|
||||||
|
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
selectedFwApproachSh.setApproachAltAsl(selectedFwApproachSh.getApproachAltAsl() + elevation);
|
selectedFwApproachSh.setApproachAltAsl(selectedFwApproachSh.getApproachAltAsl() + elevation);
|
||||||
selectedFwApproachSh.setLandAltAsl(selectedFwApproachSh.getLandAltAsl() + elevation);
|
selectedFwApproachSh.setLandAltAsl(selectedFwApproachSh.getLandAltAsl() + elevation);
|
||||||
} else {
|
} else {
|
||||||
selectedFwApproachSh.setApproachAltAsl(selectedFwApproachSh.getApproachAltAsl() - elevation);
|
selectedFwApproachSh.setApproachAltAsl(selectedFwApproachSh.getApproachAltAsl() - elevation);
|
||||||
selectedFwApproachSh.setLandAltAsl(selectedFwApproachSh.getLandAltAsl() - elevation);
|
selectedFwApproachSh.setLandAltAsl(selectedFwApproachSh.getLandAltAsl() - elevation);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#safehomeElevation').text(elevation / 100);
|
$('#safehomeElevation').text(elevation / 100);
|
||||||
$('#safehomeApproachAlt').val(selectedFwApproachSh.getApproachAltAsl());
|
$('#safehomeApproachAlt').val(selectedFwApproachSh.getApproachAltAsl());
|
||||||
$('#safehomeLandAlt').val(selectedFwApproachSh.getLandAltAsl());
|
$('#safehomeLandAlt').val(selectedFwApproachSh.getLandAltAsl());
|
||||||
|
@ -2818,7 +2829,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#safehomeApproachAlt').on('change', event => {
|
$('#safehomeApproachAlt').on('change', event => {
|
||||||
|
|
||||||
if (selectedFwApproachSh) {
|
if (selectedFwApproachSh) {
|
||||||
let altitude = Number($(event.currentTarget).val());
|
let altitude = Number($(event.currentTarget).val());
|
||||||
if (checkApproachAltitude(altitude, $('#safehomeSeaLevelRef').prop('checked'), Number($('#safehomeElevation').text()))) {
|
if (checkApproachAltitude(altitude, $('#safehomeSeaLevelRef').prop('checked'), Number($('#safehomeElevation').text()))) {
|
||||||
|
@ -2830,11 +2841,11 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
$('#safehomeApproachAlt').val(selectedFwApproachSh.getApproachAltAsl());
|
$('#safehomeApproachAlt').val(selectedFwApproachSh.getApproachAltAsl());
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#safehomeLandAlt').on('change', event => {
|
$('#safehomeLandAlt').on('change', event => {
|
||||||
|
|
||||||
if (selectedFwApproachSh) {
|
if (selectedFwApproachSh) {
|
||||||
let altitude = Number($(event.currentTarget).val());
|
let altitude = Number($(event.currentTarget).val());
|
||||||
if (checkLandingAltitude(altitude, $('#safehomeSeaLevelRef').prop('checked'), Number($('#safehomeElevation').text()))) {
|
if (checkLandingAltitude(altitude, $('#safehomeSeaLevelRef').prop('checked'), Number($('#safehomeElevation').text()))) {
|
||||||
|
@ -2876,17 +2887,17 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
val = 0;
|
val = 0;
|
||||||
$('#safehomeLandHeading1').val(0);
|
$('#safehomeLandHeading1').val(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($('#safehomeLandHeading1Excl').prop('checked')) {
|
if ($('#safehomeLandHeading1Excl').prop('checked')) {
|
||||||
val *= -1;
|
val *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedFwApproachSh.setLandHeading1(val);
|
selectedFwApproachSh.setLandHeading1(val);
|
||||||
cleanSafehomeLayers();
|
cleanSafehomeLayers();
|
||||||
renderSafehomesOnMap();
|
renderSafehomesOnMap();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#safehomeLandHeading2Excl').on('change', event => {
|
$('#safehomeLandHeading2Excl').on('change', event => {
|
||||||
if (selectedFwApproachSh && !lockShExclHeading) {
|
if (selectedFwApproachSh && !lockShExclHeading) {
|
||||||
|
@ -2908,11 +2919,11 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
val = 0;
|
val = 0;
|
||||||
$('#safehomeLandHeading2').val(0);
|
$('#safehomeLandHeading2').val(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($('#safehomeLandHeading2Excl').prop('checked')) {
|
if ($('#safehomeLandHeading2Excl').prop('checked')) {
|
||||||
val *= -1;
|
val *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedFwApproachSh.setLandHeading2(val);
|
selectedFwApproachSh.setLandHeading2(val);
|
||||||
cleanSafehomeLayers();
|
cleanSafehomeLayers();
|
||||||
renderSafehomesOnMap();
|
renderSafehomesOnMap();
|
||||||
|
@ -3025,7 +3036,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
else if (mission.getAttachedFromWaypoint(selectedMarker) && mission.getAttachedFromWaypoint(selectedMarker).length != 0) {
|
else if (mission.getAttachedFromWaypoint(selectedMarker) && mission.getAttachedFromWaypoint(selectedMarker).length != 0) {
|
||||||
if (confirm(chrome.i18n.getMessage('confirm_delete_point_with_options'))) {
|
if (confirm(chrome.i18n.getMessage('confirm_delete_point_with_options'))) {
|
||||||
mission.getAttachedFromWaypoint(selectedMarker).forEach(function (element) {
|
mission.getAttachedFromWaypoint(selectedMarker).forEach(function (element) {
|
||||||
|
|
||||||
if (element.getAction() == MWNP.WPTYPE.LAND) {
|
if (element.getAction() == MWNP.WPTYPE.LAND) {
|
||||||
FW_APPROACH.clean(element.getNumber());
|
FW_APPROACH.clean(element.getNumber());
|
||||||
}
|
}
|
||||||
|
@ -3119,7 +3130,8 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
$('#saveSettings').on('click', function () {
|
$('#saveSettings').on('click', function () {
|
||||||
let oldSafeRadiusSH = settings.safeRadiusSH;
|
let oldSafeRadiusSH = settings.safeRadiusSH;
|
||||||
settings = { speed: Number($('#MPdefaultPointSpeed').val()), alt: Number($('#MPdefaultPointAlt').val()), safeRadiusSH: Number($('#MPdefaultSafeRangeSH').val()), maxDistSH : vMaxDistSH, fwApproachAlt: Number($('#MPdefaultFwApproachAlt').val()), fwLandAlt:Number($('#MPdefaultLandAlt').val())};
|
settings = { speed: Number($('#MPdefaultPointSpeed').val()), alt: Number($('#MPdefaultPointAlt').val()), safeRadiusSH: Number($('#MPdefaultSafeRangeSH').val()), fwApproachAlt: Number($('#MPdefaultFwApproachAlt').val()), fwLandAlt: Number($('#MPdefaultLandAlt').val()), fwApproachLength: settings.fwApproachLength, maxDistSH: settings.maxDistSH, fwLoiterRadius: settings.fwLoiterRadius, bingDemModel: settings.bingDemModel};
|
||||||
|
|
||||||
saveSettings();
|
saveSettings();
|
||||||
|
|
||||||
if (settings.safeRadiusSH != oldSafeRadiusSH && $('#showHideSafehomeButton').is(":visible")) {
|
if (settings.safeRadiusSH != oldSafeRadiusSH && $('#showHideSafehomeButton').is(":visible")) {
|
||||||
|
@ -3375,8 +3387,8 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
let approachIdx = 0;
|
let approachIdx = 0;
|
||||||
for (let i = SAFEHOMES.getMaxSafehomeCount(); i < FW_APPROACH.getMaxFwApproachCount(); i++){
|
for (let i = SAFEHOMES.getMaxSafehomeCount(); i < FW_APPROACH.getMaxFwApproachCount(); i++){
|
||||||
let approach = FW_APPROACH.get()[i];
|
let approach = FW_APPROACH.get()[i];
|
||||||
if (approach.getLandHeading1() != 0 || approach.getLandHeading2() != 0) {
|
if (approach.getLandHeading1() != 0 || approach.getLandHeading2() != 0) {
|
||||||
var item = { $: {
|
var item = { $: {
|
||||||
'index': approachIdx,
|
'index': approachIdx,
|
||||||
'no': approach.getNumber(),
|
'no': approach.getNumber(),
|
||||||
|
@ -3411,11 +3423,11 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
// mission = configurator store, WP number indexed from 0, MISSION_PLANNER = FC NVM store, WP number indexed from 1
|
// mission = configurator store, WP number indexed from 0, MISSION_PLANNER = FC NVM store, WP number indexed from 1
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
function getWaypointsFromFC(loadEeprom) {
|
function getWaypointsFromFC(loadEeprom) {
|
||||||
|
|
||||||
var loadChainer = new MSPChainerClass();
|
var loadChainer = new MSPChainerClass();
|
||||||
var chain = [mspHelper.loadFwApproach];
|
var chain = [mspHelper.loadFwApproach];
|
||||||
if (loadEeprom) {
|
if (loadEeprom) {
|
||||||
chain.push(function(callback) {
|
chain.push(function(callback) {
|
||||||
MSP.send_message(MSPCodes.MSP_WP_MISSION_LOAD, [0], callback);
|
MSP.send_message(MSPCodes.MSP_WP_MISSION_LOAD, [0], callback);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -3455,7 +3467,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
redrawLayers();
|
redrawLayers();
|
||||||
updateTotalInfo();
|
updateTotalInfo();
|
||||||
});
|
});
|
||||||
|
|
||||||
loadChainer.setChain(chain);
|
loadChainer.setChain(chain);
|
||||||
loadChainer.execute();
|
loadChainer.execute();
|
||||||
}
|
}
|
||||||
|
@ -3537,14 +3549,14 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
AbsAltCheck = (typeof AbsAltCheck == "boolean") ? AbsAltCheck : TABS.mission_control.isBitSet(AbsAltCheck, MWNP.P3.ALT_TYPE);
|
AbsAltCheck = (typeof AbsAltCheck == "boolean") ? AbsAltCheck : TABS.mission_control.isBitSet(AbsAltCheck, MWNP.P3.ALT_TYPE);
|
||||||
|
|
||||||
if (AbsAltCheck) {
|
if (AbsAltCheck) {
|
||||||
//if (checkAltitude < 100 * elevation) {
|
if (checkAltitude < 100 * elevation) {
|
||||||
if (resetAltitude) {
|
if (resetAltitude) {
|
||||||
alert(chrome.i18n.getMessage('MissionPlannerAltitudeChangeReset'));
|
alert(chrome.i18n.getMessage('MissionPlannerAltitudeChangeReset'));
|
||||||
altitude = selectedMarker.getAlt();
|
altitude = selectedMarker.getAlt();
|
||||||
} else {
|
} else {
|
||||||
altitude = settings.alt + 100 * elevation;
|
altitude = settings.alt + 100 * elevation;
|
||||||
}
|
}
|
||||||
//}
|
}
|
||||||
groundClearance = altitude / 100 - elevation;
|
groundClearance = altitude / 100 - elevation;
|
||||||
} else if (homeMarkers.length && HOME.getAlt() != "N/A") {
|
} else if (homeMarkers.length && HOME.getAlt() != "N/A") {
|
||||||
let elevationAtHome = HOME.getAlt();
|
let elevationAtHome = HOME.getAlt();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue