mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-26 01:35:23 +03:00
Merge remote-tracking branch 'upstream/master' into abo_home_safehome_lon_lat_swap
This commit is contained in:
commit
0a0e451bfb
8 changed files with 342 additions and 109 deletions
|
@ -3346,7 +3346,7 @@
|
||||||
},
|
},
|
||||||
"osdSettingPLUS_CODE_DIGITS_HELP": {
|
"osdSettingPLUS_CODE_DIGITS_HELP": {
|
||||||
"message": "Precision at the equator: 10=13.9x13.9m; 11=2.8x3.5m; 12=56x87cm; 13=11x22cm."
|
"message": "Precision at the equator: 10=13.9x13.9m; 11=2.8x3.5m; 12=56x87cm; 13=11x22cm."
|
||||||
},
|
},
|
||||||
"osdSettingPLUS_CODE_SHORT_HELP": {
|
"osdSettingPLUS_CODE_SHORT_HELP": {
|
||||||
"message": "Removing 2, 4 and 6 leading digits requires a reference location within, respectively, ~800km, ~40km and ~2km to recover the original coordinates."
|
"message": "Removing 2, 4 and 6 leading digits requires a reference location within, respectively, ~800km, ~40km and ~2km to recover the original coordinates."
|
||||||
},
|
},
|
||||||
|
@ -3998,6 +3998,9 @@
|
||||||
"MissionPlannerJumpTargetRemoval": {
|
"MissionPlannerJumpTargetRemoval": {
|
||||||
"message": "You can't remove a Waypoint which is defined as a JUMP target! \nYou first need to remove the target on the waypoint triggering the JUMP."
|
"message": "You can't remove a Waypoint which is defined as a JUMP target! \nYou first need to remove the target on the waypoint triggering the JUMP."
|
||||||
},
|
},
|
||||||
|
"MissionPlannerAltitudeChangeReset": {
|
||||||
|
"message": "Altitude below ground level. Change ignored"
|
||||||
|
},
|
||||||
"SafehomeSelected": {
|
"SafehomeSelected": {
|
||||||
"message": ""
|
"message": ""
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,7 +15,7 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
||||||
self.setNumber = function (data) {
|
self.setNumber = function (data) {
|
||||||
number = data;
|
number = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getLayerNumber = function () {
|
self.getLayerNumber = function () {
|
||||||
return layerNumber;
|
return layerNumber;
|
||||||
};
|
};
|
||||||
|
@ -23,7 +23,7 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
||||||
self.setLayerNumber = function (data) {
|
self.setLayerNumber = function (data) {
|
||||||
layerNumber = data;
|
layerNumber = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getPoiNumber = function () {
|
self.getPoiNumber = function () {
|
||||||
return poiNumber;
|
return poiNumber;
|
||||||
};
|
};
|
||||||
|
@ -31,7 +31,7 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
||||||
self.setPoiNumber = function (data) {
|
self.setPoiNumber = function (data) {
|
||||||
poiNumber = data;
|
poiNumber = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.isUsed = function () {
|
self.isUsed = function () {
|
||||||
return isUsed;
|
return isUsed;
|
||||||
};
|
};
|
||||||
|
@ -39,7 +39,7 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
||||||
self.setUsed = function (data) {
|
self.setUsed = function (data) {
|
||||||
isUsed = data;
|
isUsed = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.isAttached = function () {
|
self.isAttached = function () {
|
||||||
return isAttached;
|
return isAttached;
|
||||||
};
|
};
|
||||||
|
@ -51,7 +51,7 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
||||||
self.getLon = function () {
|
self.getLon = function () {
|
||||||
return lon;
|
return lon;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getLonMap = function () {
|
self.getLonMap = function () {
|
||||||
return lon / 10000000;
|
return lon / 10000000;
|
||||||
};
|
};
|
||||||
|
@ -63,7 +63,7 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
||||||
self.getLat = function () {
|
self.getLat = function () {
|
||||||
return lat;
|
return lat;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getLatMap = function () {
|
self.getLatMap = function () {
|
||||||
return lat / 10000000;
|
return lat / 10000000;
|
||||||
};
|
};
|
||||||
|
@ -71,55 +71,55 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
||||||
self.setLat = function (data) {
|
self.setLat = function (data) {
|
||||||
lat = data;
|
lat = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getAction = function () {
|
self.getAction = function () {
|
||||||
return action;
|
return action;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.setAction = function (data) {
|
self.setAction = function (data) {
|
||||||
action = data;
|
action = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getAlt = function () {
|
self.getAlt = function () {
|
||||||
return alt;
|
return alt;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.setAlt = function (data) {
|
self.setAlt = function (data) {
|
||||||
alt = data;
|
alt = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getP1 = function () {
|
self.getP1 = function () {
|
||||||
return p1;
|
return p1;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.setP1 = function (data) {
|
self.setP1 = function (data) {
|
||||||
p1 = data;
|
p1 = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getP2 = function () {
|
self.getP2 = function () {
|
||||||
return p2;
|
return p2;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.setP2 = function (data) {
|
self.setP2 = function (data) {
|
||||||
p2 = data;
|
p2 = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getP3 = function () {
|
self.getP3 = function () {
|
||||||
return p3;
|
return p3;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.setP3 = function (data) {
|
self.setP3 = function (data) {
|
||||||
p3 = data;
|
p3 = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getEndMission = function () {
|
self.getEndMission = function () {
|
||||||
return endMission;
|
return endMission;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.setEndMission = function (data) {
|
self.setEndMission = function (data) {
|
||||||
endMission = data;
|
endMission = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getAttachedId = function () {
|
self.getAttachedId = function () {
|
||||||
return attachedId;
|
return attachedId;
|
||||||
};
|
};
|
||||||
|
@ -127,7 +127,7 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
||||||
self.setAttachedId = function (data) {
|
self.setAttachedId = function (data) {
|
||||||
attachedId = data;
|
attachedId = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getAttachedNumber = function () {
|
self.getAttachedNumber = function () {
|
||||||
return attachedNumber;
|
return attachedNumber;
|
||||||
};
|
};
|
||||||
|
@ -135,16 +135,18 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
||||||
self.setAttachedNumber = function (data) {
|
self.setAttachedNumber = function (data) {
|
||||||
attachedNumber = data;
|
attachedNumber = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getElevation = async function (globalSettings) {
|
self.getElevation = async function (globalSettings) {
|
||||||
let elevation;
|
let elevation;
|
||||||
if (globalSettings.mapProviderType == 'bing') {
|
if (globalSettings.mapProviderType == 'bing') {
|
||||||
const response = await fetch('http://dev.virtualearth.net/REST/v1/Elevation/List?points='+self.getLatMap()+','+self.getLonMap()+'&heights=ellipsoid&key='+globalSettings.mapApiKey);
|
let elevationEarthModel = $('#elevationEarthModel').prop("checked") ? "sealevel" : "ellipsoid";
|
||||||
const myJson = await response.json();
|
|
||||||
|
const response = await fetch('http://dev.virtualearth.net/REST/v1/Elevation/List?points='+self.getLatMap()+','+self.getLonMap()+'&heights='+elevationEarthModel+'&key='+globalSettings.mapApiKey);
|
||||||
|
const myJson = await response.json();
|
||||||
elevation = myJson.resourceSets[0].resources[0].elevations[0];
|
elevation = myJson.resourceSets[0].resources[0].elevations[0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
elevation = "NA";
|
elevation = "N/A";
|
||||||
}
|
}
|
||||||
return elevation;
|
return elevation;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ let WaypointCollection = function () {
|
||||||
countBusyPoints = 0,
|
countBusyPoints = 0,
|
||||||
version = 0,
|
version = 0,
|
||||||
center = {}
|
center = {}
|
||||||
|
|
||||||
self.getMaxWaypoints = function () {
|
self.getMaxWaypoints = function () {
|
||||||
return maxWaypoints;
|
return maxWaypoints;
|
||||||
};
|
};
|
||||||
|
@ -18,15 +18,15 @@ let WaypointCollection = function () {
|
||||||
self.setMaxWaypoints = function (data) {
|
self.setMaxWaypoints = function (data) {
|
||||||
maxWaypoints = data;
|
maxWaypoints = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getValidMission = function () {
|
self.getValidMission = function () {
|
||||||
return isValidMission;
|
return isValidMission;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.setValidMission = function (data) {
|
self.setValidMission = function (data) {
|
||||||
isValidMission = data;
|
isValidMission = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getCountBusyPoints = function () {
|
self.getCountBusyPoints = function () {
|
||||||
return countBusyPoints;
|
return countBusyPoints;
|
||||||
};
|
};
|
||||||
|
@ -34,7 +34,7 @@ let WaypointCollection = function () {
|
||||||
self.setCountBusyPoints = function (data) {
|
self.setCountBusyPoints = function (data) {
|
||||||
countBusyPoints = data;
|
countBusyPoints = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getVersion = function () {
|
self.getVersion = function () {
|
||||||
return version;
|
return version;
|
||||||
};
|
};
|
||||||
|
@ -42,11 +42,11 @@ let WaypointCollection = function () {
|
||||||
self.setVersion = function (data) {
|
self.setVersion = function (data) {
|
||||||
version = data;
|
version = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getCenter = function () {
|
self.getCenter = function () {
|
||||||
return center;
|
return center;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.setCenter = function (data) {
|
self.setCenter = function (data) {
|
||||||
center = data;
|
center = data;
|
||||||
};
|
};
|
||||||
|
@ -54,11 +54,11 @@ let WaypointCollection = function () {
|
||||||
self.setCenterZoom = function (data) {
|
self.setCenterZoom = function (data) {
|
||||||
center.zoom = data;
|
center.zoom = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.setCenterLon = function (data) {
|
self.setCenterLon = function (data) {
|
||||||
center.lon = data;
|
center.lon = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.setCenterLat = function (data) {
|
self.setCenterLat = function (data) {
|
||||||
center.lat = data;
|
center.lat = data;
|
||||||
};
|
};
|
||||||
|
@ -70,7 +70,7 @@ let WaypointCollection = function () {
|
||||||
self.get = function () {
|
self.get = function () {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.isEmpty = function () {
|
self.isEmpty = function () {
|
||||||
return data == [];
|
return data == [];
|
||||||
};
|
};
|
||||||
|
@ -78,7 +78,7 @@ let WaypointCollection = function () {
|
||||||
self.flush = function () {
|
self.flush = function () {
|
||||||
data = [];
|
data = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
self.reinit = function () {
|
self.reinit = function () {
|
||||||
data = [];
|
data = [];
|
||||||
maxWaypoints = 60;
|
maxWaypoints = 60;
|
||||||
|
@ -99,13 +99,13 @@ let WaypointCollection = function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
self.updateWaypoint = function(newWaypoint) {
|
self.updateWaypoint = function(newWaypoint) {
|
||||||
if (newWaypoint.isUsed()) {
|
if (newWaypoint.isUsed()) {
|
||||||
data[newWaypoint.getNumber()] = newWaypoint;
|
data[newWaypoint.getNumber()] = newWaypoint;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
self.dropWaypoint = function(newWaypoint) {
|
self.dropWaypoint = function(newWaypoint) {
|
||||||
self.getWaypoint(newWaypoint.getNumber()).setUsed(false);
|
self.getWaypoint(newWaypoint.getNumber()).setUsed(false);
|
||||||
let indexId = newWaypoint.getNumber()
|
let indexId = newWaypoint.getNumber()
|
||||||
|
@ -120,7 +120,7 @@ let WaypointCollection = function () {
|
||||||
data.splice(indexId, 1);
|
data.splice(indexId, 1);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
self.insertWaypoint = function (newWaypoint, indexId) {
|
self.insertWaypoint = function (newWaypoint, indexId) {
|
||||||
data.forEach(function (wp) {
|
data.forEach(function (wp) {
|
||||||
if (wp.getNumber() >= indexId) {
|
if (wp.getNumber() >= indexId) {
|
||||||
|
@ -133,7 +133,7 @@ let WaypointCollection = function () {
|
||||||
data.splice(indexId, 0, newWaypoint);
|
data.splice(indexId, 0, newWaypoint);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
self.drop = function (waypointId) {
|
self.drop = function (waypointId) {
|
||||||
self.getWaypoint(waypointId).setUsed(false);
|
self.getWaypoint(waypointId).setUsed(false);
|
||||||
var tmpData = [];
|
var tmpData = [];
|
||||||
|
@ -148,7 +148,7 @@ let WaypointCollection = function () {
|
||||||
|
|
||||||
data = tmpData;
|
data = tmpData;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.update = function (bMWPfile=false, bReverse=false) {
|
self.update = function (bMWPfile=false, bReverse=false) {
|
||||||
let oldWPNumber = 0;
|
let oldWPNumber = 0;
|
||||||
let optionIdx = 0;
|
let optionIdx = 0;
|
||||||
|
@ -167,7 +167,7 @@ let WaypointCollection = function () {
|
||||||
element.setP1(element.getP1()+1);
|
element.setP1(element.getP1()+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([MWNP.WPTYPE.JUMP,MWNP.WPTYPE.SET_HEAD,MWNP.WPTYPE.RTH].includes(element.getAction())) {
|
if ([MWNP.WPTYPE.JUMP,MWNP.WPTYPE.SET_HEAD,MWNP.WPTYPE.RTH].includes(element.getAction())) {
|
||||||
element.setAttachedId(oldWPNumber);
|
element.setAttachedId(oldWPNumber);
|
||||||
element.setAttachedNumber(optionIdx);
|
element.setAttachedNumber(optionIdx);
|
||||||
|
@ -189,7 +189,7 @@ let WaypointCollection = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getNonAttachedList = function () {
|
self.getNonAttachedList = function () {
|
||||||
let tmpData = [];
|
let tmpData = [];
|
||||||
data.forEach(function (element) {
|
data.forEach(function (element) {
|
||||||
|
@ -199,8 +199,8 @@ let WaypointCollection = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
return tmpData;
|
return tmpData;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.getAttachedList = function () {
|
self.getAttachedList = function () {
|
||||||
let tmpData = [];
|
let tmpData = [];
|
||||||
data.forEach(function (element) {
|
data.forEach(function (element) {
|
||||||
|
@ -210,8 +210,8 @@ let WaypointCollection = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
return tmpData;
|
return tmpData;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.getAttachedFromWaypoint = function (waypoint) {
|
self.getAttachedFromWaypoint = function (waypoint) {
|
||||||
let tmpData = [];
|
let tmpData = [];
|
||||||
data.forEach(function (element) {
|
data.forEach(function (element) {
|
||||||
|
@ -221,8 +221,8 @@ let WaypointCollection = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
return tmpData;
|
return tmpData;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.addAttachedFromWaypoint = function (waypoint) {
|
self.addAttachedFromWaypoint = function (waypoint) {
|
||||||
let tmpNumber = 0;
|
let tmpNumber = 0;
|
||||||
let tmpData = self.getAttachedFromWaypoint(waypoint);
|
let tmpData = self.getAttachedFromWaypoint(waypoint);
|
||||||
|
@ -234,8 +234,8 @@ let WaypointCollection = function () {
|
||||||
tempWp.setAttachedId(waypoint.getNumber());
|
tempWp.setAttachedId(waypoint.getNumber());
|
||||||
self.insertWaypoint(tempWp, waypoint.getNumber()+tmpNumber+1);
|
self.insertWaypoint(tempWp, waypoint.getNumber()+tmpNumber+1);
|
||||||
self.update();
|
self.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.dropAttachedFromWaypoint = function (waypoint, waypointAttachedNumber) {
|
self.dropAttachedFromWaypoint = function (waypoint, waypointAttachedNumber) {
|
||||||
data.forEach(function (element) {
|
data.forEach(function (element) {
|
||||||
if (element.isAttached() && element.getAttachedId() == waypoint.getNumber() && element.getAttachedNumber() == waypointAttachedNumber) {
|
if (element.isAttached() && element.getAttachedId() == waypoint.getNumber() && element.getAttachedNumber() == waypointAttachedNumber) {
|
||||||
|
@ -243,9 +243,9 @@ let WaypointCollection = function () {
|
||||||
self.update();
|
self.update();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.extractBuffer = function(waypointId) {
|
self.extractBuffer = function(waypointId) {
|
||||||
let buffer = [];
|
let buffer = [];
|
||||||
let waypoint = self.getWaypoint(waypointId);
|
let waypoint = self.getWaypoint(waypointId);
|
||||||
|
@ -270,10 +270,10 @@ let WaypointCollection = function () {
|
||||||
buffer.push(lowByte(waypoint.getP3())); //sbufReadU16(src); // P3
|
buffer.push(lowByte(waypoint.getP3())); //sbufReadU16(src); // P3
|
||||||
buffer.push(highByte(waypoint.getP3()));
|
buffer.push(highByte(waypoint.getP3()));
|
||||||
buffer.push(waypoint.getEndMission()); //sbufReadU8(src); // future: to set nav flag
|
buffer.push(waypoint.getEndMission()); //sbufReadU8(src); // future: to set nav flag
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.missionDisplayDebug = function() {
|
self.missionDisplayDebug = function() {
|
||||||
if (data && data.length != 0) {
|
if (data && data.length != 0) {
|
||||||
data.forEach(function (element) {
|
data.forEach(function (element) {
|
||||||
|
@ -289,7 +289,7 @@ let WaypointCollection = function () {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.copy = function(mission){
|
self.copy = function(mission){
|
||||||
mission.get().forEach(function (element) {
|
mission.get().forEach(function (element) {
|
||||||
self.put(element);
|
self.put(element);
|
||||||
|
@ -300,7 +300,7 @@ let WaypointCollection = function () {
|
||||||
self.setVersion(mission.getVersion());
|
self.setVersion(mission.getVersion());
|
||||||
self.setCenter(mission.getCenter());
|
self.setCenter(mission.getCenter());
|
||||||
}
|
}
|
||||||
|
|
||||||
self.convertJumpNumberToWaypoint = function(jumpId) {
|
self.convertJumpNumberToWaypoint = function(jumpId) {
|
||||||
let outputNumber = 0;
|
let outputNumber = 0;
|
||||||
self.getNonAttachedList().forEach(function (element) {
|
self.getNonAttachedList().forEach(function (element) {
|
||||||
|
@ -310,7 +310,7 @@ let WaypointCollection = function () {
|
||||||
});
|
});
|
||||||
return outputNumber;
|
return outputNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.isJumpTargetAttached = function(waypoint) {
|
self.isJumpTargetAttached = function(waypoint) {
|
||||||
let lJumptTargetAttached = [];
|
let lJumptTargetAttached = [];
|
||||||
data.forEach(function (element) {
|
data.forEach(function (element) {
|
||||||
|
@ -320,7 +320,7 @@ let WaypointCollection = function () {
|
||||||
});
|
});
|
||||||
return (lJumptTargetAttached.length != 0 && lJumptTargetAttached != 'undefined')
|
return (lJumptTargetAttached.length != 0 && lJumptTargetAttached != 'undefined')
|
||||||
}
|
}
|
||||||
|
|
||||||
self.getPoiList = function() {
|
self.getPoiList = function() {
|
||||||
let poiList = [];
|
let poiList = [];
|
||||||
data.forEach(function (element) {
|
data.forEach(function (element) {
|
||||||
|
@ -330,7 +330,7 @@ let WaypointCollection = function () {
|
||||||
});
|
});
|
||||||
return poiList;
|
return poiList;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.getPoint2Measure = function(reverse=false) {
|
self.getPoint2Measure = function(reverse=false) {
|
||||||
let point2measure = [];
|
let point2measure = [];
|
||||||
let altPoint2measure = [];
|
let altPoint2measure = [];
|
||||||
|
@ -383,10 +383,10 @@ let WaypointCollection = function () {
|
||||||
nStart++;
|
nStart++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [nLoop, point2measure, altPoint2measure, namePoint2measure, refPoint2measure];
|
return [nLoop, point2measure, altPoint2measure, namePoint2measure, refPoint2measure];
|
||||||
}
|
}
|
||||||
|
|
||||||
self.getDistance = function(display) {
|
self.getDistance = function(display) {
|
||||||
let lengthLine = [];
|
let lengthLine = [];
|
||||||
const [nLoop, point2measure, altPoint2measure, namePoint2measure, refPoint2measure] = self.getPoint2Measure();
|
const [nLoop, point2measure, altPoint2measure, namePoint2measure, refPoint2measure] = self.getPoint2Measure();
|
||||||
|
@ -394,9 +394,9 @@ let WaypointCollection = function () {
|
||||||
return [-1];
|
return [-1];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
const cumulativeSum = (sum => value => sum += value)(0);
|
const cumulativeSum = (sum => value => sum += value)(0);
|
||||||
|
|
||||||
let oldCoord = [];
|
let oldCoord = [];
|
||||||
point2measure.forEach(function (coord) {
|
point2measure.forEach(function (coord) {
|
||||||
if (oldCoord != 'undefined' && oldCoord != []) {
|
if (oldCoord != 'undefined' && oldCoord != []) {
|
||||||
|
@ -408,7 +408,7 @@ let WaypointCollection = function () {
|
||||||
return lengthLine.map(cumulativeSum);
|
return lengthLine.map(cumulativeSum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.getElevation = async function(globalSettings) {
|
self.getElevation = async function(globalSettings) {
|
||||||
const [nLoop, point2measure, altPoint2measure, namePoint2measure, refPoint2measure] = self.getPoint2Measure(true);
|
const [nLoop, point2measure, altPoint2measure, namePoint2measure, refPoint2measure] = self.getPoint2Measure(true);
|
||||||
let lengthMission = self.getDistance(true);
|
let lengthMission = self.getDistance(true);
|
||||||
|
@ -424,19 +424,21 @@ let WaypointCollection = function () {
|
||||||
samples = 1024;
|
samples = 1024;
|
||||||
}
|
}
|
||||||
if (globalSettings.mapProviderType == 'bing') {
|
if (globalSettings.mapProviderType == 'bing') {
|
||||||
|
let elevationEarthModel = $('#elevationEarthModel').prop("checked") ? "sealevel" : "ellipsoid";
|
||||||
|
|
||||||
if (point2measure.length >1) {
|
if (point2measure.length >1) {
|
||||||
const response = await fetch('http://dev.virtualearth.net/REST/v1/Elevation/Polyline?points='+point2measure+'&heights=ellipsoid&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);
|
||||||
const myJson = await response.json();
|
const myJson = await response.json();
|
||||||
elevation = myJson.resourceSets[0].resources[0].elevations;
|
elevation = myJson.resourceSets[0].resources[0].elevations;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const response = await fetch('http://dev.virtualearth.net/REST/v1/Elevation/List?points='+point2measure+'&heights=ellipsoid&key='+globalSettings.mapApiKey);
|
const response = await fetch('http://dev.virtualearth.net/REST/v1/Elevation/List?points='+point2measure+'&heights='+elevationEarthModel+'&key='+globalSettings.mapApiKey);
|
||||||
const myJson = await response.json();
|
const myJson = await response.json();
|
||||||
elevation = myJson.resourceSets[0].resources[0].elevations;
|
elevation = myJson.resourceSets[0].resources[0].elevations;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
elevation = "NA";
|
elevation = "N/A";
|
||||||
}
|
}
|
||||||
//console.log("elevation ", elevation);
|
//console.log("elevation ", elevation);
|
||||||
return [lengthMission, totalMissionDistance, samples, elevation, altPoint2measure, namePoint2measure, refPoint2measure];
|
return [lengthMission, totalMissionDistance, samples, elevation, altPoint2measure, namePoint2measure, refPoint2measure];
|
||||||
|
|
|
@ -22,6 +22,14 @@
|
||||||
background: #37a8db;
|
background: #37a8db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tab-auxiliary .mode.inRange .info {
|
||||||
|
background: #104156;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.tab-auxiliary .mode.inRange:nth-child(odd) .info {
|
||||||
|
background: #104156;
|
||||||
|
}
|
||||||
|
|
||||||
.tab-auxiliary .mode.off .info {
|
.tab-auxiliary .mode.off .info {
|
||||||
background: #828885;
|
background: #828885;
|
||||||
color: white;
|
color: white;
|
||||||
|
@ -198,6 +206,33 @@
|
||||||
padding: 10px 5px;
|
padding: 10px 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tab-auxiliary .acroEnabled {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 0;
|
||||||
|
background-color: #828885;
|
||||||
|
color: white;
|
||||||
|
font-family: 'open_sansbold', Arial, serif;
|
||||||
|
font-size: 12px;
|
||||||
|
display: block;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all ease 0.2s;
|
||||||
|
line-height: 28px;
|
||||||
|
position: fixed;
|
||||||
|
bottom:10px;
|
||||||
|
left:20px;
|
||||||
|
width:10%;
|
||||||
|
text-align: center;
|
||||||
|
z-index: 25000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-auxiliary .acroEnabled.on {
|
||||||
|
background-color: #37a8db;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-auxiliary .acroEnabled.off {
|
||||||
|
background-color: #828885;
|
||||||
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 1055px) , only screen and (max-device-width: 1055px) {
|
@media only screen and (max-width: 1055px) , only screen and (max-device-width: 1055px) {
|
||||||
.tab-auxiliary .fixed_band {
|
.tab-auxiliary .fixed_band {
|
||||||
width: calc(100% - -30px);
|
width: calc(100% - -30px);
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
<a class="save" href="#" i18n="auxiliaryButtonSave"></a>
|
<a class="save" href="#" i18n="auxiliaryButtonSave"></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="acroEnabled">
|
||||||
|
ACRO
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="tab-auxiliary-templates">
|
<div id="tab-auxiliary-templates">
|
||||||
<table class="modes">
|
<table class="modes">
|
||||||
|
|
|
@ -111,6 +111,7 @@ TABS.auxiliary.initialize = function (callback) {
|
||||||
$(newMode).data('index', modeIndex);
|
$(newMode).data('index', modeIndex);
|
||||||
$(newMode).data('id', modeId);
|
$(newMode).data('id', modeId);
|
||||||
$(newMode).data('origId', ORIG_AUX_CONFIG_IDS[modeIndex]);
|
$(newMode).data('origId', ORIG_AUX_CONFIG_IDS[modeIndex]);
|
||||||
|
$(newMode).data('modeName', AUX_CONFIG[modeIndex]);
|
||||||
|
|
||||||
$(newMode).find('.name').data('modeElement', newMode);
|
$(newMode).find('.name').data('modeElement', newMode);
|
||||||
$(newMode).find('a.addRange').data('modeElement', newMode);
|
$(newMode).find('a.addRange').data('modeElement', newMode);
|
||||||
|
@ -344,8 +345,19 @@ TABS.auxiliary.initialize = function (callback) {
|
||||||
|
|
||||||
function update_ui() {
|
function update_ui() {
|
||||||
let hasUsedMode = false;
|
let hasUsedMode = false;
|
||||||
|
let acroEnabled = true;
|
||||||
|
let acroFail = ["ANGLE", "HORIZON", "MANUAL", "NAV RTH", "NAV POSHOLD", "NAV CRUISE", "NAV COURSE HOLD", "NAV WP", "GCS NAV"];
|
||||||
|
|
||||||
|
var auxChannelCount = RC.active_channels - 4;
|
||||||
|
|
||||||
|
for (var i = 0; i < (auxChannelCount); i++) {
|
||||||
|
update_marker(i, RC.channels[i + 4]);
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < AUX_CONFIG.length; i++) {
|
for (var i = 0; i < AUX_CONFIG.length; i++) {
|
||||||
var modeElement = $('#mode-' + i);
|
var modeElement = $('#mode-' + i);
|
||||||
|
let inRange = false;
|
||||||
|
|
||||||
if (modeElement.find(' .range').length == 0) {
|
if (modeElement.find(' .range').length == 0) {
|
||||||
// if the mode is unused, skip it
|
// if the mode is unused, skip it
|
||||||
modeElement.removeClass('off').removeClass('on');
|
modeElement.removeClass('off').removeClass('on');
|
||||||
|
@ -353,12 +365,48 @@ TABS.auxiliary.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FC.isModeBitSet(modeElement.data('origId'))) {
|
if (FC.isModeBitSet(modeElement.data('origId'))) {
|
||||||
$('.mode .name').eq(modeElement.data('index')).data('modeElement').addClass('on').removeClass('off');
|
// The flight controller can activate the mode
|
||||||
|
$('.mode .name').eq(modeElement.data('index')).data('modeElement').addClass('on').removeClass('inRange').removeClass('off');
|
||||||
|
|
||||||
|
if (jQuery.inArray(modeElement.data('modeName'), acroFail) !== -1) {
|
||||||
|
acroEnabled = false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$('.mode .name').eq(modeElement.data('index')).data('modeElement').removeClass('on').addClass('off');
|
// Check to see if the mode is in range
|
||||||
|
var modeRanges = modeElement.find(' .range');
|
||||||
|
for (r = 0; r < modeRanges.length; r++) {
|
||||||
|
var rangeLow = $(modeRanges[r]).find('.lowerLimitValue').html();
|
||||||
|
var rangeHigh = $(modeRanges[r]).find('.upperLimitValue').html();
|
||||||
|
var markerPosition = $(modeRanges[r]).find('.marker')[0].style.left;
|
||||||
|
markerPosition = markerPosition.substring(0, markerPosition.length-1);
|
||||||
|
|
||||||
|
rangeLow = (rangeLow - 900) / (2100-900) * 100;
|
||||||
|
rangeHigh = (rangeHigh - 900) / (2100-900) * 100;
|
||||||
|
|
||||||
|
if ((markerPosition >= rangeLow) && (markerPosition <= rangeHigh)) {
|
||||||
|
inRange = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inRange) {
|
||||||
|
$('.mode .name').eq(modeElement.data('index')).data('modeElement').removeClass('on').addClass('inRange').removeClass('off');
|
||||||
|
|
||||||
|
if (jQuery.inArray(modeElement.data('modeName'), acroFail) !== -1) {
|
||||||
|
acroEnabled = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// If not, it is shown as disabled.
|
||||||
|
$('.mode .name').eq(modeElement.data('index')).data('modeElement').removeClass('on').removeClass('inRange').addClass('off');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
hasUsedMode = true;
|
hasUsedMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (acroEnabled) {
|
||||||
|
$('.acroEnabled').addClass('on').removeClass('off');
|
||||||
|
} else {
|
||||||
|
$('.acroEnabled').removeClass('on').addClass('off');
|
||||||
|
}
|
||||||
|
|
||||||
let hideUnused = hideUnusedModes && hasUsedMode;
|
let hideUnused = hideUnusedModes && hasUsedMode;
|
||||||
for (let i = 0; i < AUX_CONFIG.length; i++) {
|
for (let i = 0; i < AUX_CONFIG.length; i++) {
|
||||||
|
@ -367,11 +415,6 @@ TABS.auxiliary.initialize = function (callback) {
|
||||||
modeElement.toggle(!hideUnused);
|
modeElement.toggle(!hideUnused);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var auxChannelCount = RC.active_channels - 4;
|
|
||||||
|
|
||||||
for (var i = 0; i < (auxChannelCount); i++) {
|
|
||||||
update_marker(i, RC.channels[i + 4]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let hideUnusedModes = false;
|
let hideUnusedModes = false;
|
||||||
|
@ -391,6 +434,8 @@ TABS.auxiliary.initialize = function (callback) {
|
||||||
// enable data pulling
|
// enable data pulling
|
||||||
helper.mspBalancedInterval.add('aux_data_pull', 50, 1, get_rc_data);
|
helper.mspBalancedInterval.add('aux_data_pull', 50, 1, get_rc_data);
|
||||||
|
|
||||||
|
$(".tab-auxiliary .acroEnabled").width($("#mode-0 .info").width());
|
||||||
|
|
||||||
GUI.content_ready(callback);
|
GUI.content_ready(callback);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -398,3 +443,7 @@ TABS.auxiliary.initialize = function (callback) {
|
||||||
TABS.auxiliary.cleanup = function (callback) {
|
TABS.auxiliary.cleanup = function (callback) {
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$(window).on('resize', function(){
|
||||||
|
$(".tab-auxiliary .acroEnabled").width($("#mode-0 .info").width());
|
||||||
|
});
|
|
@ -114,14 +114,18 @@
|
||||||
<a class="ic_center" data-role="home-center" href="#" title="move to center view"></a>
|
<a class="ic_center" data-role="home-center" href="#" title="move to center view"></a>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td><input type="number" class="home-lat" /></td>
|
|
||||||
<td><input type="number" class="home-lon" /></td>
|
<td><input type="number" class="home-lon" /></td>
|
||||||
<td><span id="elevationValueAtHome">NA</span></td>
|
<td><input type="number" class="home-lat" /></td>
|
||||||
|
<td><span id="elevationValueAtHome">N/A</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="point" id="elevationEarthModelclass" style="display: none">
|
||||||
|
<label class="spacer_box_title i18n-replaced" for="elevationEarthModel">Use Sea Level Earth DEM Model: </label>
|
||||||
|
<input id="elevationEarthModel" type="checkbox" value="0" class="togglemedium" required>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="missionPlanerSafehome" class="gui_box grey" style="display: none">
|
<div id="missionPlanerSafehome" class="gui_box grey" style="display: none">
|
||||||
|
@ -215,7 +219,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="point" id="elevationAtWP" style="display: none">
|
<div class="point" id="elevationAtWP" style="display: none">
|
||||||
<label class="point-label">Elevation (m): </label>
|
<label class="point-label">Elevation (m): </label>
|
||||||
<span id="elevationValueAtWP">NA</span>
|
<span id="elevationValueAtWP">N/A</span>
|
||||||
|
</div>
|
||||||
|
<div class="point" id="groundClearanceAtWP" style="display: none">
|
||||||
|
<label class="point-label">Grd Dist (m): </label>
|
||||||
|
<span id="groundClearanceValueAtWP">N/A</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="point" id="pointP1class" style="display: none">
|
<div class="point" id="pointP1class" style="display: none">
|
||||||
<label class="point-label" for="pointP1">Parameter 1: </label>
|
<label class="point-label" for="pointP1">Parameter 1: </label>
|
||||||
|
|
|
@ -663,6 +663,11 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
HOME.setAlt(elevationAtHome);
|
HOME.setAlt(elevationAtHome);
|
||||||
})()
|
})()
|
||||||
|
|
||||||
|
if (globalSettings.mapProviderType == 'bing') {
|
||||||
|
$('#elevationEarthModelclass').fadeIn(300);
|
||||||
|
} else {
|
||||||
|
$('#elevationEarthModelclass').fadeOut(300);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1301,8 +1306,10 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
let tempWp = mission.getWaypoint(tempMarker.number);
|
let tempWp = mission.getWaypoint(tempMarker.number);
|
||||||
tempWp.setLon(Math.round(coord[0] * 10000000));
|
tempWp.setLon(Math.round(coord[0] * 10000000));
|
||||||
tempWp.setLat(Math.round(coord[1] * 10000000));
|
tempWp.setLat(Math.round(coord[1] * 10000000));
|
||||||
$('#pointLon').val(Math.round(coord[0] * 10000000) / 10000000);
|
if (selectedMarker != null && tempMarker.number == selectedMarker.getLayerNumber()) {
|
||||||
$('#pointLat').val(Math.round(coord[1] * 10000000) / 10000000);
|
$('#pointLon').val(Math.round(coord[0] * 10000000) / 10000000);
|
||||||
|
$('#pointLat').val(Math.round(coord[1] * 10000000) / 10000000);
|
||||||
|
}
|
||||||
mission.updateWaypoint(tempWp);
|
mission.updateWaypoint(tempWp);
|
||||||
repaintLine4Waypoints(mission);
|
repaintLine4Waypoints(mission);
|
||||||
}
|
}
|
||||||
|
@ -1351,14 +1358,16 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
* @return {boolean} `false` to stop the drag sequence.
|
* @return {boolean} `false` to stop the drag sequence.
|
||||||
*/
|
*/
|
||||||
app.Drag.prototype.handleUpEvent = function (evt) {
|
app.Drag.prototype.handleUpEvent = function (evt) {
|
||||||
if (tempMarker.kind == "waypoint" ){
|
if ( tempMarker.kind == "waypoint" ) {
|
||||||
|
if (selectedMarker != null && tempMarker.number == selectedMarker.getLayerNumber()) {
|
||||||
(async () => {
|
(async () => {
|
||||||
if (mission.getWaypoint(tempMarker.number).getP3() == 1.0) {
|
const elevationAtWP = await mission.getWaypoint(tempMarker.number).getElevation(globalSettings);
|
||||||
const elevationAtWP = await mission.getWaypoint(tempMarker.number).getElevation(globalSettings);
|
$('#elevationValueAtWP').text(elevationAtWP);
|
||||||
$('#elevationValueAtWP').text(elevationAtWP);
|
const returnAltitude = checkAltElevSanity(false, mission.getWaypoint(tempMarker.number).getAlt(), elevationAtWP, mission.getWaypoint(tempMarker.number).getP3());
|
||||||
}
|
mission.getWaypoint(tempMarker.number).setAlt(returnAltitude);
|
||||||
plotElevation();
|
plotElevation();
|
||||||
})()
|
})()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (tempMarker.kind == "home" ) {
|
else if (tempMarker.kind == "home" ) {
|
||||||
(async () => {
|
(async () => {
|
||||||
|
@ -1459,7 +1468,9 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
// Map on-click behavior definition
|
// Map on-click behavior definition
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
map.on('click', function (evt) {
|
map.on('click', function (evt) {
|
||||||
|
var tempSelectedMarkerIndex = null;
|
||||||
if (selectedMarker != null && selectedFeature != null) {
|
if (selectedMarker != null && selectedFeature != null) {
|
||||||
|
tempSelectedMarkerIndex = selectedMarker.getLayerNumber();
|
||||||
try {
|
try {
|
||||||
selectedFeature.setStyle(getWaypointIcon(selectedMarker, false));
|
selectedFeature.setStyle(getWaypointIcon(selectedMarker, false));
|
||||||
selectedMarker = null;
|
selectedMarker = null;
|
||||||
|
@ -1488,6 +1499,23 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
|
|
||||||
var altitudeMeters = app.ConvertCentimetersToMeters(selectedMarker.getAlt());
|
var altitudeMeters = app.ConvertCentimetersToMeters(selectedMarker.getAlt());
|
||||||
|
|
||||||
|
if (globalSettings.mapProviderType == 'bing') {
|
||||||
|
$('#elevationAtWP').fadeIn();
|
||||||
|
$('#groundClearanceAtWP').fadeIn();
|
||||||
|
if (tempSelectedMarkerIndex == null || tempSelectedMarkerIndex != selectedMarker.getLayerNumber()) {
|
||||||
|
(async () => {
|
||||||
|
const elevationAtWP = await selectedMarker.getElevation(globalSettings);
|
||||||
|
$('#elevationValueAtWP').text(elevationAtWP);
|
||||||
|
const returnAltitude = checkAltElevSanity(false, selectedMarker.getAlt(), elevationAtWP, selectedMarker.getP3());
|
||||||
|
selectedMarker.setAlt(returnAltitude);
|
||||||
|
plotElevation();
|
||||||
|
})()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$('#elevationAtWP').fadeOut();
|
||||||
|
$('#groundClearanceAtWP').fadeOut();
|
||||||
|
}
|
||||||
|
|
||||||
$('#altitudeInMeters').text(` ${altitudeMeters}m`);
|
$('#altitudeInMeters').text(` ${altitudeMeters}m`);
|
||||||
$('#pointLon').val(Math.round(coord[0] * 10000000) / 10000000);
|
$('#pointLon').val(Math.round(coord[0] * 10000000) / 10000000);
|
||||||
$('#pointLat').val(Math.round(coord[1] * 10000000) / 10000000);
|
$('#pointLat').val(Math.round(coord[1] * 10000000) / 10000000);
|
||||||
|
@ -1515,10 +1543,24 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
else if (selectedFeature && tempMarker.kind == "line" && tempMarker.selection) {
|
else if (selectedFeature && tempMarker.kind == "line" && tempMarker.selection) {
|
||||||
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));
|
||||||
mission.insertWaypoint(tempWp, tempMarker.number);
|
if (homeMarkers.length && HOME.getAlt() != "N/A") {
|
||||||
mission.update();
|
(async () => {
|
||||||
cleanLayers();
|
const elevationAtWP = await tempWp.getElevation(globalSettings);
|
||||||
redrawLayers();
|
tempWp.setAlt(checkAltElevSanity(false, settings.alt, elevationAtWP, 0));
|
||||||
|
|
||||||
|
mission.insertWaypoint(tempWp, tempMarker.number);
|
||||||
|
mission.update();
|
||||||
|
cleanLayers();
|
||||||
|
redrawLayers();
|
||||||
|
plotElevation();
|
||||||
|
})()
|
||||||
|
} else {
|
||||||
|
mission.insertWaypoint(tempWp, tempMarker.number);
|
||||||
|
mission.update();
|
||||||
|
cleanLayers();
|
||||||
|
redrawLayers();
|
||||||
|
plotElevation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (selectedFeature && tempMarker.kind == "safehome" && tempMarker.selection) {
|
else if (selectedFeature && tempMarker.kind == "safehome" && tempMarker.selection) {
|
||||||
selectedMarker = SAFEHOMES.getSafehome(tempMarker.number);
|
selectedMarker = SAFEHOMES.getSafehome(tempMarker.number);
|
||||||
|
@ -1538,11 +1580,24 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
else {
|
else {
|
||||||
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));
|
||||||
mission.put(tempWp);
|
if (homeMarkers.length && HOME.getAlt() != "N/A") {
|
||||||
mission.update();
|
(async () => {
|
||||||
cleanLayers();
|
const elevationAtWP = await tempWp.getElevation(globalSettings);
|
||||||
redrawLayers();
|
tempWp.setAlt(checkAltElevSanity(false, settings.alt, elevationAtWP, 0));
|
||||||
plotElevation();
|
|
||||||
|
mission.put(tempWp);
|
||||||
|
mission.update();
|
||||||
|
cleanLayers();
|
||||||
|
redrawLayers();
|
||||||
|
plotElevation();
|
||||||
|
})()
|
||||||
|
} else {
|
||||||
|
mission.put(tempWp);
|
||||||
|
mission.update();
|
||||||
|
cleanLayers();
|
||||||
|
redrawLayers();
|
||||||
|
plotElevation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//mission.missionDisplayDebug();
|
//mission.missionDisplayDebug();
|
||||||
});
|
});
|
||||||
|
@ -1656,7 +1711,6 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
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);
|
||||||
selectedMarker.setP2(0.0);
|
selectedMarker.setP2(0.0);
|
||||||
selectedMarker.setP3(0.0);
|
|
||||||
}
|
}
|
||||||
for (var j in dictOfLabelParameterPoint[selectedMarker.getAction()]) {
|
for (var j in dictOfLabelParameterPoint[selectedMarker.getAction()]) {
|
||||||
if (dictOfLabelParameterPoint[selectedMarker.getAction()][j] != '') {
|
if (dictOfLabelParameterPoint[selectedMarker.getAction()][j] != '') {
|
||||||
|
@ -1699,7 +1753,9 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
|
|
||||||
$('#pointAlt').on('change', function (event) {
|
$('#pointAlt').on('change', function (event) {
|
||||||
if (selectedMarker) {
|
if (selectedMarker) {
|
||||||
selectedMarker.setAlt(Number($('#pointAlt').val()));
|
const elevationAtWP = Number($('#elevationValueAtWP').text());
|
||||||
|
const returnAltitude = checkAltElevSanity(true, Number($('#pointAlt').val()), elevationAtWP, selectedMarker.getP3());
|
||||||
|
selectedMarker.setAlt(returnAltitude);
|
||||||
mission.updateWaypoint(selectedMarker);
|
mission.updateWaypoint(selectedMarker);
|
||||||
mission.update();
|
mission.update();
|
||||||
redrawLayer();
|
redrawLayer();
|
||||||
|
@ -1727,22 +1783,35 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
|
|
||||||
$('#pointP3').on('change', function (event) {
|
$('#pointP3').on('change', function (event) {
|
||||||
if (selectedMarker) {
|
if (selectedMarker) {
|
||||||
|
const P3Value = selectedMarker.getP3();
|
||||||
selectedMarker.setP3( $('#pointP3').prop("checked") ? 1.0 : 0.0);
|
selectedMarker.setP3( $('#pointP3').prop("checked") ? 1.0 : 0.0);
|
||||||
if ($('#pointP3').prop("checked")) {
|
if (globalSettings.mapProviderType == 'bing') {
|
||||||
(async () => {
|
(async () => {
|
||||||
const elevationAtWP = await selectedMarker.getElevation(globalSettings);
|
const elevationAtWP = await selectedMarker.getElevation(globalSettings);
|
||||||
$('#elevationValueAtWP').text(elevationAtWP);
|
$('#elevationValueAtWP').text(elevationAtWP);
|
||||||
$('#elevationAtWP').fadeIn(300);
|
var altitude = Number($('#pointAlt').val());
|
||||||
})()
|
if (P3Value != selectedMarker.getP3()) {
|
||||||
|
if ($('#pointP3').prop("checked")) {
|
||||||
|
if (altitude < 0) {
|
||||||
|
altitude = settings.alt;
|
||||||
|
}
|
||||||
|
selectedMarker.setAlt(altitude + elevationAtWP * 100);
|
||||||
|
} else {
|
||||||
|
selectedMarker.setAlt(altitude - Number(elevationAtWP) * 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const returnAltitude = checkAltElevSanity(false, selectedMarker.getAlt(), elevationAtWP, selectedMarker.getP3());
|
||||||
|
selectedMarker.setAlt(returnAltitude);
|
||||||
|
$('#pointAlt').val(selectedMarker.getAlt());
|
||||||
|
altitudeMeters = app.ConvertCentimetersToMeters(selectedMarker.getAlt());
|
||||||
|
$('#altitudeInMeters').text(` ${altitudeMeters}m`);
|
||||||
|
|
||||||
|
mission.updateWaypoint(selectedMarker);
|
||||||
|
mission.update();
|
||||||
|
redrawLayer();
|
||||||
|
plotElevation();
|
||||||
|
})()
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$('#elevationAtWP').fadeOut(300);
|
|
||||||
}
|
|
||||||
mission.updateWaypoint(selectedMarker);
|
|
||||||
mission.update();
|
|
||||||
redrawLayer();
|
|
||||||
plotElevation();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1834,6 +1903,28 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
closeHomePanel();
|
closeHomePanel();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#elevationEarthModel').on('change', function (event) {
|
||||||
|
if (globalSettings.mapProviderType == 'bing') {
|
||||||
|
(async () => {
|
||||||
|
const elevationAtHome = await HOME.getElevation(globalSettings);
|
||||||
|
$('#elevationValueAtHome').text(elevationAtHome+' m');
|
||||||
|
HOME.setAlt(elevationAtHome);
|
||||||
|
|
||||||
|
if (selectedMarker) {
|
||||||
|
const elevationAtWP = await selectedMarker.getElevation(globalSettings);
|
||||||
|
$('#elevationValueAtWP').text(elevationAtWP);
|
||||||
|
const returnAltitude = checkAltElevSanity(false, selectedMarker.getAlt(), elevationAtWP, selectedMarker.getP3());
|
||||||
|
selectedMarker.setAlt(returnAltitude);
|
||||||
|
mission.updateWaypoint(selectedMarker);
|
||||||
|
}
|
||||||
|
|
||||||
|
mission.update();
|
||||||
|
redrawLayer();
|
||||||
|
plotElevation();
|
||||||
|
})()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
// Callback for Remove buttons
|
// Callback for Remove buttons
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
|
@ -2189,6 +2280,46 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* resetAltitude = true : For selected WPs only. Changes WP Altitude value back to previous value if setting below ground level.
|
||||||
|
^ resetAltitude = false : changes WP Altitude to value required to give ground clearance = default Altitude setting */
|
||||||
|
function checkAltElevSanity(resetAltitude, checkAltitude, elevation, P3Datum) {
|
||||||
|
if (globalSettings.mapProviderType != 'bing') {
|
||||||
|
return checkAltitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
let groundClearance = "NO HOME";
|
||||||
|
let altitude = checkAltitude;
|
||||||
|
if (P3Datum) {
|
||||||
|
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();
|
||||||
|
if ((checkAltitude / 100 + elevationAtHome) < elevation) {
|
||||||
|
if (resetAltitude) {
|
||||||
|
alert(chrome.i18n.getMessage('MissionPlannerAltitudeChangeReset'));
|
||||||
|
altitude = selectedMarker.getAlt();
|
||||||
|
} else {
|
||||||
|
altitude = settings.alt + 100 * (elevation - elevationAtHome);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
groundClearance = altitude / 100 + (elevationAtHome - elevation);
|
||||||
|
}
|
||||||
|
$('#pointAlt').val(altitude);
|
||||||
|
let altitudeMeters = parseInt(altitude) / 100;
|
||||||
|
$('#altitudeInMeters').text(` ${altitudeMeters}m`);
|
||||||
|
document.getElementById('groundClearanceAtWP').style.color = groundClearance < (settings.alt / 100) ? "#FF0000" : "#303030";
|
||||||
|
$('#groundClearanceValueAtWP').text(` ${groundClearance}`);
|
||||||
|
|
||||||
|
return altitude;
|
||||||
|
}
|
||||||
|
|
||||||
function plotElevation() {
|
function plotElevation() {
|
||||||
if ($('#missionPlanerElevation').is(":visible")) {
|
if ($('#missionPlanerElevation').is(":visible")) {
|
||||||
if (mission.get().length == 0) {
|
if (mission.get().length == 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue