mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-19 06:15:11 +03:00
Add status check
This commit is contained in:
parent
e94317eb5b
commit
6877aea6ae
2 changed files with 13 additions and 10 deletions
|
@ -137,7 +137,7 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
|||
};
|
||||
|
||||
self.getElevation = async function (globalSettings) {
|
||||
let elevation;
|
||||
let elevation = "N/A";
|
||||
if (globalSettings.mapProviderType == 'bing') {
|
||||
let elevationEarthModel = $('#elevationEarthModel').prop("checked") ? "sealevel" : "ellipsoid";
|
||||
|
||||
|
@ -148,9 +148,8 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
|||
else {
|
||||
const response = await fetch('https://api.opentopodata.org/v1/aster30m?locations='+self.getLatMap()+','+self.getLonMap());
|
||||
const myJson = await response.json();
|
||||
if (myJson.status == "OK" && myJson.results[0].elevation != null) {
|
||||
elevation = myJson.results[0].elevation;
|
||||
if (elevation == null) {
|
||||
elevation = "N/A";
|
||||
}
|
||||
}
|
||||
return elevation;
|
||||
|
|
|
@ -435,6 +435,7 @@ let WaypointCollection = function () {
|
|||
samples = sampleMaxNum;
|
||||
}
|
||||
|
||||
let elevation = "N/A";
|
||||
if (globalSettings.mapProviderType == 'bing') {
|
||||
let elevationEarthModel = $('#elevationEarthModel').prop("checked") ? "sealevel" : "ellipsoid";
|
||||
|
||||
|
@ -456,7 +457,9 @@ let WaypointCollection = function () {
|
|||
});
|
||||
const response = await fetch('https://api.opentopodata.org/v1/aster30m?locations='+coordList+'&samples='+String(samples+1));
|
||||
const myJson = await response.json();
|
||||
var elevation = [];
|
||||
|
||||
if (myJson.status == "OK") {
|
||||
elevation = [];
|
||||
for (var i = 0; i < myJson.results.length; i++){
|
||||
if (myJson.results[i].elevation == null) {
|
||||
elevation[i] = 0;
|
||||
|
@ -465,6 +468,7 @@ let WaypointCollection = function () {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//console.log("elevation ", elevation);
|
||||
return [lengthMission, totalMissionDistance, samples, elevation, altPoint2measure, namePoint2measure, refPoint2measure];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue