mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-25 17:25:14 +03:00
Merge branch 'iNavFlight:master' into change-profiles-with-programmin
This commit is contained in:
commit
8d4bd93673
12 changed files with 547 additions and 303 deletions
|
@ -3971,7 +3971,7 @@
|
|||
"message": "I2C Speed"
|
||||
},
|
||||
"configurationI2cSpeedHelp": {
|
||||
"message": "I2C speed should be kept at the highest level that allows for all connected devices to work. Default 400kHz is a save value and it is suggested to switch to 800kHz in case of Multirotors."
|
||||
"message": "I2C speed should be kept at the highest level that allows for all connected devices to work. Default 400kHz is a safe value and it is suggested to switch to 800kHz in case of Multirotors."
|
||||
},
|
||||
"i2cSpeedSuggested800khz": {
|
||||
"message": "Please switch to 800kHz if connected hardware allows for it"
|
||||
|
@ -4003,6 +4003,9 @@
|
|||
"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."
|
||||
},
|
||||
"MissionPlannerAltitudeChangeReset": {
|
||||
"message": "Altitude below ground level. Change ignored"
|
||||
},
|
||||
"SafehomeSelected": {
|
||||
"message": ""
|
||||
},
|
||||
|
|
2
js/fc.js
2
js/fc.js
|
@ -861,7 +861,7 @@ var FC = {
|
|||
return [];
|
||||
},
|
||||
getAccelerometerNames: function () {
|
||||
return [ "NONE", "AUTO", "ADXL345", "MPU6050", "MMA845x", "BMA280", "LSM303DLHC", "MPU6000", "MPU6500", "MPU9250", "BMI160", "ICM20689", "FAKE"];
|
||||
return [ "NONE", "AUTO", "MPU6050", "LSM303DLHC", "MPU6000", "MPU6500", "MPU9250", "BMI160", "ICM20689", "FAKE"];
|
||||
},
|
||||
getBarometerNames: function () {
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "2.6.0")) {
|
||||
|
|
|
@ -139,12 +139,14 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
|||
self.getElevation = async function (globalSettings) {
|
||||
let elevation;
|
||||
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 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];
|
||||
}
|
||||
else {
|
||||
elevation = "NA";
|
||||
elevation = "N/A";
|
||||
}
|
||||
return elevation;
|
||||
}
|
||||
|
|
|
@ -424,19 +424,21 @@ let WaypointCollection = function () {
|
|||
samples = 1024;
|
||||
}
|
||||
if (globalSettings.mapProviderType == 'bing') {
|
||||
let elevationEarthModel = $('#elevationEarthModel').prop("checked") ? "sealevel" : "ellipsoid";
|
||||
|
||||
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();
|
||||
elevation = myJson.resourceSets[0].resources[0].elevations;
|
||||
}
|
||||
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();
|
||||
elevation = myJson.resourceSets[0].resources[0].elevations;
|
||||
}
|
||||
}
|
||||
else {
|
||||
elevation = "NA";
|
||||
elevation = "N/A";
|
||||
}
|
||||
//console.log("elevation ", elevation);
|
||||
return [lengthMission, totalMissionDistance, samples, elevation, altPoint2measure, namePoint2measure, refPoint2measure];
|
||||
|
|
|
@ -27,12 +27,12 @@ viewBox="0 0 850 850"
|
|||
<polygon id="_1" class="fil1" points="435.91,470.5 416,524.05 407.87,524.05 427.82,470.5 "/>
|
||||
<path id="_2" class="fil1" d="M476.15 524.05l-36.3 0 0 -6.51 13.81 -13.89c4.07,-4.17 6.77,-7.12 8.11,-8.87 1.33,-1.75 2.3,-3.39 2.91,-4.93 0.62,-1.53 0.92,-3.18 0.92,-4.95 0,-2.41 -0.73,-4.32 -2.18,-5.71 -1.45,-1.39 -3.46,-2.09 -6.02,-2.09 -2.05,0 -4.04,0.38 -5.97,1.14 -1.91,0.75 -4.12,2.13 -6.65,4.1l-4.65 -5.67c2.99,-2.52 5.88,-4.29 8.69,-5.34 2.81,-1.05 5.8,-1.58 8.98,-1.58 4.97,0 8.97,1.3 11.97,3.9 3.01,2.6 4.51,6.1 4.51,10.49 0,2.43 -0.43,4.71 -1.3,6.89 -0.87,2.17 -2.2,4.41 -4,6.72 -1.8,2.3 -4.77,5.43 -8.96,9.35l-9.3 9.02 0 0.36 25.43 0 0 7.57z"/>
|
||||
<rect class="fil0 str1" x="108.12" y="583.6" width="90" height="90"/>
|
||||
<path class="fil1" d="M174.4 643.67l-7.23 0 0 11.7 -8.38 0 0 -11.7 -24.48 0 0 -6.61 24.48 -35.39 8.38 0 0 34.88 7.23 0 0 7.12zm-15.61 -7.12l0 -13.45c0,-4.79 0.12,-8.7 0.36,-11.77l-0.29 0c-0.69,1.62 -1.76,3.58 -3.22,5.87l-13.3 19.35 16.45 0z"/>
|
||||
<path class="fil1" d="M170.47 614.13c0,3.4 -0.98,6.23 -2.96,8.48 -1.99,2.26 -4.76,3.77 -8.36,4.56l0 0.29c4.3,0.54 7.52,1.87 9.67,4.01 2.15,2.14 3.23,4.99 3.23,8.53 0,5.15 -1.83,9.13 -5.46,11.92 -3.64,2.8 -8.82,4.2 -15.53,4.2 -5.94,0 -10.95,-0.96 -15.02,-2.9l0 -7.66c2.27,1.12 4.67,1.99 7.21,2.6 2.55,0.61 4.99,0.91 7.34,0.91 4.15,0 7.25,-0.77 9.3,-2.31 2.05,-1.54 3.07,-3.91 3.07,-7.14 0,-2.86 -1.12,-4.96 -3.4,-6.31 -2.27,-1.34 -5.84,-2.01 -10.7,-2.01l-4.65 0 0 -6.98 4.73 0c8.55,0 12.82,-2.95 12.82,-8.86 0,-2.3 -0.75,-4.08 -2.24,-5.33 -1.48,-1.23 -3.68,-1.86 -6.6,-1.86 -2.02,0 -3.97,0.29 -5.86,0.86 -1.87,0.58 -4.1,1.69 -6.66,3.35l-4.21 -6c4.9,-3.61 10.61,-5.41 17.1,-5.41 5.4,0 9.61,1.16 12.65,3.48 3.02,2.32 4.53,5.51 4.53,9.58z"/>
|
||||
<path class="fil2" d="M490.19 412.07l345.42 169.55 0 -179.94 -376.74 -217.33c-18.77,-10.83 -46,-10.37 -65.03,0l-379.45 206.74 0 179.93 345.42 -158.95 130.38 0z"/>
|
||||
<polygon class="fil3" points="581.33,456.8 814.41,571.21 814.41,498.09 581.33,383.68 "/>
|
||||
<polygon class="fil4" points="35.59,561.27 268.67,454.01 268.67,380.88 35.59,488.14 "/>
|
||||
<path class="fil5" d="M404.3 385.32l0 -89.14 -28.9 0 49.6 -89.14 49.6 89.14 -28.9 0 0 89.14 -41.4 0zm0 -44.57m-14.45 -44.57m10.35 -44.57m49.6 0m10.35 44.57m-14.45 44.57m-20.7 44.57"/>
|
||||
<rect class="fil0 str2" x="653.12" y="583.6" width="90" height="90"/>
|
||||
<path class="fil1" d="M699.34 621.92c5.4,0 9.68,1.43 12.83,4.29 3.15,2.86 4.72,6.76 4.72,11.7 0,5.71 -1.78,10.17 -5.36,13.39 -3.57,3.21 -8.66,4.82 -15.26,4.82 -5.98,0 -10.69,-0.96 -14.1,-2.9l0 -7.81c1.97,1.12 4.25,1.99 6.81,2.6 2.56,0.61 4.95,0.91 7.15,0.91 3.88,0 6.84,-0.86 8.86,-2.6 2.03,-1.72 3.04,-4.26 3.04,-7.61 0,-6.39 -4.07,-9.59 -12.23,-9.59 -1.16,0 -2.57,0.11 -4.26,0.35 -1.68,0.23 -3.16,0.49 -4.42,0.79l-3.85 -2.28 2.05 -26.16 27.84 0 0 7.65 -20.27 0 -1.2 13.25c0.85,-0.14 1.89,-0.31 3.13,-0.51 1.24,-0.19 2.75,-0.29 4.52,-0.29z"/>
|
||||
<path class="fil1" d="M719.39 643.67l-7.22 0 0 11.7 -8.39 0 0 -11.7 -24.47 0 0 -6.61 24.47 -35.39 8.39 0 0 34.88 7.22 0 0 7.12zm-15.61 -7.12l0 -13.45c0,-4.79 0.13,-8.7 0.36,-11.77l-0.28 0c-0.69,1.62 -1.76,3.58 -3.23,5.87l-13.3 19.35 16.45 0z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.7 KiB |
|
@ -22,6 +22,14 @@
|
|||
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 {
|
||||
background: #828885;
|
||||
color: white;
|
||||
|
@ -198,6 +206,33 @@
|
|||
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) {
|
||||
.tab-auxiliary .fixed_band {
|
||||
width: calc(100% - -30px);
|
||||
|
|
|
@ -302,7 +302,7 @@
|
|||
.tab-mission-control .safehomesTable {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-size: 8px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tab-mission-control .safehomesTable input[type="text"] {
|
||||
|
@ -311,7 +311,7 @@
|
|||
}
|
||||
|
||||
.tab-mission-control .safehomesTable input[type="number"] {
|
||||
font-size: 8px;
|
||||
font-size: 10px;
|
||||
width: 100%;
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
<a class="save" href="#" i18n="auxiliaryButtonSave"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="acroEnabled">
|
||||
ACRO
|
||||
</div>
|
||||
</div>
|
||||
<div id="tab-auxiliary-templates">
|
||||
<table class="modes">
|
||||
|
|
|
@ -111,6 +111,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
$(newMode).data('index', modeIndex);
|
||||
$(newMode).data('id', modeId);
|
||||
$(newMode).data('origId', ORIG_AUX_CONFIG_IDS[modeIndex]);
|
||||
$(newMode).data('modeName', AUX_CONFIG[modeIndex]);
|
||||
|
||||
$(newMode).find('.name').data('modeElement', newMode);
|
||||
$(newMode).find('a.addRange').data('modeElement', newMode);
|
||||
|
@ -180,6 +181,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
|
||||
$(rangeElement).find('a.deleteRange').click(function () {
|
||||
var rangeElement = $(this).data('rangeElement');
|
||||
modeElement.removeClass('inRange');
|
||||
rangeElement.remove();
|
||||
});
|
||||
|
||||
|
@ -344,8 +346,19 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
|
||||
function update_ui() {
|
||||
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++) {
|
||||
var modeElement = $('#mode-' + i);
|
||||
let inRange = false;
|
||||
|
||||
if (modeElement.find(' .range').length == 0) {
|
||||
// if the mode is unused, skip it
|
||||
modeElement.removeClass('off').removeClass('on');
|
||||
|
@ -353,13 +366,49 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
}
|
||||
|
||||
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 {
|
||||
$('.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;
|
||||
}
|
||||
|
||||
if (acroEnabled) {
|
||||
$('.acroEnabled').addClass('on').removeClass('off');
|
||||
} else {
|
||||
$('.acroEnabled').removeClass('on').addClass('off');
|
||||
}
|
||||
|
||||
let hideUnused = hideUnusedModes && hasUsedMode;
|
||||
for (let i = 0; i < AUX_CONFIG.length; i++) {
|
||||
let modeElement = $('#mode-' + i);
|
||||
|
@ -367,11 +416,6 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
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;
|
||||
|
@ -391,6 +435,8 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
// enable data pulling
|
||||
helper.mspBalancedInterval.add('aux_data_pull', 50, 1, get_rc_data);
|
||||
|
||||
$(".tab-auxiliary .acroEnabled").width($("#mode-0 .info").width());
|
||||
|
||||
GUI.content_ready(callback);
|
||||
}
|
||||
};
|
||||
|
@ -398,3 +444,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
TABS.auxiliary.cleanup = function (callback) {
|
||||
if (callback) callback();
|
||||
};
|
||||
|
||||
$(window).on('resize', function(){
|
||||
$(".tab-auxiliary .acroEnabled").width($("#mode-0 .info").width());
|
||||
});
|
|
@ -102,10 +102,10 @@
|
|||
<table class="safehomesTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 50px" data-i18n="SafehomeSelected"></th>
|
||||
<th style="width: 120px" data-i18n="SafehomeLon"></th>
|
||||
<th style="width: 120px" data-i18n="SafehomeLat"></th>
|
||||
<th style="width: 120px" data-i18n="SafehomeAlt"></th>
|
||||
<th style="width: 40px" data-i18n="SafehomeSelected"></th>
|
||||
<th style="width: 140px" data-i18n="SafehomeLat"></th>
|
||||
<th style="width: 140px" data-i18n="SafehomeLon"></th>
|
||||
<th style="width: 100px" data-i18n="SafehomeAlt"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="homeTableBody">
|
||||
|
@ -116,12 +116,16 @@
|
|||
</td>
|
||||
<td><input type="number" class="home-lon" /></td>
|
||||
<td><input type="number" class="home-lat" /></td>
|
||||
<td><span id="elevationValueAtHome">NA</span></td>
|
||||
<td><span id="elevationValueAtHome">N/A</span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</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 id="missionPlanerSafehome" class="gui_box grey" style="display: none">
|
||||
|
@ -141,11 +145,11 @@
|
|||
<table class="safehomesTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 80px" data-i18n="SafehomeSelected"></th>
|
||||
<th style="width: 50px" data-i18n="SafehomeId"></th>
|
||||
<th style="width: 80px" data-i18n="SafehomeEnabled"></th>
|
||||
<th style="width: 120px" data-i18n="SafehomeLon"></th>
|
||||
<th style="width: 120px" data-i18n="SafehomeLat"></th>
|
||||
<th style="width: 40px" data-i18n="SafehomeSelected"></th>
|
||||
<th style="width: 40px" data-i18n="SafehomeId"></th>
|
||||
<th style="width: 60px" data-i18n="SafehomeEnabled"></th>
|
||||
<th style="width: 140px" data-i18n="SafehomeLat"></th>
|
||||
<th style="width: 140px" data-i18n="SafehomeLon"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="safehomesTableBody">
|
||||
|
@ -215,7 +219,11 @@
|
|||
</div>
|
||||
<div class="point" id="elevationAtWP" style="display: none">
|
||||
<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 class="point" id="pointP1class" style="display: none">
|
||||
<label class="point-label" for="pointP1">Parameter 1: </label>
|
||||
|
|
|
@ -474,8 +474,8 @@ TABS.mission_control.initialize = function (callback) {
|
|||
</td> \
|
||||
<td><span class="safehome-number"/></td>\
|
||||
<td class="safehome-enabled"><input type="checkbox" class="togglesmall safehome-enabled-value"/></td> \
|
||||
<td><input type="number" class="safehome-lon" /></td>\
|
||||
<td><input type="number" class="safehome-lat" /></td>\
|
||||
<td><input type="number" class="safehome-lon" /></td>\
|
||||
</tr>\
|
||||
');
|
||||
|
||||
|
@ -645,24 +645,33 @@ TABS.mission_control.initialize = function (callback) {
|
|||
* Process home table UI
|
||||
*/
|
||||
|
||||
$(".home-lon").val(HOME.getLonMap()).change(function () {
|
||||
HOME.setLon(Math.round(Number($(this).val()) * 10000000));
|
||||
cleanHomeLayers();
|
||||
renderHomeOnMap();
|
||||
});
|
||||
|
||||
$(".home-lat").val(HOME.getLatMap()).change(function () {
|
||||
HOME.setLat(Math.round(Number($(this).val()) * 10000000));
|
||||
cleanHomeLayers();
|
||||
renderHomeOnMap();
|
||||
});
|
||||
|
||||
(async () => {
|
||||
const elevationAtHome = await HOME.getElevation(globalSettings);
|
||||
$('#elevationValueAtHome').text(elevationAtHome+' m');
|
||||
HOME.setAlt(elevationAtHome);
|
||||
})()
|
||||
$(".home-lon").val(HOME.getLonMap()).change(function () {
|
||||
HOME.setLon(Math.round(Number($(this).val()) * 10000000));
|
||||
cleanHomeLayers();
|
||||
renderHomeOnMap();
|
||||
});
|
||||
|
||||
if (HOME.getLatMap() == 0 && HOME.getLonMap() == 0) {
|
||||
HOME.setAlt("N/A");
|
||||
} else {
|
||||
(async () => {
|
||||
const elevationAtHome = await HOME.getElevation(globalSettings);
|
||||
$('#elevationValueAtHome').text(elevationAtHome+' m');
|
||||
HOME.setAlt(elevationAtHome);
|
||||
})()
|
||||
}
|
||||
|
||||
if (globalSettings.mapProviderType == 'bing') {
|
||||
$('#elevationEarthModelclass').fadeIn(300);
|
||||
} else {
|
||||
$('#elevationEarthModelclass').fadeOut(300);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1301,8 +1310,10 @@ TABS.mission_control.initialize = function (callback) {
|
|||
let tempWp = mission.getWaypoint(tempMarker.number);
|
||||
tempWp.setLon(Math.round(coord[0] * 10000000));
|
||||
tempWp.setLat(Math.round(coord[1] * 10000000));
|
||||
$('#pointLon').val(Math.round(coord[0] * 10000000) / 10000000);
|
||||
$('#pointLat').val(Math.round(coord[1] * 10000000) / 10000000);
|
||||
if (selectedMarker != null && tempMarker.number == selectedMarker.getLayerNumber()) {
|
||||
$('#pointLon').val(Math.round(coord[0] * 10000000) / 10000000);
|
||||
$('#pointLat').val(Math.round(coord[1] * 10000000) / 10000000);
|
||||
}
|
||||
mission.updateWaypoint(tempWp);
|
||||
repaintLine4Waypoints(mission);
|
||||
}
|
||||
|
@ -1351,14 +1362,16 @@ TABS.mission_control.initialize = function (callback) {
|
|||
* @return {boolean} `false` to stop the drag sequence.
|
||||
*/
|
||||
app.Drag.prototype.handleUpEvent = function (evt) {
|
||||
if (tempMarker.kind == "waypoint" ){
|
||||
if ( tempMarker.kind == "waypoint" ) {
|
||||
if (selectedMarker != null && tempMarker.number == selectedMarker.getLayerNumber()) {
|
||||
(async () => {
|
||||
if (mission.getWaypoint(tempMarker.number).getP3() == 1.0) {
|
||||
const elevationAtWP = await mission.getWaypoint(tempMarker.number).getElevation(globalSettings);
|
||||
$('#elevationValueAtWP').text(elevationAtWP);
|
||||
}
|
||||
const elevationAtWP = await mission.getWaypoint(tempMarker.number).getElevation(globalSettings);
|
||||
$('#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();
|
||||
})()
|
||||
}
|
||||
}
|
||||
else if (tempMarker.kind == "home" ) {
|
||||
(async () => {
|
||||
|
@ -1459,7 +1472,9 @@ TABS.mission_control.initialize = function (callback) {
|
|||
// Map on-click behavior definition
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
map.on('click', function (evt) {
|
||||
var tempSelectedMarkerIndex = null;
|
||||
if (selectedMarker != null && selectedFeature != null) {
|
||||
tempSelectedMarkerIndex = selectedMarker.getLayerNumber();
|
||||
try {
|
||||
selectedFeature.setStyle(getWaypointIcon(selectedMarker, false));
|
||||
selectedMarker = null;
|
||||
|
@ -1488,6 +1503,23 @@ TABS.mission_control.initialize = function (callback) {
|
|||
|
||||
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`);
|
||||
$('#pointLon').val(Math.round(coord[0] * 10000000) / 10000000);
|
||||
$('#pointLat').val(Math.round(coord[1] * 10000000) / 10000000);
|
||||
|
@ -1515,10 +1547,24 @@ TABS.mission_control.initialize = function (callback) {
|
|||
else if (selectedFeature && tempMarker.kind == "line" && tempMarker.selection) {
|
||||
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));
|
||||
mission.insertWaypoint(tempWp, tempMarker.number);
|
||||
mission.update();
|
||||
cleanLayers();
|
||||
redrawLayers();
|
||||
if (homeMarkers.length && HOME.getAlt() != "N/A") {
|
||||
(async () => {
|
||||
const elevationAtWP = await tempWp.getElevation(globalSettings);
|
||||
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) {
|
||||
selectedMarker = SAFEHOMES.getSafehome(tempMarker.number);
|
||||
|
@ -1538,11 +1584,24 @@ TABS.mission_control.initialize = function (callback) {
|
|||
else {
|
||||
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));
|
||||
mission.put(tempWp);
|
||||
mission.update();
|
||||
cleanLayers();
|
||||
redrawLayers();
|
||||
plotElevation();
|
||||
if (homeMarkers.length && HOME.getAlt() != "N/A") {
|
||||
(async () => {
|
||||
const elevationAtWP = await tempWp.getElevation(globalSettings);
|
||||
tempWp.setAlt(checkAltElevSanity(false, settings.alt, elevationAtWP, 0));
|
||||
|
||||
mission.put(tempWp);
|
||||
mission.update();
|
||||
cleanLayers();
|
||||
redrawLayers();
|
||||
plotElevation();
|
||||
})()
|
||||
} else {
|
||||
mission.put(tempWp);
|
||||
mission.update();
|
||||
cleanLayers();
|
||||
redrawLayers();
|
||||
plotElevation();
|
||||
}
|
||||
}
|
||||
//mission.missionDisplayDebug();
|
||||
});
|
||||
|
@ -1656,7 +1715,6 @@ TABS.mission_control.initialize = function (callback) {
|
|||
if ([MWNP.WPTYPE.SET_POI,MWNP.WPTYPE.POSHOLD_TIME,MWNP.WPTYPE.LAND].includes(selectedMarker.getAction())) {
|
||||
selectedMarker.setP1(0.0);
|
||||
selectedMarker.setP2(0.0);
|
||||
selectedMarker.setP3(0.0);
|
||||
}
|
||||
for (var j in dictOfLabelParameterPoint[selectedMarker.getAction()]) {
|
||||
if (dictOfLabelParameterPoint[selectedMarker.getAction()][j] != '') {
|
||||
|
@ -1699,7 +1757,9 @@ TABS.mission_control.initialize = function (callback) {
|
|||
|
||||
$('#pointAlt').on('change', function (event) {
|
||||
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.update();
|
||||
redrawLayer();
|
||||
|
@ -1727,22 +1787,35 @@ TABS.mission_control.initialize = function (callback) {
|
|||
|
||||
$('#pointP3').on('change', function (event) {
|
||||
if (selectedMarker) {
|
||||
const P3Value = selectedMarker.getP3();
|
||||
selectedMarker.setP3( $('#pointP3').prop("checked") ? 1.0 : 0.0);
|
||||
if ($('#pointP3').prop("checked")) {
|
||||
if (globalSettings.mapProviderType == 'bing') {
|
||||
(async () => {
|
||||
const elevationAtWP = await selectedMarker.getElevation(globalSettings);
|
||||
$('#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 +1907,28 @@ TABS.mission_control.initialize = function (callback) {
|
|||
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
|
||||
/////////////////////////////////////////////
|
||||
|
@ -1918,7 +2013,6 @@ TABS.mission_control.initialize = function (callback) {
|
|||
$('#loadEepromMissionButton').on('click', function () {
|
||||
if (markers.length && !confirm(chrome.i18n.getMessage('confirm_delete_all_points'))) return;
|
||||
removeAllWaypoints();
|
||||
GUI.log(chrome.i18n.getMessage('eeprom_load_ok'));
|
||||
MSP.send_message(MSPCodes.MSP_WP_MISSION_LOAD, [0], getWaypointsFromFC);
|
||||
});
|
||||
|
||||
|
@ -1926,12 +2020,6 @@ TABS.mission_control.initialize = function (callback) {
|
|||
$(this).addClass('disabled');
|
||||
GUI.log('Start send point');
|
||||
sendWaypointsToFC();
|
||||
GUI.log('End send point');
|
||||
$('#saveEepromMissionButton').removeClass('disabled');
|
||||
GUI.log(chrome.i18n.getMessage('eeprom_saved_ok'));
|
||||
setTimeout(function(){
|
||||
MSP.send_message(MSPCodes.MSP_WP_MISSION_SAVE, [0], false);
|
||||
},2000);
|
||||
});
|
||||
|
||||
/////////////////////////////////////////////
|
||||
|
@ -2077,7 +2165,9 @@ TABS.mission_control.initialize = function (callback) {
|
|||
}
|
||||
|
||||
redrawLayers();
|
||||
updateHome();
|
||||
if (!(HOME.getLatMap() == 0 && HOME.getLonMap() == 0)) {
|
||||
updateHome();
|
||||
}
|
||||
updateTotalInfo();
|
||||
let sFilename = String(filename.split('\\').pop().split('/').pop());
|
||||
GUI.log(sFilename+' has been loaded successfully !');
|
||||
|
@ -2136,8 +2226,8 @@ TABS.mission_control.initialize = function (callback) {
|
|||
//
|
||||
/////////////////////////////////////////////
|
||||
function getWaypointsFromFC() {
|
||||
mspHelper.loadWaypoints();
|
||||
setTimeout(function(){
|
||||
mspHelper.loadWaypoints(function() {
|
||||
GUI.log(chrome.i18n.getMessage('eeprom_load_ok'));
|
||||
mission.reinit();
|
||||
mission.copy(MISSION_PLANER);
|
||||
mission.update(true);
|
||||
|
@ -2146,15 +2236,19 @@ TABS.mission_control.initialize = function (callback) {
|
|||
map.getView().setZoom(16);
|
||||
redrawLayers();
|
||||
updateTotalInfo();
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
function sendWaypointsToFC() {
|
||||
MISSION_PLANER.reinit();
|
||||
MISSION_PLANER.copy(mission);
|
||||
MISSION_PLANER.update(true, true);
|
||||
mspHelper.saveWaypoints();
|
||||
setTimeout(function(){
|
||||
mspHelper.saveWaypoints(function() {
|
||||
GUI.log('End send point');
|
||||
$('#saveEepromMissionButton').removeClass('disabled');
|
||||
GUI.log(chrome.i18n.getMessage('eeprom_saved_ok'));
|
||||
MSP.send_message(MSPCodes.MSP_WP_MISSION_SAVE, [0], false);
|
||||
|
||||
mission.setMaxWaypoints(MISSION_PLANER.getMaxWaypoints());
|
||||
mission.setValidMission(MISSION_PLANER.getValidMission());
|
||||
mission.setCountBusyPoints(MISSION_PLANER.getCountBusyPoints());
|
||||
|
@ -2165,7 +2259,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
cleanLayers();
|
||||
redrawLayers();
|
||||
$('#MPeditPoint').fadeOut(300);
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -2189,6 +2283,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() {
|
||||
if ($('#missionPlanerElevation').is(":visible")) {
|
||||
if (mission.get().length == 0) {
|
||||
|
|
|
@ -2724,11 +2724,18 @@ OSD.GUI.updatePreviews = function() {
|
|||
// consume drag/drop events.
|
||||
$img.find('img').css('pointer-events', 'none');
|
||||
if (item && item.positionable !== false) {
|
||||
var nameKey = 'osdElement_' + item.name;
|
||||
var nameMessage = chrome.i18n.getMessage(nameKey);
|
||||
|
||||
if (!nameMessage) {
|
||||
nameMessage = inflection.titleize(item.name);
|
||||
}
|
||||
|
||||
$img.addClass('field-' + item.id)
|
||||
.data('item', item)
|
||||
.prop('draggable', true)
|
||||
.on('dragstart', OSD.GUI.preview.onDragStart)
|
||||
.prop('title', inflection.titleize(item.name));
|
||||
.prop('title', nameMessage);
|
||||
}
|
||||
|
||||
$row.append($img);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue