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
|
@ -87,7 +87,7 @@ let FwApproach = function (number, approachAltAsl = 0, landAltAsl = 0, approachD
|
|||
self.getElevationFromServer = async function (lon, lat, globalSettings) {
|
||||
let elevation = "N/A";
|
||||
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 myJson = await response.json();
|
||||
|
|
|
@ -442,7 +442,7 @@ let WaypointCollection = function () {
|
|||
|
||||
let elevation = "N/A";
|
||||
if (globalSettings.mapProviderType == 'bing') {
|
||||
let elevationEarthModel = $('#elevationEarthModel').prop("checked") ? "sealevel" : "ellipsoid";
|
||||
let elevationEarthModel = $('#elevationEarthModel').prop("checked") ? "ellipsoid" : "sealevel";
|
||||
|
||||
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);
|
||||
|
|
|
@ -81,7 +81,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
var textGeom;
|
||||
let isOffline = false;
|
||||
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') {
|
||||
GUI.active_tab = 'mission_control';
|
||||
|
@ -468,8 +468,15 @@ TABS.mission_control.initialize = function (callback) {
|
|||
function loadSettings() {
|
||||
chrome.storage.local.get('missionPlannerSettings', function (result) {
|
||||
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;
|
||||
}
|
||||
|
||||
refreshSettings();
|
||||
});
|
||||
}
|
||||
|
@ -2429,7 +2436,11 @@ TABS.mission_control.initialize = function (callback) {
|
|||
if ($('#pointP3Alt').prop("checked")) {
|
||||
selectedMarker.setAlt(groundClearance + elevationAtWP * 100);
|
||||
} 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")) {
|
||||
|
@ -3119,7 +3130,8 @@ TABS.mission_control.initialize = function (callback) {
|
|||
/////////////////////////////////////////////
|
||||
$('#saveSettings').on('click', function () {
|
||||
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();
|
||||
|
||||
if (settings.safeRadiusSH != oldSafeRadiusSH && $('#showHideSafehomeButton').is(":visible")) {
|
||||
|
@ -3537,14 +3549,14 @@ TABS.mission_control.initialize = function (callback) {
|
|||
AbsAltCheck = (typeof AbsAltCheck == "boolean") ? AbsAltCheck : TABS.mission_control.isBitSet(AbsAltCheck, MWNP.P3.ALT_TYPE);
|
||||
|
||||
if (AbsAltCheck) {
|
||||
//if (checkAltitude < 100 * elevation) {
|
||||
if (checkAltitude < 100 * elevation) {
|
||||
if (resetAltitude) {
|
||||
alert(chrome.i18n.getMessage('MissionPlannerAltitudeChangeReset'));
|
||||
altitude = selectedMarker.getAlt();
|
||||
} else {
|
||||
altitude = settings.alt + 100 * elevation;
|
||||
}
|
||||
//}
|
||||
}
|
||||
groundClearance = altitude / 100 - elevation;
|
||||
} else if (homeMarkers.length && HOME.getAlt() != "N/A") {
|
||||
let elevationAtHome = HOME.getAlt();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue