1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-15 12:25:13 +03:00
This commit is contained in:
Andi Kanzler 2023-12-02 18:02:30 -03:00
parent 6ce6074dfe
commit 7e4345160b
10 changed files with 484 additions and 420 deletions

View file

@ -4355,6 +4355,12 @@
"SafehomeSafeRadius": { "SafehomeSafeRadius": {
"message": "Safe Radius (m):" "message": "Safe Radius (m):"
}, },
"SafehomeFwAppraoch": {
"message": "FW Approach:"
},
"safehomeEdit": {
"message": "Edit Safehome"
},
"missionTitleHide": { "missionTitleHide": {
"message": "Hide" "message": "Hide"
}, },
@ -4396,7 +4402,7 @@
}, },
"missionTitleAdd": { "missionTitleAdd": {
"message": "Add" "message": "Add"
}, },
"missionTitleMoveToCenterView": { "missionTitleMoveToCenterView": {
"message": "move to center view" "message": "move to center view"
}, },
@ -4409,6 +4415,60 @@
"missionTitlEditMission": { "missionTitlEditMission": {
"message": "Edit Mission" "message": "Edit Mission"
}, },
"MissionPlannerFwLAndingAltitudeChangeReset": {
"message": "Altitude below min land altitude. Change ignored"
},
"missionWpType": {
"message": "Type:"
},
"missionWpLat": {
"message": "Lat:"
},
"missionWpLon": {
"message": "Lon:"
},
"missionSeaLevelRef": {
"message": "Sea level Ref: "
},
"missionElevation": {
"message": "Elevation (m):"
},
"missionNA": {
"message": "N/A"
},
"missionGroundDist": {
"message": "Grd Dist (m):"
},
"missionParameter1": {
"message": "Parameter 1:"
},
"missionParameter2": {
"message": "Parameter 2:"
},
"missionUserActions": {
"message": "User Actions:"
},
"missionFwLandingSettings": {
"message": "Fixed Wing landing settings:"
},
"missionFwApproachAlt": {
"message": "Approach Alt: (cm):"
},
"missionFwLandAlt": {
"message": "Land Alt: (cm):"
},
"missionFwApproachDir": {
"message": "Approach direction:"
},
"missionFwLandHeading1": {
"message": "Heading 1: (deg):"
},
"missionFwLandHeading2": {
"message": "Heading 2: (deg):"
},
"missionExclusive": {
"message": "Excl."
},
"missionRTHsettingsTitle": { "missionRTHsettingsTitle": {
"message": "RTH settings" "message": "RTH settings"
}, },

View file

@ -1303,8 +1303,8 @@ var FC = {
37: "Rangefinder [cm]", 37: "Rangefinder [cm]",
38: "Active MixerProfile", 38: "Active MixerProfile",
39: "MixerTransition Active", 39: "MixerTransition Active",
40: "Yaw [deg]" 40: "Yaw [deg]",
38: "FW Land State" 41: "FW Land State"
} }
}, },
3: { 3: {

View file

@ -245,7 +245,7 @@ var MSPCodes = {
MSP2_INAV_EZ_TUNE: 0x2070, MSP2_INAV_EZ_TUNE: 0x2070,
MSP2_INAV_EZ_TUNE_SET: 0x2071, MSP2_INAV_EZ_TUNE_SET: 0x2071,
MSP2_INAV_SELECT_MIXER_PROFILE: 0x2080 MSP2_INAV_SELECT_MIXER_PROFILE: 0x2080,
MSP2_INAV_SET_LED_STRIP_CONFIG_EX: 0x2049, MSP2_INAV_SET_LED_STRIP_CONFIG_EX: 0x2049,
MSP2_INAV_FW_APPROACH: 0x204A, MSP2_INAV_FW_APPROACH: 0x204A,

View file

@ -2944,7 +2944,7 @@ var mspHelper = (function (gui) {
MSP.send_message(MSPCodes.MSP2_INAV_TIMER_OUTPUT_MODE, false, false, callback); MSP.send_message(MSPCodes.MSP2_INAV_TIMER_OUTPUT_MODE, false, false, callback);
} }
self.sendTimerOutputModes = function(callback) { self.sendTimerOutputModes = function(onCompleteCallback) {
var nextFunction = send_next_output_mode; var nextFunction = send_next_output_mode;
var idIndex = 0; var idIndex = 0;

View file

@ -76,7 +76,7 @@ let SafehomeCollection = function () {
buffer.push(specificByte(safehome.getLon(), 2)); buffer.push(specificByte(safehome.getLon(), 2));
buffer.push(specificByte(safehome.getLon(), 3)); buffer.push(specificByte(safehome.getLon(), 3));
} else { } else {
buffer = Array(24).fill(0); buffer = Array(10).fill(0);
buffer[0] = safehomeId; buffer[0] = safehomeId;
} }

Binary file not shown.

View file

@ -525,9 +525,6 @@
.tab-mission-control .textLegend{ .tab-mission-control .textLegend{
margin:2px; margin:2px;
} }
.tab-mission-control .valueLegend{
float:right;
}
.tab-mission-control .userActionContainer { .tab-mission-control .userActionContainer {
display: inline-block; display: inline-block;

View file

@ -187,45 +187,97 @@
<a class="ic_hide" href="#" i18n_title="missionTitleHide"></a> <a class="ic_hide" href="#" i18n_title="missionTitleHide"></a>
</div> </div>
<a id="cancelSafehome" class="ic_cancel" href="#" i18n_title="missionTitleCancel"></a> <a id="cancelSafehome" class="ic_cancel" href="#" i18n_title="missionTitleCancel"></a>
<a id="addSafehome" class="ic_add" href="#" i18n_title="missionTitleAdd"></a>
<a id="saveEepromSafehomeButton" class="ic_save2Eprom" href="#" i18n_title="missionTitleSaveEepromSafehome"></a> <a id="saveEepromSafehomeButton" class="ic_save2Eprom" href="#" i18n_title="missionTitleSaveEepromSafehome"></a>
<a id="loadEepromSafehomeButton" class="ic_loadFromEprom" href="#" i18n_title="missionTitleLoadEepromSafehome"></a> <a id="loadEepromSafehomeButton" class="ic_loadFromEprom" href="#" i18n_title="missionTitleLoadEepromSafehome"></a>
<a id="cancelSafehome" class="ic_cancel" href="#" title="Cancel"></a>
</div> </div>
</div> </div>
<div class="spacer" id="SafehomeContent"> <div class="spacer" id="SafehomeContent">
<div>
<div style="padding-bottom: 2px;"> <div style="padding-bottom: 2px;">
<span class="i18n-replaced" data-i18n="missionSafehomeAvailableSafehomes">Available Safehomes:</span> <span data-i18n="missionSafehomeAvailableSafehomes"></span>
<span id="availableSafehomes"></span> <span id="availableSafehomes"></span>
</div> </div>
<div id="SafehomeContentBox"> <div id="SafehomeContentBox" style="display: none;">
<div class="gui_box grey missionPlannerSafehomeBox">
<div class="gui_box_titlebar">
<div class="spacer_box_title" data-i18n="safehomeEdit"></div>
<div class="btnMenu btnMenuIcon">
<div class="btnMenu-danger">
<a id="deleteSafehome" class="ic_removeAll" href="#" title="Delete"></a>
</div>
</div>
</div>
<div class="spacer" id="safehomeSingelContent">
<div class="point">
<label class="point-label-safehome" for="safeHomeLatitude" data-i18n="gpsLat"></label>
<input type="number" id="safehomeLatitude"></input>
</div>
<div class="point">
<label class="point-label-safehome" for="safehomeLongitude" data-i18n="gpsLon"></label>
<input type="number" id="safehomeLongitude"></input>
</div>
<div class="point">
<span style="font-weight: bold" data-i18n="missionFwLandingSettings"></span>
</div>
<div class="point">
<label class="point-label-safehome" for="safehomeSeaLevelRef" data-i18n="missionSeaLevelRef"></label>
<input id="safehomeSeaLevelRef" type="checkbox" value="0" class="togglemedium" required>
</div>
<div class="point">
<label class="point-label-safehome" for="safehomeApproachAlt" data-i18n="missionFwApproachAlt"></label>
<input type="number" id="safehomeApproachAlt"></input>
<span id="safehomeApproachAltM"></span>
</div>
<div class="point">
<label class="point-label-safehome" for="safehomeLandAlt" data-i18n="missionFwLandAlt"></label>
<input type="number" id="safehomeLandAlt"></input>
<span id="safehomeLandAltM"></span>
</div>
<div class="point">
<label class="point-label-safehome" for="safehomeElevation" data-i18n="missionElevation"></label>
<span id="safehomeElevation"></span>
</div>
<div class="point">
<label class="point-label-safehome" for="geozoneApproachDirection" data-i18n="missionFwApproachDir"></label>
<select name="zoneAction" id="geozoneApproachDirection">
<option value="0">Left</option>
<option value="1">Right</option>
</select>
</div>
<div class="point">
<label class="point-label-safehome" for="safehomeLandHeading1" data-i18n="missionFwLandHeading1"></label>
<input type="number" id="safehomeLandHeading1"></input>
<input id="safehomeLandHeading1Excl" type="checkbox" value="0" class="togglemedium" required>
<span data-i18n="missionExclusive"></span>
</div>
<div class="point">
<label class="point-label-safehome" for="safehomeLandHeading2" data-i18n="missionFwLandHeading2"></label>
<input type="number" id="safehomeLandHeading2"></input>
<input id="safehomeLandHeading2Excl" type="checkbox" value="0" class="togglemedium" required>
<span data-i18n="missionExclusive"></span>
</div>
</div>
</div>
</div> </div>
<hr> <hr>
<div class="spacer" id="safehomeLegend"> <div class="spacer" id="safehomeLegend">
<span><b data-i18n="SafehomeLegend"></b></span> <span><b data-i18n="SafehomeLegend"></b></span>
<div class="legendItem"> <div class="legendItem">
<span class="fill" style="border-bottom-color:#900C3F"></span>
<span class="textLegend" data-i18n="SafehomeMaxDistance"></span>
<span id="safeHomeMaxDistance" class="valueLegend"></span>
<span class="fill" style="border-bottom:5px dotted #900C3F;"></span> <span class="fill" style="border-bottom:5px dotted #900C3F;"></span>
<span class="textLegend">Max distance (m):</span> <span class="textLegend" data-i18n="SafehomeMaxDistance"></span>
<span id="safeHomeMaxDistance"></span> <span id="safeHomeMaxDistance"></span>
</div> </div>
<div class="legendItem"> <div class="legendItem">
<span class="fill"></span>
<span class="textLegend" data-i18n="SafehomeSafeRadius"></span>
<span id="SafeHomeSafeDistance" class="valueLegend"></span>
<span class="fill" style="border-bottom:5px dotted #88CC3E;"></span> <span class="fill" style="border-bottom:5px dotted #88CC3E;"></span>
<span class="textLegend">Safe Radius (m):</span> <span class="textLegend" data-i18n="SafehomeSafeRadius"></span>
<span id="SafeHomeSafeDistance"></span> <span id="SafeHomeSafeDistance"></span>
</div> </div>
<div class="legendItem"> <div class="legendItem">
<span class="fill" style="border-bottom:5px solid #f78a05;border-top:5px solid #0025a1;"></span> <span class="fill" style="border-bottom:5px solid #f78a05;border-top:5px solid #0025a1;"></span>
<span class="textLegend">FW Approach</span> <span class="textLegend" data-i18n="SafehomeFwAppraoch"></span>
<span id="SafeHomeSafeDistance"></span> <span id="SafeHomeSafeDistance"></span>
</div> </div>
</div> </div>
</div>
</div> </div>
</div> </div>
@ -247,7 +299,7 @@
<div class="spacer" id="WPeditContent"> <div class="spacer" id="WPeditContent">
<input type="hidden" name="pointNumber" value=""> <input type="hidden" name="pointNumber" value="">
<div class="point"> <div class="point">
<label class="point-label" for="pointType">Type: </label> <label class="point-label" for="pointType" data-i18n="missionWpType"></label>
<select name="type" id="pointType"> <select name="type" id="pointType">
<!--<option value="1">Home</option>--> <!--<option value="1">Home</option>-->
<option value="1">Waypoint</option> <option value="1">Waypoint</option>
@ -261,39 +313,39 @@
</select> </select>
</div> </div>
<div class="point"> <div class="point">
<label class="point-label" for="pointLat">Lat: </label> <label class="point-label" for="pointLat" data-i18n="missionWpLat"></label>
<input id="pointLat" type="text" value="0.0" required> <input id="pointLat" type="text" value="0.0" required>
</div> </div>
<div class="point"> <div class="point">
<label class="point-label" for="pointLon">Lon: </label> <label class="point-label" for="pointLon" data-i18n="missionWpLon"></label>
<input id="pointLon" type="text" value="0.0" required> <input id="pointLon" type="text" value="0.0" required>
</div> </div>
<div class="point"> <div class="point">
<label class="point-label" for="pointAlt">Alt (cm): </label> <label class="point-label" for="pointAlt" data-i18n="missionDefaultPointAlt"></label>
<input id="pointAlt" type="text" value="0" required><span id="altitudeInMeters"></span> <input id="pointAlt" type="text" value="0" required><span id="altitudeInMeters"></span>
</div> </div>
<div class="point" id="pointP3class" style="display: none"> <div class="point" id="pointP3class" style="display: none">
<label class="point-label" for="pointP3Alt">Sea level Ref: </label> <label class="point-label" for="pointP3Alt" data-i18n="missionSeaLevelRef"></label>
<input id="pointP3Alt" type="checkbox" value="0" class="togglemedium" checked required> <input id="pointP3Alt" type="checkbox" value="0" class="togglemedium" checked required>
</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" data-i18n="missionElevation"></label>
<span id="elevationValueAtWP">N/A</span> <span id="elevationValueAtWP" data-i18n="missionNA"></span>
</div> </div>
<div class="point" id="groundClearanceAtWP" style="display: none"> <div class="point" id="groundClearanceAtWP" style="display: none">
<label class="point-label">Grd Dist (m): </label> <label class="point-label" data-i18n="missionGroundDist"></label>
<span id="groundClearanceValueAtWP">N/A</span> <span id="groundClearanceValueAtWP" data-i18n="missionNA"></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" data-i18n="missionParameter1"></label>
<input id="pointP1" type="text" value="0" required> <input id="pointP1" type="text" value="0" required>
</div> </div>
<div class="point" id="pointP2class" style="display: none"> <div class="point" id="pointP2class" style="display: none">
<label class="point-label" for="pointP2">Parameter 2: </label> <label class="point-label" for="pointP2" data-i18n="missionParameter1"></label>
<input id="pointP2" type="text" value="0" required> <input id="pointP2" type="text" value="0" required>
</div> </div>
<div class="point" id="pointP3UserActionClass" style="display: none"> <div class="point" id="pointP3UserActionClass" style="display: none">
<label class="point-label" for="pointP3UserAction">User Actions: </label> <label class="point-label" for="pointP3UserAction" data-i18n="missionUserActions"></label>
<div class="userActionContainer">1 <input id="pointP3UserAction1" type="checkbox" value="0" class="togglemedium" checked required></div> <div class="userActionContainer">1 <input id="pointP3UserAction1" type="checkbox" value="0" class="togglemedium" checked required></div>
<div class="userActionContainer">2 <input id="pointP3UserAction2" type="checkbox" value="0" class="togglemedium" checked required></div> <div class="userActionContainer">2 <input id="pointP3UserAction2" type="checkbox" value="0" class="togglemedium" checked required></div>
<div class="userActionContainer">3 <input id="pointP3UserAction3" type="checkbox" value="0" class="togglemedium" checked required></div> <div class="userActionContainer">3 <input id="pointP3UserAction3" type="checkbox" value="0" class="togglemedium" checked required></div>
@ -317,57 +369,41 @@
<tbody id="waypointOptionsTableBody"> <tbody id="waypointOptionsTableBody">
</tbody> </tbody>
</table> </table>
<table class="waypointOptionsTable"> </div>
<thead>
<tr>
<th style="width: 30px">
<div id="addOptionsPoint" class="btn btnTable btnTableIcon btnTable-success">
<a id="addOptionsPointButton" class="ic_add" data-role="waypointOptions-add" href="#" style="float: center" title="Add"></a>
</div>
</th>
<th style="width: 50px" data-i18n="WaypointOptionId"></th>
<th style="width: 80px" data-i18n="WaypointOptionAction"></th>
<th style="width: 120px" data-i18n="WaypointOptionP1"></th>
<th style="width: 120px" data-i18n="WaypointOptionP2"></th>
</tr>
</thead>
<tbody id="waypointOptionsTableBody">
</tbody>
</table>
<div id="wpFwLanding" style="display: none;"> <div id="wpFwLanding" style="display: none;">
<div class="point"> <div class="point">
<span style="font-weight: bold">Fixed Wing landing settings:</span> <span style="font-weight: bold" data-i18n="missionFwLandingSettings"></span>
</div> </div>
<div class="point"> <div class="point">
<label class="point-label-safehome" for="wpApproachAlt">Approach Alt: (cm):</label> <label class="point-label-safehome" for="wpApproachAlt" data-i18n="missionFwApproachAlt"></label>
<input type="number" id="wpApproachAlt"></input> <input type="number" id="wpApproachAlt"></input>
<span id="wpApproachAltM"></span> <span id="wpApproachAltM"></span>
</div> </div>
<div class="point"> <div class="point">
<label class="point-label-safehome" for="wpLandAlt">Land Alt: (cm):</label> <label class="point-label-safehome" for="wpLandAlt" data-i18n="missionFwLandAlt"></label>
<input type="number" id="wpLandAlt"></input> <input type="number" id="wpLandAlt"></input>
<span id="wpLandAltM"></span> <span id="wpLandAltM"></span>
</div> </div>
<div class="point"> <div class="point">
<label class="point-label-safehome" for="wpApproachDirection">Approach direction:</label> <label class="point-label-safehome" for="wpApproachDirection" data-i18n="missionFwApproachDir"></label>
<select name="wpApproachDirection" id="wpApproachDirection"> <select name="wpApproachDirection" id="wpApproachDirection">
<option value="0">Left</option> <option value="0">Left</option>
<option value="1">Right</option> <option value="1">Right</option>
</select> </select>
</div> </div>
<div class="point"> <div class="point">
<label class="point-label-safehome" for="wpLandHeading1">Heading 1: (deg):</label> <label class="point-label-safehome" for="wpLandHeading1" data-i18n="missionFwLandHeading1"></label>
<input type="number" id="wpLandHeading1"></input> <input type="number" id="wpLandHeading1"></input>
<input id="wpLandHeading1Excl" type="checkbox" value="0" class="togglemedium" checked required> Excl. <input id="wpLandHeading1Excl" type="checkbox" value="0" class="togglemedium" checked required>
<span data-i18n="missionExclusive"></span>
</div> </div>
<div class="point"> <div class="point">
<label class="point-label-safehome" for="wpLandHeading2">Heading 2: (deg):</label> <label class="point-label-safehome" for="wpLandHeading2" data-i18n="missionFwLandHeading1"></label>
<input type="number" id="wpLandHeading2"></input> <input type="number" id="wpLandHeading2"></input>
<input id="wpLandHeading2Excl" type="checkbox" value="0" class="togglemedium" checked required> Excl. <input id="wpLandHeading2Excl" type="checkbox" value="0" class="togglemedium" checked required>
<span data-i18n="missionExclusive"></span>
</div> </div>
</div> </div>
</div>
<!-- <div class="point-radio" id="pointOptionclass" style="display: none"> <!-- <div class="point-radio" id="pointOptionclass" style="display: none">
<div class="radio-line"> <div class="radio-line">
<input type="radio" id="Options_None" name="Options" value="None" checked> <input type="radio" id="Options_None" name="Options" value="None" checked>
@ -394,7 +430,6 @@
<input id="Options_HeadingHead" type="text" value="-1" required><br> <input id="Options_HeadingHead" type="text" value="-1" required><br>
</div> </div>
</div> --> </div> -->
</div> </div>
</div> </div>
</div> </div>

View file

@ -10,6 +10,8 @@
// MultiWii NAV Protocol // MultiWii NAV Protocol
var MWNP = MWNP || {}; var MWNP = MWNP || {};
var MAX_NEG_FW_LAND_ALT = -2000; // cm
// WayPoint type // WayPoint type
MWNP.WPTYPE = { MWNP.WPTYPE = {
WAYPOINT: 1, WAYPOINT: 1,
@ -78,8 +80,7 @@ TABS.mission_control.initialize = function (callback) {
let textFeature; let textFeature;
var textGeom; var textGeom;
let isOffline = false; let isOffline = false;
let rthUpdateInterval = 0; let rthUpdateInterval = 0;
let selectedSafehome = -1;
let settings = { speed: 0, alt: 5000, safeRadiusSH : 50, maxDistSH : 0, fwApproachLength: 0, fwApproachAlt: 60, fwLandAlt: 5}; let settings = { speed: 0, alt: 5000, safeRadiusSH : 50, maxDistSH : 0, fwApproachLength: 0, fwApproachAlt: 60, fwLandAlt: 5};
if (GUI.active_tab != 'mission_control') { if (GUI.active_tab != 'mission_control') {
@ -150,9 +151,10 @@ TABS.mission_control.initialize = function (callback) {
if (!isOffline) { if (!isOffline) {
setTimeout(() => { setTimeout(() => {
if (SAFEHOMES.safehomeCount() >= 1) { if (SAFEHOMES.safehomeCount() >= 1) {
selectedSafehome = 0; updateSelectedShAndFwAp(0);
} else { } else {
selectedSafehome = -1; selectedSafehome = null;
selectedFwApproachSh = null;
} }
renderSafehomesOnMap(); renderSafehomesOnMap();
updateSafehomeInfo(); updateSafehomeInfo();
@ -397,6 +399,8 @@ TABS.mission_control.initialize = function (callback) {
var tempMarker = null; var tempMarker = null;
var disableMarkerEdit = false; var disableMarkerEdit = false;
var selectedFwApproachWp = null; var selectedFwApproachWp = null;
var selectedFwApproachSh = null;
////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////
// define & init parameters for default Settings // define & init parameters for default Settings
@ -490,257 +494,23 @@ TABS.mission_control.initialize = function (callback) {
cleanSafehomeLayers(); cleanSafehomeLayers();
} }
function renderSafehomesTable() { function checkApproachAltitude(altitude, isSeaLevelRef, sealevel) {
$safehomeContentBox.find("*").remove(); if (altitude - (isSeaLevelRef ? sealevel * 100 : 0 ) < 0) {
alert(chrome.i18n.getMessage('MissionPlannerAltitudeChangeReset'));
if (selectedSafehome < 0) { return false;
return;
} }
if (!$("#missionPlannerSafehome").is(":visible")) { return true;
$("#missionPlannerSafehome").fadeIn(300);
$('#safeHomeMaxDistance').text(settings.maxDistSH);
$('#SafeHomeSafeDistance').text(settings.safeRadiusSH);
}
const safehome = SAFEHOMES.get()[selectedSafehome];
const fwApproach = FW_APPROACH.get()[selectedSafehome];
if (fwApproach.getLandHeading1() == 0 && fwApproach.getLandHeading1() == 0 && fwApproach.getApproachAltAsl() == 0 && fwApproach.getLandAltAsl() == 0) {
fwApproach.setApproachAltAsl(settings.fwApproachAlt * 100);
fwApproach.setLandAltAsl(settings.fwLandAlt * 100);
}
$safehomeContentBox.append('\
<div class="gui_box grey missionPlannerSafehomeBox"> \
<div class="gui_box_titlebar"> \
<div class="spacer_box_title">Edit Safehome </div> \
<div class="btnMenu btnMenuIcon"> \
<div class="btnMenu-danger"> \
<a id="deleteSafehome" class="ic_removeAll" href="#" title="Delete"></a> \
</div> \
</div> \
</div> \
<div class="spacer" id="safehomeSingelContent"> \
<div class="point"> \
<label class="point-label-safehome" for="safeHomeLatitude">Latitude:</label> \
<input type="number" id="safehomeLatitude"></input> \
</div> \
<div class="point"> \
<label class="point-label-safehome" for="safehomeLongitude">Longitude:</label> \
<input type="number" id="safehomeLongitude"></input> \
</div> \
<div class="point"> \
<span style="font-weight: bold">Fixed Wing landing settings:</span> \
</div> \
<div class="point"> \
<label class="point-label-safehome" for="safehomeSeaLEvelRef">Sea level ref:</label> \
<input id="safehomeSeaLevelRef" type="checkbox" value="0" class="togglemedium" required> \
</div> \
<div class="point"> \
<label class="point-label-safehome" for="safehomeApproachAlt">Approach Alt: (cm):</label> \
<input type="number" id="safehomeApproachAlt"></input> \
<span id="safehomeApproachAltM"></span> \
</div> \
<div class="point"> \
<label class="point-label-safehome" for="safehomeLandAlt">Land Alt: (cm):</label> \
<input type="number" id="safehomeLandAlt"></input> \
<span id="safehomeLandAltM"></span> \
</div> \
<div class="point"> \
<label class="point-label-safehome" for="safehomeElevation">Elevation: (m):</label> \
<span id="safehomeElevation"></span> \
</div> \
<div class="point"> \
<label class="point-label-safehome" for="geozoneApproachDirection">Approach direction:</label> \
<select name="zoneAction" id="geozoneApproachDirection"> \
<option value="0">Left</option> \
<option value="1">Right</option> \
</select> \
</div> \
<div class="point"> \
<label class="point-label-safehome" for="safehomeLandHeading1">Heading 1: (deg):</label> \
<input type="number" id="safehomeLandHeading1"></input> \
<input id="safehomeLandHeading1Excl" type="checkbox" value="0" class="togglemedium" required> Excl. \
</div> \
<div class="point"> \
<label class="point-label-safehome" for="safehomeLandHeading2">Heading 2: (deg):</label> \
<input type="number" id="safehomeLandHeading2"></input> \
<input id="safehomeLandHeading2Excl" type="checkbox" value="0" class="togglemedium" required> Excl. \
</div> \
</div> \
</div> \
');
if (fwApproach.getElevation() == 0) {
(async () => {
const elevation = await fwApproach.getElevationFromServer(safehome.getLonMap(), safehome.getLatMap(), globalSettings) * 100;
fwApproach.setElevation(elevation);
$('#safehomeElevation').text(fwApproach.getElevation() / 100 + " m");
})();
}
const $safehomeBox = $safehomeContentBox.find('.missionPlannerSafehomeBox:last-child');
$safehomeBox.find('.spacer_box_title').append(safehome.getNumber() + 1);
$safehomeBox.find('#deleteSafehome').on('click', () => {
var shNum = safehome.getNumber();
SAFEHOMES.drop(shNum);
FW_APPROACH.clean(shNum);
selectedSafehome = SAFEHOMES.safehomeCount() - 1;
cleanSafehomeLayers();
renderSafehomesOnMap();
renderSafehomesTable();
updateSafehomeInfo();
});
$safehomeBox.find('#safehomeLatitude').val(safehome.getLatMap()).on('change', event => {
safehome.setLat(Math.round(Number($(event.currentTarget).val()) * 1e7));
cleanSafehomeLayers();
renderSafehomesOnMap();
});
$safehomeBox.find('#safehomeLongitude').val(safehome.getLonMap()).on('change', event => {
safehome.setLon(Math.round(Number($(event.currentTarget).val()) * 1e7));
cleanSafehomeLayers();
renderSafehomesOnMap();
});
$safehomeBox.find($('#safehomeSeaLevelRef')).prop('checked', fwApproach.getIsSeaLevelRef()).change(event => {
let isChecked = $(event.currentTarget).prop('checked') ? 1 : 0;
fwApproach.setIsSeaLevelRef(isChecked);
(async () => {
const elevation = await fwApproach.getElevationFromServer(safehome.getLonMap(), safehome.getLatMap(), globalSettings) * 100;
fwApproach.setElevation(elevation);
$('#safehomeElevation').text(elevation / 100);
$approachAlt = $safehomeBox.find('#safehomeApproachAlt');
$landAlt = $safehomeBox.find('#safehomeLandAlt');
if (isChecked) {
fwApproach.setApproachAltAsl(fwApproach.getApproachAltAsl() + elevation);
fwApproach.setLandAltAsl(fwApproach.getLandAltAsl() + elevation);
} else {
fwApproach.setApproachAltAsl(fwApproach.getApproachAltAsl() - elevation);
fwApproach.setLandAltAsl(fwApproach.getLandAltAsl() - elevation);
}
$approachAlt.val(fwApproach.getApproachAltAsl());
$landAlt.val(fwApproach.getLandAltAsl());
$('#safehomeLandAltM').text(fwApproach.getLandAltAsl() / 100 + " m");
$('#safehomeApproachAltM').text( fwApproach.getApproachAltAsl() / 100 + " m");
})();
});
$safehomeBox.find('#safehomeApproachAlt').val(fwApproach.getApproachAltAsl()).on('change', event => {
let altitude = Number($(event.currentTarget).val());
if (checkLandingAltitude(altitude, $safehomeBox.find('#safehomeSeaLevelRef').prop('checked'), Number($('#safehomeElevation').text()))) {
fwApproach.setApproachAltAsl(Number($(event.currentTarget).val()));
$('#safehomeApproachAltM').text( fwApproach.getApproachAltAsl() / 100 + " m");
cleanSafehomeLayers();
renderSafehomesOnMap();
renderHomeTable();
}
$safehomeBox.find('#safehomeApproachAlt').val(fwApproach.getApproachAltAsl());
});
$safehomeBox.find('#safehomeLandAlt').val(fwApproach.getLandAltAsl()).on('change', event => {
let altitude = Number($(event.currentTarget).val());
if (checkLandingAltitude(altitude, $safehomeBox.find('#safehomeSeaLevelRef').prop('checked'), Number($('#safehomeElevation').text()))) {
fwApproach.setLandAltAsl(altitude);
$('#safehomeLandAltM').text(fwApproach.getLandAltAsl() / 100 + " m");
cleanSafehomeLayers();
renderSafehomesOnMap();
renderHomeTable();
} else {
$safehomeBox.find('#safehomeLandAlt').val(fwApproach.getLandAltAsl());
}
});
$safehomeBox.find('#geozoneApproachDirection').val(fwApproach.getApproachDirection()).on('change', event => {
fwApproach.setApproachDirection($(event.currentTarget).val());
cleanSafehomeLayers();
renderSafehomesOnMap();
});
$safehomeBox.find('#safehomeLandHeading1Excl').prop('checked', fwApproach.getLandHeading1() < 0).change(event => {
fwApproach.setLandHeading1(fwApproach.getLandHeading1() * -1);
cleanSafehomeLayers();
renderSafehomesOnMap();
});
$safehomeBox.find('#safehomeLandHeading1').val(Math.abs(fwApproach.getLandHeading1())).on('change', event => {
let val = Number($(event.currentTarget).val());
if (val < 0) {
val = 360;
$safehomeBox.find('#safehomeLandHeading1').val(360);
}
if (val > 360) {
val = 0;
$safehomeBox.find('#safehomeLandHeading1').val(0);
}
if ($safehomeBox.find('#safehomeLandHeading1Excl').prop('checked')) {
val *= -1;
}
fwApproach.setLandHeading1(val);
cleanSafehomeLayers();
renderSafehomesOnMap();
});
$safehomeBox.find('#safehomeLandHeading2Excl').prop('checked', fwApproach.getLandHeading2() < 0).change(event => {
fwApproach.setLandHeading2(fwApproach.getLandHeading2() * -1);
cleanSafehomeLayers();
renderSafehomesOnMap();
});
$safehomeBox.find('#safehomeLandHeading2').val(Math.abs(fwApproach.getLandHeading2())).on('change', event => {
let val = Number($(event.currentTarget).val());
if (val < 0) {
val = 360;
$safehomeBox.find('#safehomeLandHeading2').val(360);
}
if (val > 360) {
val = 0;
$safehomeBox.find('#safehomeLandHeading2').val(0);
}
if ($safehomeBox.find('#safehomeLandHeading2Excl').prop('checked')) {
val *= -1;
}
fwApproach.setLandHeading2(val);
cleanSafehomeLayers();
renderSafehomesOnMap();
});
$('#safehomeLandAltM').text(fwApproach.getLandAltAsl() / 100 + " m");
$('#safehomeApproachAltM').text(fwApproach.getApproachAltAsl() / 100 + " m");
if (fwApproach.getElevation() != NaN)
$('#safehomeElevation').text(fwApproach.getElevation() / 100 + " m");
GUI.switchery();
localize();
} }
function checkLandingAltitude(altitude, isSeaLevelRef, sealevel) { function checkLandingAltitude(altitude, isSeaLevelRef, sealevel) {
if (isSeaLevelRef && altitude - sealevel < 0) { if (altitude - (isSeaLevelRef ? sealevel * 100 : 0 ) < MAX_NEG_FW_LAND_ALT) {
alert(chrome.i18n.getMessage('MissionPlannerAltitudeChangeReset')); alert(chrome.i18n.getMessage('MissionPlannerFwLAndingAltitudeChangeReset'));
return false; return false;
} }
return true; return true;
} }
@ -749,40 +519,20 @@ TABS.mission_control.initialize = function (callback) {
$('#availableSafehomes').text(freeSamehomes + '/' + SAFEHOMES.getMaxSafehomeCount()); $('#availableSafehomes').text(freeSamehomes + '/' + SAFEHOMES.getMaxSafehomeCount());
} }
function addSafehome(){
if (SAFEHOMES.safehomeCount() + 1 > SAFEHOMES.getMaxSafehomeCount()){
alert(chrome.i18n.getMessage('missionSafehomeMaxSafehomesReached'));
return;
}
let mapCenter = map.getView().getCenter();
let midLon = Math.round(ol.proj.toLonLat(mapCenter)[0] * 1e7);
let midLat = Math.round(ol.proj.toLonLat(mapCenter)[1] * 1e7);
SAFEHOMES.put(new Safehome(SAFEHOMES.safehomeCount(), 1, midLat, midLon));
selectedSafehome = SAFEHOMES.safehomeCount() - 1;
cleanSafehomeLayers();
renderSafehomesOnMap();
renderSafehomesTable();
updateSafehomeInfo();
}
function renderSafehomesOnMap() { function renderSafehomesOnMap() {
/* /*
* Process safehome on Map * Process safehome on Map
*/ */
SAFEHOMES.get().forEach(safehome => {
addFwApproach(safehome.getLonMap(), safehome.getLatMap(), FW_APPROACH.get()[safehome.getNumber()], safehomeMarkers);
});
SAFEHOMES.get().forEach(safehome => { SAFEHOMES.get().forEach(safehome => {
addSafehomeCircles(safehome); addSafehomeCircles(safehome);
addSafeHomeMarker(safehome); addSafeHomeMarker(safehome);
}); });
SAFEHOMES.get().forEach(safehome => {
addFwApproach(safehome.getLonMap(), safehome.getLatMap(), FW_APPROACH.get()[safehome.getNumber()], safehomeMarkers);
});
} }
function cleanSafehomeLayers() { function cleanSafehomeLayers() {
for (var i in safehomeMarkers) { for (var i in safehomeMarkers) {
map.removeLayer(safehomeMarkers[i]); map.removeLayer(safehomeMarkers[i]);
@ -1621,20 +1371,63 @@ TABS.mission_control.initialize = function (callback) {
function redrawLayers() { function redrawLayers() {
if (!mission.isEmpty()) { if (!mission.isEmpty()) {
repaintLine4Waypoints(mission);
mission.get().forEach(function (element) { mission.get().forEach(function (element) {
if (!element.isAttached()) { if (!element.isAttached()) {
map.addLayer(addWaypointMarker(element)); map.addLayer(addWaypointMarker(element));
} }
}); });
repaintLine4Waypoints(mission);
} }
} }
function redrawLayer() { function redrawLayer() {
repaintLine4Waypoints(mission);
if (selectedFeature && selectedMarker) { if (selectedFeature && selectedMarker) {
selectedFeature.setStyle(getWaypointIcon(selectedMarker, true)); selectedFeature.setStyle(getWaypointIcon(selectedMarker, true));
} }
repaintLine4Waypoints(mission); }
function renderSafeHomeOptions() {
if (selectedSafehome && selectedFwApproachSh) {
if (!$('#missionPlannerSafehome').is(':visible')) {
$('#missionPlannerSafehome').fadeIn(300);
}
$('#SafehomeContentBox').show();
if (selectedFwApproachSh.getLandHeading1() == 0 && selectedFwApproachSh.getLandHeading1() == 0 && selectedFwApproachSh.getApproachAltAsl() == 0 && selectedFwApproachSh.getLandAltAsl() == 0) {
selectedFwApproachSh.setApproachAltAsl(settings.fwApproachAlt * 100);
selectedFwApproachSh.setLandAltAsl(settings.fwLandAlt * 100);
}
if (selectedFwApproachSh.getElevation() == 0) {
(async () => {
const elevation = await selectedFwApproachSh.getElevationFromServer(selectedSafehome.getLonMap(), selectedSafehome.getLatMap(), globalSettings) * 100;
selectedFwApproachSh.setElevation(elevation);
$('#safehomeElevation').text(selectedFwApproachSh.getElevation() / 100 + " m");
})();
}
const $safehomeBox = $safehomeContentBox.find('.missionPlannerSafehomeBox:last-child');
$safehomeBox.find('.spacer_box_title').text(chrome.i18n.getMessage('safehomeEdit') + ' ' + (selectedSafehome.getNumber() + 1));
$('#safehomeLatitude').val(selectedSafehome.getLatMap());
$('#safehomeLongitude').val(selectedSafehome.getLonMap());
changeSwitchery($('#safehomeSeaLevelRef'), selectedFwApproachSh.getIsSeaLevelRef());
$('#safehomeApproachAlt').val(selectedFwApproachSh.getApproachAltAsl());
$('#safehomeLandAlt').val(selectedFwApproachSh.getLandAltAsl());
$('#geozoneApproachDirection').val(selectedFwApproachSh.getApproachDirection());
$('#safehomeLandHeading1').val(Math.abs(selectedFwApproachSh.getLandHeading1()));
changeSwitchery($('#safehomeLandHeading1Excl'), selectedFwApproachSh.getLandHeading1() < 0);
$('#safehomeLandHeading2').val(Math.abs(selectedFwApproachSh.getLandHeading2()));
changeSwitchery($('#safehomeLandHeading2Excl'), selectedFwApproachSh.getLandHeading2() < 0);
$('#safehomeLandAltM').text(selectedFwApproachSh.getLandAltAsl() / 100 + " m");
$('#safehomeApproachAltM').text(selectedFwApproachSh.getApproachAltAsl() / 100 + " m");
} else {
$('#SafehomeContentBox').hide();
}
} }
function renderWaypointOptionsTable(waypoint) { function renderWaypointOptionsTable(waypoint) {
@ -1854,10 +1647,7 @@ TABS.mission_control.initialize = function (callback) {
var handleShowSafehome = function () { var handleShowSafehome = function () {
$('#missionPlannerSafehome').fadeIn(300); $('#missionPlannerSafehome').fadeIn(300);
//SAFEHOMES.flush();
//mspHelper.loadSafehomes();
cleanSafehomeLayers(); cleanSafehomeLayers();
renderSafehomesTable();
renderSafehomesOnMap(); renderSafehomesOnMap();
$('#safeHomeMaxDistance').text(settings.maxDistSH); $('#safeHomeMaxDistance').text(settings.maxDistSH);
$('#SafeHomeSafeDistance').text(settings.safeRadiusSH); $('#SafeHomeSafeDistance').text(settings.safeRadiusSH);
@ -2019,11 +1809,10 @@ TABS.mission_control.initialize = function (callback) {
$('#safeHomeLongitude').val(Math.round(coord[0] * 1e7)); $('#safeHomeLongitude').val(Math.round(coord[0] * 1e7));
$('#safeHomeLatitude').val(Math.round(coord[1] * 1e7)); $('#safeHomeLatitude').val(Math.round(coord[1] * 1e7));
selectedSafehome = tempMarker.number; updateSelectedShAndFwAp(tempMarker.number);
renderSafeHomeOptions();
cleanSafehomeLayers(); cleanSafehomeLayers();
renderSafehomesOnMap(); renderSafehomesOnMap();
renderSafehomesTable();
} }
else if (tempMarker.kind == "home") { else if (tempMarker.kind == "home") {
HOME.setLon(Math.round(coord[0] * 10000000)); HOME.setLon(Math.round(coord[0] * 10000000));
@ -2108,8 +1897,8 @@ TABS.mission_control.initialize = function (callback) {
approach.setLandAltAsl(approach.getLandAltAsl() - approach.getElevation() + elevation); approach.setLandAltAsl(approach.getLandAltAsl() - approach.getElevation() + elevation);
} }
approach.setElevation(elevation); approach.setElevation(elevation);
renderSafehomesTable(); }
} renderSafeHomeOptions();
})() })()
} }
this.coordinate_ = null; this.coordinate_ = null;
@ -2343,8 +2132,8 @@ TABS.mission_control.initialize = function (callback) {
} }
} }
else if (selectedFeature && tempMarker.kind == "safehome" && tempMarker.selection) { else if (selectedFeature && tempMarker.kind == "safehome" && tempMarker.selection) {
selectedSafehome = tempMarker.number; updateSelectedShAndFwAp(tempMarker.number);
renderSafehomesTable(); renderSafeHomeOptions();
} }
else if (selectedFeature && tempMarker.kind == "home" && tempMarker.selection) { else if (selectedFeature && tempMarker.kind == "home" && tempMarker.selection) {
selectedMarker = HOME; selectedMarker = HOME;
@ -2724,7 +2513,7 @@ TABS.mission_control.initialize = function (callback) {
$('#wpApproachAlt').on('change', (event) => { $('#wpApproachAlt').on('change', (event) => {
if (selectedMarker && selectedFwApproachWp) { if (selectedMarker && selectedFwApproachWp) {
let altitude = Number($(event.currentTarget).val()); let altitude = Number($(event.currentTarget).val());
if (checkLandingAltitude(altitude, $('#pointP3Alt').prop('checked'), Number($('#elevationValueAtWP').text()))) { if (checkApproachAltitude(altitude, $('#pointP3Alt').prop('checked'), Number($('#elevationValueAtWP').text()))) {
selectedFwApproachWp.setApproachAltAsl(Number($(event.currentTarget).val())); selectedFwApproachWp.setApproachAltAsl(Number($(event.currentTarget).val()));
$('#wpApproachAltM').text(selectedFwApproachWp.getApproachAltAsl() / 100 + " m"); $('#wpApproachAltM').text(selectedFwApproachWp.getApproachAltAsl() / 100 + " m");
} }
@ -2854,23 +2643,25 @@ TABS.mission_control.initialize = function (callback) {
}); });
///////////////////////////////////////////// /////////////////////////////////////////////
// Callback for SAFEHOMES Table // Callback for SAFEHOMES
///////////////////////////////////////////// /////////////////////////////////////////////
/*
$safehomesTableBody.on('click', "[data-role='safehome-center']", function (event) {
let mapCenter = map.getView().getCenter();
let tmpSH = SAFEHOMES.getSafehome($(event.currentTarget).attr("data-index"));
tmpSH.setLon(Math.round(ol.proj.toLonLat(mapCenter)[0] * 1e7));
tmpSH.setLat(Math.round(ol.proj.toLonLat(mapCenter)[1] * 1e7));
SAFEHOMES.updateSafehome(tmpSH);
renderSafehomesTable();
cleanSafehomeLayers();
renderSafehomesOnMap();
});
*/
$('#addSafehome').on('click', () => { $('#addSafehome').on('click', () => {
addSafehome(); if (SAFEHOMES.safehomeCount() + 1 > SAFEHOMES.getMaxSafehomeCount()){
alert(chrome.i18n.getMessage('missionSafehomeMaxSafehomesReached'));
return;
}
let mapCenter = map.getView().getCenter();
let midLon = Math.round(ol.proj.toLonLat(mapCenter)[0] * 1e7);
let midLat = Math.round(ol.proj.toLonLat(mapCenter)[1] * 1e7);
SAFEHOMES.put(new Safehome(SAFEHOMES.safehomeCount(), 1, midLat, midLon));
updateSelectedShAndFwAp(SAFEHOMES.safehomeCount() - 1);
renderSafeHomeOptions();
cleanSafehomeLayers();
renderSafehomesOnMap();
updateSafehomeInfo();
}); });
$('#cancelSafehome').on('click', function () { $('#cancelSafehome').on('click', function () {
@ -2880,16 +2671,26 @@ TABS.mission_control.initialize = function (callback) {
$('#loadEepromSafehomeButton').on('click', function () { $('#loadEepromSafehomeButton').on('click', function () {
$(this).addClass('disabled'); $(this).addClass('disabled');
GUI.log('Start of getting Safehome points'); GUI.log('Start of getting Safehome points');
mspHelper.loadSafehomes(mspHelper.loadFwApproach); var loadChainer = new MSPChainerClass();
setTimeout(function(){ loadChainer.setChain([
renderSafehomesTable(); mspHelper.loadSafehomes,
cleanSafehomeLayers(); mspHelper.loadFwApproach,
renderSafehomesOnMap(); function() {
updateSafehomeInfo(); if (SAFEHOMES.safehomeCount() >= 1) {
GUI.log(chrome.i18n.getMessage('endGettingSafehomePoints')); updateSelectedShAndFwAp(0);
$('#loadEepromSafehomeButton').removeClass('disabled'); } else {
}, 500); selectedSafehome = null;
selectedFwApproachSh = null;
}
renderSafeHomeOptions();
cleanSafehomeLayers();
renderSafehomesOnMap();
updateSafehomeInfo();
GUI.log(chrome.i18n.getMessage('endGettingSafehomePoints'));
$('#loadEepromSafehomeButton').removeClass('disabled');
}
]);
loadChainer.execute();
}); });
$('#saveEepromSafehomeButton').on('click', function() { $('#saveEepromSafehomeButton').on('click', function() {
@ -2909,6 +2710,176 @@ TABS.mission_control.initialize = function (callback) {
saveChainer.execute(); saveChainer.execute();
}); });
$('#deleteSafehome').on('click', () => {
if (selectedSafehome && selectedFwApproachSh) {
var shNum = selectedSafehome.getNumber();
SAFEHOMES.drop(shNum);
FW_APPROACH.clean(shNum);
if (SAFEHOMES.safehomeCount() > 0) {
updateSelectedShAndFwAp(SAFEHOMES.safehomeCount() - 1);
} else {
selectedSafehome = null;
selectedFwApproachSh = null;
}
renderSafeHomeOptions();
cleanSafehomeLayers();
renderSafehomesOnMap();
updateSafehomeInfo();
}
});
$('#safehomeLatitude').on('change', event => {
if (selectedFwApproachSh) {
selectedFwApproachSh.setLat(Math.round(Number($(event.currentTarget).val()) * 1e7));
renderSafeHomeOptions();
cleanSafehomeLayers();
renderSafehomesOnMap();
}
});
$('#safehomeLongitude').on('change', event => {
if (selectedFwApproachSh) {
selectedFwApproachSh.setLon(Math.round(Number($(event.currentTarget).val()) * 1e7));
renderSafeHomeOptions();
cleanSafehomeLayers();
renderSafehomesOnMap();
}
});
$('#safehomeSeaLevelRef').on('change', event => {
let isChecked = $(event.currentTarget).prop('checked') ? 1 : 0;
if (selectedSafehome && selectedFwApproachSh && isChecked != selectedFwApproachSh.getIsSeaLevelRef()) {
selectedFwApproachSh.setIsSeaLevelRef(isChecked);
(async () => {
const elevation = await selectedFwApproachSh.getElevationFromServer(selectedSafehome.getLonMap(), selectedSafehome.getLatMap(), globalSettings) * 100;
selectedFwApproachSh.setElevation(elevation);
if (isChecked) {
selectedFwApproachSh.setApproachAltAsl(selectedFwApproachSh.getApproachAltAsl() + elevation);
selectedFwApproachSh.setLandAltAsl(selectedFwApproachSh.getLandAltAsl() + elevation);
} else {
selectedFwApproachSh.setApproachAltAsl(selectedFwApproachSh.getApproachAltAsl() - elevation);
selectedFwApproachSh.setLandAltAsl(selectedFwApproachSh.getLandAltAsl() - elevation);
}
$('#safehomeElevation').text(elevation / 100);
$('#safehomeApproachAlt').val(selectedFwApproachSh.getApproachAltAsl());
$('#safehomeLandAlt').val(selectedFwApproachSh.getLandAltAsl());
$('#safehomeLandAltM').text(selectedFwApproachSh.getLandAltAsl() / 100 + " m");
$('#safehomeApproachAltM').text(selectedFwApproachSh.getApproachAltAsl() / 100 + " m");
renderSafeHomeOptions();
})();
}
});
$('#safehomeApproachAlt').on('change', event => {
if (selectedFwApproachSh) {
let altitude = Number($(event.currentTarget).val());
if (checkApproachAltitude(altitude, $('#safehomeSeaLevelRef').prop('checked'), Number($('#safehomeElevation').text()))) {
selectedFwApproachSh.setApproachAltAsl(Number($(event.currentTarget).val()));
$('#safehomeApproachAltM').text(selectedFwApproachSh.getApproachAltAsl() / 100 + " m");
cleanSafehomeLayers();
renderSafehomesOnMap();
renderHomeTable();
}
$('#safehomeApproachAlt').val(selectedFwApproachSh.getApproachAltAsl());
}
});
$('#safehomeLandAlt').on('change', event => {
if (selectedFwApproachSh) {
let altitude = Number($(event.currentTarget).val());
if (checkLandingAltitude(altitude, $('#safehomeSeaLevelRef').prop('checked'), Number($('#safehomeElevation').text()))) {
selectedFwApproachSh.setLandAltAsl(altitude);
$('#safehomeLandAltM').text(selectedFwApproachSh.getLandAltAsl() / 100 + " m");
cleanSafehomeLayers();
renderSafehomesOnMap();
renderHomeTable();
} else {
$('#safehomeLandAlt').val(selectedFwApproachSh.getLandAltAsl());
}
}
});
$('#geozoneApproachDirection').on('change', event => {
if (selectedFwApproachSh) {
selectedFwApproachSh.setApproachDirection($(event.currentTarget).val());
cleanSafehomeLayers();
renderSafehomesOnMap();
}
});
$('#safehomeLandHeading1Excl').on('change', event => {
if (selectedFwApproachSh) {
selectedFwApproachSh.setLandHeading1(selectedFwApproachSh.getLandHeading1() * -1);
cleanSafehomeLayers();
renderSafehomesOnMap();
}
});
$('#safehomeLandHeading1').on('change', event => {
if (selectedFwApproachSh) {
let val = Number($(event.currentTarget).val());
if (val < 0) {
val = 360;
$('#safehomeLandHeading1').val(360);
}
if (val > 360) {
val = 0;
$('#safehomeLandHeading1').val(0);
}
if ($('#safehomeLandHeading1Excl').prop('checked')) {
val *= -1;
}
selectedFwApproachSh.setLandHeading1(val);
cleanSafehomeLayers();
renderSafehomesOnMap();
}
});
$('#safehomeLandHeading2Excl').on('change', event => {
if (selectedFwApproachSh) {
selectedFwApproachSh.setLandHeading2(selectedFwApproachSh.getLandHeading2() * -1);
cleanSafehomeLayers();
renderSafehomesOnMap();
}
});
$('#safehomeLandHeading2').on('change', event => {
if (selectedFwApproachSh) {
let val = Number($(event.currentTarget).val());
if (val < 0) {
val = 360;
$('#safehomeLandHeading2').val(360);
}
if (val > 360) {
val = 0;
$('#safehomeLandHeading2').val(0);
}
if ($('#safehomeLandHeading2Excl').prop('checked')) {
val *= -1;
}
selectedFwApproachSh.setLandHeading2(val);
cleanSafehomeLayers();
renderSafehomesOnMap();
}
});
///////////////////////////////////////////// /////////////////////////////////////////////
// Callback for HOME Table // Callback for HOME Table
///////////////////////////////////////////// /////////////////////////////////////////////
@ -3396,57 +3367,53 @@ TABS.mission_control.initialize = function (callback) {
// mission = configurator store, WP number indexed from 0, MISSION_PLANNER = FC NVM store, WP number indexed from 1 // mission = configurator store, WP number indexed from 0, MISSION_PLANNER = FC NVM store, WP number indexed from 1
///////////////////////////////////////////// /////////////////////////////////////////////
function getWaypointsFromFC(loadEeprom) { function getWaypointsFromFC(loadEeprom) {
var loadChainer = new MSPChainerClass();
var chain = [mspHelper.loadFwApproach];
if (loadEeprom) { if (loadEeprom) {
MSP.send_message(MSPCodes.MSP_WP_MISSION_LOAD, [0], getFwApproach); chain.push(function(callback) {
} else { MSP.send_message(MSPCodes.MSP_WP_MISSION_LOAD, [0], callback);
getFwApproach();
}
function getFwApproach()
{
mspHelper.loadFwApproach(getWaypointData);
}
function getWaypointData() {
mspHelper.loadWaypoints(function() {
GUI.log(chrome.i18n.getMessage('endGetPoint'));
if (loadEeprom) {
GUI.log(chrome.i18n.getMessage('eeprom_load_ok'));
$('#loadEepromMissionButton').removeClass('disabled');
} else {
$('#loadMissionButton').removeClass('disabled');
}
if (!MISSION_PLANNER.getCountBusyPoints()) {
alert(chrome.i18n.getMessage('no_waypoints_to_load'));
return;
}
mission.reinit();
mission.copy(MISSION_PLANNER);
mission.update(false, true);
/* check multimissions */
multimissionCount = 0;
mission.get().forEach(function (element) {
if (element.getEndMission() == 0xA5) {
element.setMultiMissionIdx(multimissionCount);
multimissionCount ++;
}
});
multimissionCount = multimissionCount > 1 ? multimissionCount : 0;
multimission.reinit();
if (multimissionCount > 1) {
multimission.copy(mission);
$('#missionPlannerMultiMission').fadeIn(300);
}
renderMultimissionTable();
setView(16);
redrawLayers();
updateTotalInfo();
}); });
}
}; chain.push(mspHelper.loadWaypoints);
chain.push(function() {
GUI.log(chrome.i18n.getMessage('endGetPoint'));
if (loadEeprom) {
GUI.log(chrome.i18n.getMessage('eeprom_load_ok'));
$('#loadEepromMissionButton').removeClass('disabled');
} else {
$('#loadMissionButton').removeClass('disabled');
}
if (!MISSION_PLANNER.getCountBusyPoints()) {
alert(chrome.i18n.getMessage('no_waypoints_to_load'));
return;
}
mission.reinit();
mission.copy(MISSION_PLANNER);
mission.update(false, true);
/* check multimissions */
multimissionCount = 0;
mission.get().forEach(function (element) {
if (element.getEndMission() == 0xA5) {
element.setMultiMissionIdx(multimissionCount);
multimissionCount++;
}
});
multimissionCount = multimissionCount > 1 ? multimissionCount : 0;
multimission.reinit();
if (multimissionCount > 1) {
multimission.copy(mission);
$('#missionPlannerMultiMission').fadeIn(300);
}
renderMultimissionTable();
setView(16);
redrawLayers();
updateTotalInfo();
});
loadChainer.setChain(chain);
loadChainer.execute();
} }
function sendWaypointsToFC(saveEeprom) { function sendWaypointsToFC(saveEeprom) {
@ -3512,6 +3479,11 @@ TABS.mission_control.initialize = function (callback) {
} }
} }
function updateSelectedShAndFwAp(index) {
selectedSafehome = SAFEHOMES.get()[index];
selectedFwApproachSh = FW_APPROACH.get()[index];
}
/* resetAltitude = true : For selected WPs only. Changes WP Altitude value back to previous value if setting below ground level. /* 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 ^ resetAltitude = false : changes WP Altitude to value required to give ground clearance = default Altitude setting
^ AbsAltCheck : check value for whether or not to use absolute altitude. This can be the P3 bitset or excplicitly set to true or false */ ^ AbsAltCheck : check value for whether or not to use absolute altitude. This can be the P3 bitset or excplicitly set to true or false */

View file

@ -668,7 +668,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
$('#platform-type').parent('.select').addClass('no-bottom-border'); $('#platform-type').parent('.select').addClass('no-bottom-border');
} }
if (!updateEzTuneTabVisibility(false)) { if (updateEzTuneTabVisibility(false)) {
EZ_TUNE.enabled = 0; EZ_TUNE.enabled = 0;
mspHelper.saveEzTune(); mspHelper.saveEzTune();
} }