mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-16 12:55:13 +03:00
Initial build
This commit is contained in:
parent
3d1fcca7bb
commit
8fcdf76945
8 changed files with 657 additions and 130 deletions
|
@ -3506,6 +3506,12 @@
|
||||||
"confirm_delete_point_with_options": {
|
"confirm_delete_point_with_options": {
|
||||||
"message": "Do you really want to delete this Waypoint with non-Geo JUMP/SET_HEAD/RTH options? \nIf yes, Non-Geo options attached will be removed also!"
|
"message": "Do you really want to delete this Waypoint with non-Geo JUMP/SET_HEAD/RTH options? \nIf yes, Non-Geo options attached will be removed also!"
|
||||||
},
|
},
|
||||||
|
"confirm_multimission_file_load": {
|
||||||
|
"message": "This is a multi mission file. Loading will over write current multi mission.\nContinue?"
|
||||||
|
},
|
||||||
|
"confirm_overwrite_multimission_file_load_option": {
|
||||||
|
"message": "This will over write current multi mission.\nContinue?"
|
||||||
|
},
|
||||||
"no_waypoints_to_load": {
|
"no_waypoints_to_load": {
|
||||||
"message": "No waypoints to load !"
|
"message": "No waypoints to load !"
|
||||||
},
|
},
|
||||||
|
|
50
images/icons/cf_icon_multimission_white.svg
Normal file
50
images/icons/cf_icon_multimission_white.svg
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
version="1.1"
|
||||||
|
id="Capa_1"
|
||||||
|
x="0px"
|
||||||
|
y="0px"
|
||||||
|
viewBox="0 0 141.7 141.7"
|
||||||
|
enable-background="new 0 0 141.7 141.7"
|
||||||
|
xml:space="preserve"
|
||||||
|
sodipodi:docname="cf_icon_MM_white.svg"
|
||||||
|
inkscape:version="1.1 (c68e22c387, 2021-05-23)"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||||
|
id="defs12" /><sodipodi:namedview
|
||||||
|
id="namedview10"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pagecheckerboard="true"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="3.7402965"
|
||||||
|
inkscape:cx="77.132923"
|
||||||
|
inkscape:cy="70.983678"
|
||||||
|
inkscape:window-width="1366"
|
||||||
|
inkscape:window-height="715"
|
||||||
|
inkscape:window-x="-8"
|
||||||
|
inkscape:window-y="-8"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="Capa_1" />
|
||||||
|
<g
|
||||||
|
id="g7"
|
||||||
|
transform="rotate(-90,69.810245,71.05)">
|
||||||
|
<g
|
||||||
|
id="_x34_29._Network">
|
||||||
|
<g
|
||||||
|
id="g4">
|
||||||
|
<path
|
||||||
|
fill="#ffffff"
|
||||||
|
d="M 122.4,98.3 V 77.6 c 0,-7.2 -5.9,-13.1 -13.1,-13.1 H 76.6 V 43.7 C 84.2,41 89.7,33.7 89.7,25.2 89.7,14.4 80.9,5.6 70.1,5.6 59.3,5.6 50.5,14.4 50.5,25.2 50.5,33.8 56,41 63.6,43.7 V 64.5 H 30.7 c -7.2,0 -13.1,5.9 -13.1,13.1 V 98.4 C 10,101 4.5,108.3 4.5,116.8 c 0,10.8 8.8,19.6 19.6,19.6 10.8,0 19.6,-8.8 19.6,-19.6 0,-8.5 -5.5,-15.8 -13.1,-18.5 V 77.6 h 32.7 v 20.8 c -7.6,2.7 -13.1,9.9 -13.1,18.5 0,10.8 8.8,19.6 19.6,19.6 10.8,0 19.6,-8.8 19.6,-19.6 0,-8.5 -5.5,-15.8 -13.1,-18.5 V 77.6 H 109 v 20.8 c -7.6,2.7 -13.1,9.9 -13.1,18.5 0,10.8 8.8,19.6 19.6,19.6 10.8,0 19.6,-8.8 19.6,-19.6 0.4,-8.6 -5.1,-15.9 -12.7,-18.6 z m -98.2,25.1 c -3.6,0 -6.5,-2.9 -6.5,-6.5 0,-3.6 2.9,-6.5 6.5,-6.5 3.6,0 6.5,2.9 6.5,6.5 0,3.6 -2.9,6.5 -6.5,6.5 z m 45.8,0 c -3.6,0 -6.5,-2.9 -6.5,-6.5 0,-3.6 2.9,-6.5 6.5,-6.5 3.6,0 6.5,2.9 6.5,6.5 0.1,3.6 -2.9,6.5 -6.5,6.5 z m 0,-91.7 c -3.6,0 -6.5,-2.9 -6.5,-6.6 0,-3.6 2.9,-6.5 6.5,-6.5 3.6,0 6.5,2.9 6.5,6.5 0.1,3.7 -2.9,6.6 -6.5,6.6 z m 45.8,91.7 c -3.6,0 -6.5,-2.9 -6.5,-6.5 0,-3.6 2.9,-6.5 6.5,-6.5 3.6,0 6.5,2.9 6.5,6.5 0.1,3.6 -2.8,6.5 -6.5,6.5 z"
|
||||||
|
id="path2" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.3 KiB |
|
@ -455,7 +455,8 @@ var mspHelper = (function (gui) {
|
||||||
data.getInt32(10, true),
|
data.getInt32(10, true),
|
||||||
data.getInt16(14, true),
|
data.getInt16(14, true),
|
||||||
data.getInt16(16, true),
|
data.getInt16(16, true),
|
||||||
data.getInt16(18, true)
|
data.getInt16(18, true), // CR8
|
||||||
|
data.getUint8(20) // CR8
|
||||||
));
|
));
|
||||||
break;
|
break;
|
||||||
case MSPCodes.MSP_BOXIDS:
|
case MSPCodes.MSP_BOXIDS:
|
||||||
|
@ -519,7 +520,7 @@ var mspHelper = (function (gui) {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSPCodes.MSP2_INAV_LOGIC_CONDITIONS_STATUS:
|
case MSPCodes.MSP2_INAV_LOGIC_CONDITIONS_STATUS:
|
||||||
|
@ -1297,7 +1298,7 @@ var mspHelper = (function (gui) {
|
||||||
CALIBRATION_DATA.magZero.Y = data.getInt16(15, true);
|
CALIBRATION_DATA.magZero.Y = data.getInt16(15, true);
|
||||||
CALIBRATION_DATA.magZero.Z = data.getInt16(17, true);
|
CALIBRATION_DATA.magZero.Z = data.getInt16(17, true);
|
||||||
CALIBRATION_DATA.opflow.Scale = (data.getInt16(19, true) / 256.0);
|
CALIBRATION_DATA.opflow.Scale = (data.getInt16(19, true) / 256.0);
|
||||||
|
|
||||||
if (semver.gte(CONFIG.flightControllerVersion, "2.6.0")) {
|
if (semver.gte(CONFIG.flightControllerVersion, "2.6.0")) {
|
||||||
CALIBRATION_DATA.magGain.X = data.getInt16(21, true);
|
CALIBRATION_DATA.magGain.X = data.getInt16(21, true);
|
||||||
CALIBRATION_DATA.magGain.Y = data.getInt16(23, true);
|
CALIBRATION_DATA.magGain.Y = data.getInt16(23, true);
|
||||||
|
@ -1513,8 +1514,8 @@ var mspHelper = (function (gui) {
|
||||||
break;
|
break;
|
||||||
case MSPCodes.MSP2_INAV_SET_SAFEHOME:
|
case MSPCodes.MSP2_INAV_SET_SAFEHOME:
|
||||||
console.log('Safehome points saved');
|
console.log('Safehome points saved');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
console.log('Unknown code detected: ' + dataHandler.code);
|
console.log('Unknown code detected: ' + dataHandler.code);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2125,7 +2126,7 @@ var mspHelper = (function (gui) {
|
||||||
buffer.push(SENSOR_CONFIG.opflow);
|
buffer.push(SENSOR_CONFIG.opflow);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case MSPCodes.MSP_WP_MISSION_SAVE:
|
case MSPCodes.MSP_WP_MISSION_SAVE:
|
||||||
// buffer.push(0);
|
// buffer.push(0);
|
||||||
console.log(buffer);
|
console.log(buffer);
|
||||||
|
@ -2985,29 +2986,32 @@ var mspHelper = (function (gui) {
|
||||||
self.getMissionInfo = function (callback) {
|
self.getMissionInfo = function (callback) {
|
||||||
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, callback);
|
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
self.loadWaypoints = function (callback) {
|
self.loadWaypoints = function (callback) {
|
||||||
MISSION_PLANER.reinit();
|
MISSION_PLANER.reinit();
|
||||||
let waypointId = 1;
|
let waypointId = 1;
|
||||||
|
let startTime = new Date().getTime();
|
||||||
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, getFirstWP);
|
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, getFirstWP);
|
||||||
|
|
||||||
function getFirstWP() {
|
function getFirstWP() {
|
||||||
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, nextWaypoint)
|
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, nextWaypoint)
|
||||||
};
|
};
|
||||||
|
|
||||||
function nextWaypoint() {
|
function nextWaypoint() {
|
||||||
waypointId++;
|
waypointId++;
|
||||||
if (waypointId < MISSION_PLANER.getCountBusyPoints()) {
|
if (waypointId < MISSION_PLANER.getCountBusyPoints()) {
|
||||||
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, nextWaypoint);
|
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, nextWaypoint);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
GUI.log('Receive time: ' + (new Date().getTime() - startTime) + 'ms');
|
||||||
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, callback);
|
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, callback);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
self.saveWaypoints = function (callback) {
|
self.saveWaypoints = function (callback) {
|
||||||
let waypointId = 1;
|
let waypointId = 1;
|
||||||
|
let startTime = new Date().getTime();
|
||||||
MSP.send_message(MSPCodes.MSP_SET_WP, MISSION_PLANER.extractBuffer(waypointId), false, nextWaypoint)
|
MSP.send_message(MSPCodes.MSP_SET_WP, MISSION_PLANER.extractBuffer(waypointId), false, nextWaypoint)
|
||||||
|
|
||||||
function nextWaypoint() {
|
function nextWaypoint() {
|
||||||
|
@ -3019,17 +3023,18 @@ var mspHelper = (function (gui) {
|
||||||
MSP.send_message(MSPCodes.MSP_SET_WP, MISSION_PLANER.extractBuffer(waypointId), false, endMission);
|
MSP.send_message(MSPCodes.MSP_SET_WP, MISSION_PLANER.extractBuffer(waypointId), false, endMission);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function endMission() {
|
function endMission() {
|
||||||
|
GUI.log('Send time: ' + (new Date().getTime() - startTime) + 'ms');
|
||||||
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, callback);
|
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, callback);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
self.loadSafehomes = function (callback) {
|
self.loadSafehomes = function (callback) {
|
||||||
SAFEHOMES.flush();
|
SAFEHOMES.flush();
|
||||||
let safehomeId = 0;
|
let safehomeId = 0;
|
||||||
MSP.send_message(MSPCodes.MSP2_INAV_SAFEHOME, [safehomeId], false, nextSafehome);
|
MSP.send_message(MSPCodes.MSP2_INAV_SAFEHOME, [safehomeId], false, nextSafehome);
|
||||||
|
|
||||||
function nextSafehome() {
|
function nextSafehome() {
|
||||||
safehomeId++;
|
safehomeId++;
|
||||||
if (safehomeId < SAFEHOMES.getMaxSafehomeCount()-1) {
|
if (safehomeId < SAFEHOMES.getMaxSafehomeCount()-1) {
|
||||||
|
@ -3040,11 +3045,11 @@ var mspHelper = (function (gui) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
self.saveSafehomes = function (callback) {
|
self.saveSafehomes = function (callback) {
|
||||||
let safehomeId = 0;
|
let safehomeId = 0;
|
||||||
MSP.send_message(MSPCodes.MSP2_INAV_SET_SAFEHOME, SAFEHOMES.extractBuffer(safehomeId), false, nextSendSafehome);
|
MSP.send_message(MSPCodes.MSP2_INAV_SET_SAFEHOME, SAFEHOMES.extractBuffer(safehomeId), false, nextSendSafehome);
|
||||||
|
|
||||||
function nextSendSafehome() {
|
function nextSendSafehome() {
|
||||||
safehomeId++;
|
safehomeId++;
|
||||||
if (safehomeId < SAFEHOMES.getMaxSafehomeCount()-1) {
|
if (safehomeId < SAFEHOMES.getMaxSafehomeCount()-1) {
|
||||||
|
|
|
@ -72,7 +72,7 @@ let WaypointCollection = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
self.isEmpty = function () {
|
self.isEmpty = function () {
|
||||||
return data == [];
|
return data.length == 0; // CR9
|
||||||
};
|
};
|
||||||
|
|
||||||
self.flush = function () {
|
self.flush = function () {
|
||||||
|
@ -180,12 +180,16 @@ let WaypointCollection = function () {
|
||||||
optionIdx = 0;
|
optionIdx = 0;
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
if (element.getNumber() == ((bMWPfile && bReverse) ? self.get().length : self.get().length-1)) {
|
// CR8
|
||||||
element.setEndMission(0xA5);
|
if (!(bMWPfile && bReverse)) {
|
||||||
}
|
if (element.getNumber() == self.get().length - 1) {
|
||||||
else {
|
element.setEndMission(0xA5);
|
||||||
element.setEndMission(0);
|
}
|
||||||
|
else if ((element.getNumber() == self.get().length - 2) && element.getEndMission() == 0xA5) {
|
||||||
|
element.setEndMission(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// CR8
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -60,7 +60,11 @@
|
||||||
.tab-mission-control .ic_removeAll {
|
.tab-mission-control .ic_removeAll {
|
||||||
background-image: url(../images/icons/cf_icon_MP_removeAll_grey.svg);
|
background-image: url(../images/icons/cf_icon_MP_removeAll_grey.svg);
|
||||||
}
|
}
|
||||||
|
/* CR8 */
|
||||||
|
.tab-mission-control .ic_openMultimission {
|
||||||
|
background-image: url(../images/icons/cf_icon_multimission_white.svg);
|
||||||
|
}
|
||||||
|
/* CR8 */
|
||||||
.tab-mission-control .ic_save {
|
.tab-mission-control .ic_save {
|
||||||
background-image: url(../images/icons/cf_icon_MP_save_grey.svg);
|
background-image: url(../images/icons/cf_icon_MP_save_grey.svg);
|
||||||
}
|
}
|
||||||
|
@ -92,7 +96,11 @@
|
||||||
.tab-mission-control .ic_center {
|
.tab-mission-control .ic_center {
|
||||||
background-image: url(../images/icons/cf_icon_MP_center_grey.svg);
|
background-image: url(../images/icons/cf_icon_MP_center_grey.svg);
|
||||||
}
|
}
|
||||||
|
/* CR8 */
|
||||||
|
.tab-mission-control .ic_setup {
|
||||||
|
background-image: url(../images/icons/cf_icon_setup_white.svg);
|
||||||
|
}
|
||||||
|
/* CR8 */
|
||||||
.tab-mission-control .btnicon {
|
.tab-mission-control .btnicon {
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
|
@ -277,21 +285,31 @@
|
||||||
.ol-touch .mission-control-settings {
|
.ol-touch .mission-control-settings {
|
||||||
top: 80px;
|
top: 80px;
|
||||||
}
|
}
|
||||||
.mission-control-safehome {
|
/* CR8 */
|
||||||
top: 115px;
|
.mission-control-multimission {
|
||||||
left: .5em;
|
|
||||||
}
|
|
||||||
.ol-touch .mission-control-safehome {
|
|
||||||
top: 120px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mission-control-elevation {
|
|
||||||
top: 90px;
|
top: 90px;
|
||||||
left: .5em;
|
left: .5em;
|
||||||
}
|
}
|
||||||
.ol-touch .mission-control-elevation {
|
.ol-touch .mission-control-multimission {
|
||||||
top: 100px;
|
top: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mission-control-elevation {
|
||||||
|
top: 115px;
|
||||||
|
left: .5em;
|
||||||
|
}
|
||||||
|
.ol-touch .mission-control-elevation {
|
||||||
|
top: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mission-control-safehome {
|
||||||
|
top: 140px;
|
||||||
|
left: .5em;
|
||||||
|
}
|
||||||
|
.ol-touch .mission-control-safehome {
|
||||||
|
top: 140px;
|
||||||
|
}
|
||||||
|
/* CR8 */
|
||||||
.mission-control-template {
|
.mission-control-template {
|
||||||
top: 140px;
|
top: 140px;
|
||||||
left: .5em;
|
left: .5em;
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="missionPlanerTotalInfo" class="gui_box grey">
|
<div id="missionPlanerTotalInfo" class="gui_box grey">
|
||||||
<div class="gui_box_titlebar">
|
<div class="gui_box_titlebar">
|
||||||
<div class="spacer_box_title i18n-replaced" data-i18n="missionTotalInformationHead">Total information</div>
|
<div class="spacer_box_title i18n-replaced" data-i18n="missionTotalInformationHead">Total information</div>
|
||||||
|
@ -63,6 +64,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="missionPlanerSettings" class="gui_box grey" style="display: none">
|
<div id="missionPlanerSettings" class="gui_box grey" style="display: none">
|
||||||
<div class="gui_box_titlebar">
|
<div class="gui_box_titlebar">
|
||||||
<div class="spacer_box_title i18n-replaced" data-i18n="missionDefaultSettingsHead">Default settings</div>
|
<div class="spacer_box_title i18n-replaced" data-i18n="missionDefaultSettingsHead">Default settings</div>
|
||||||
|
@ -86,7 +88,37 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- CR8 -->
|
||||||
|
<div id="missionPlannerMultiMission" class="gui_box grey" style="display: none">
|
||||||
|
<div class="gui_box_titlebar">
|
||||||
|
<div class="spacer_box_title i18n-replaced" data-i18n="missionSafehomeHead">Multi Mission Manager</div>
|
||||||
|
<div class="btnMenu btnMenuIcon save_btn">
|
||||||
|
<div id="showHideMultimissionButton">
|
||||||
|
<a class="ic_hide" href="#" title="Hide"></a>
|
||||||
|
</div>
|
||||||
|
<a id="cancelMultimission" class="ic_cancel" href="#" title="Cancel"></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="spacer" id="multimissionContent">
|
||||||
|
<div style="display: inline-block">
|
||||||
|
<label>Mission Info: </label>
|
||||||
|
<span id="multimissionInfo">None</span>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="btn btnTable btnTableIcon save_btn" style="display: inline-block">
|
||||||
|
<label for="multimissionOptionList">Mission Number </label>
|
||||||
|
<select name="Number" id="multimissionOptionList">
|
||||||
|
<option value="0">ALL</option>
|
||||||
|
</select>
|
||||||
|
<a class="ic_save disabled" id="updateMultimissionButton" href="#" title="Update All" style="float: right"></a>
|
||||||
|
</div>
|
||||||
|
<div class="btn btnTable btnTableIcon save_btn" style="padding-top: 4px; float: left">
|
||||||
|
<label for="addMultimissionButton">Add New Mission</label>
|
||||||
|
<a class="ic_add disabled" id="addMultimissionButton" href="#" title="Add"></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- CR8 -->
|
||||||
<div id="missionPlanerHome" class="gui_box grey" style="display: none">
|
<div id="missionPlanerHome" class="gui_box grey" style="display: none">
|
||||||
<div class="gui_box_titlebar">
|
<div class="gui_box_titlebar">
|
||||||
<div class="spacer_box_title i18n-replaced" data-i18n="missionHomeHead">Take Off home</div>
|
<div class="spacer_box_title i18n-replaced" data-i18n="missionHomeHead">Take Off home</div>
|
||||||
|
@ -110,13 +142,13 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="homeTableBody">
|
<tbody id="homeTableBody">
|
||||||
<tr>
|
<tr>
|
||||||
<td><div id="viewHomePoint" class="btnTable btnTableIcon">
|
<td><div id="viewHomePoint" class="btnTable btnTableIcon">
|
||||||
<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-lon" /></td>
|
<td><input type="number" class="home-lon" /></td>
|
||||||
<td><input type="number" class="home-lat" /></td>
|
<td><input type="number" class="home-lat" /></td>
|
||||||
<td><span id="elevationValueAtHome">N/A</span></td>
|
<td><span id="elevationValueAtHome">N/A</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -180,8 +212,8 @@
|
||||||
<div id="showHideWPeditButton" class="save_btn">
|
<div id="showHideWPeditButton" class="save_btn">
|
||||||
<a class="ic_hide" href="#" title="Hide"></a>
|
<a class="ic_hide" href="#" title="Hide"></a>
|
||||||
</div>
|
</div>
|
||||||
<div id="removePoint" class="btnMenu-danger">
|
<!-- CR8 --> <div id="removePoint" class="btn btnMenu-danger">
|
||||||
<a class="ic_removeAll" href="#" title="Remove"></a>
|
<!-- CR8 --> <a id="removePointButton" class="ic_removeAll" href="#" title="Remove"></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -238,8 +270,8 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 30px">
|
<th style="width: 30px">
|
||||||
<div id="addOptionsPoint" class="btnTable btnTableIcon btnTable-success">
|
<!-- CR8 --> <div id="addOptionsPoint" class="btn btnTable btnTableIcon btnTable-success">
|
||||||
<a class="ic_add" data-role="waypointOptions-add" href="#" style="float: center" title="Add"></a>
|
<!-- CR8 --> <a id="addOptionsPointButton" class="ic_add" data-role="waypointOptions-add" href="#" style="float: center" title="Add"></a>
|
||||||
</div>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
<th style="width: 50px" data-i18n="WaypointOptionId"></th>
|
<th style="width: 50px" data-i18n="WaypointOptionId"></th>
|
||||||
|
|
|
@ -347,7 +347,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
var markers = []; // Layer for Waypoints
|
var markers = []; // Layer for Waypoints
|
||||||
var lines = []; // Layer for lines between waypoints
|
var lines = []; // Layer for lines between waypoints
|
||||||
var safehomeMarkers =[]; // layer for Safehome points
|
var safehomeMarkers = []; // layer for Safehome points
|
||||||
|
|
||||||
var map;
|
var map;
|
||||||
|
|
||||||
|
@ -357,6 +357,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
var selectedMarker = null;
|
var selectedMarker = null;
|
||||||
var selectedFeature = null;
|
var selectedFeature = null;
|
||||||
var tempMarker = null;
|
var tempMarker = null;
|
||||||
|
var disableMarkerEdit = false; // CR8
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// define & init parameters for default Settings
|
// define & init parameters for default Settings
|
||||||
|
@ -379,11 +380,19 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
vMaxDistSH = 0;
|
vMaxDistSH = 0;
|
||||||
settings = { speed: 0, alt: 5000, safeRadiusSH : 50, maxDistSH : vMaxDistSH};
|
settings = { speed: 0, alt: 5000, safeRadiusSH : 50, maxDistSH : vMaxDistSH};
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// define & init Waypoints parameters
|
// define & init Waypoints parameters
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
var mission = new WaypointCollection();
|
var mission = new WaypointCollection();
|
||||||
|
// CR8
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// define & init Multi Mission parameters
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
var multimission = new WaypointCollection();
|
||||||
|
var multimissionCount = 0;
|
||||||
|
var maxMultimissionCount = 9;
|
||||||
|
// CR8
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// define & init home parameters
|
// define & init home parameters
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -481,7 +490,6 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
|
|
||||||
const $row = $safehomesTableBody.find('tr:last');
|
const $row = $safehomesTableBody.find('tr:last');
|
||||||
|
|
||||||
|
|
||||||
$row.find(".safehome-number").text(safehome.getNumber()+1);
|
$row.find(".safehome-number").text(safehome.getNumber()+1);
|
||||||
|
|
||||||
$row.find(".safehome-enabled-value").prop('checked',safehome.isUsed()).change(function () {
|
$row.find(".safehome-enabled-value").prop('checked',safehome.isUsed()).change(function () {
|
||||||
|
@ -734,6 +742,225 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
renderHomeOnMap();
|
renderHomeOnMap();
|
||||||
plotElevation();
|
plotElevation();
|
||||||
}
|
}
|
||||||
|
// CR8
|
||||||
|
/////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Manage Multi Mission
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////
|
||||||
|
/* Multi Mission uses a 'multimission' waypoint collection as a repository for all missions loaded. 'mission' WP
|
||||||
|
* collection remains as the WP source used for the map display.
|
||||||
|
* All missions can be displayed on the map or only a single mission. With all missions displayed 'mission' and
|
||||||
|
* 'multimission' both contain all missions. When a single mission is displayed 'multimission' contains all
|
||||||
|
* missions except the currently displayed mission and 'mission' only contains the currently displayed mission.
|
||||||
|
* On update to display all missions the current dislayed mission is merged back into 'multimission' and 'mission'
|
||||||
|
* updated as a copy of 'multimission'.
|
||||||
|
* When all missions are displayed WP data can be viewed but mission edit is disabled.
|
||||||
|
* Mission WPs can be edited only when a single mission is loaded on the map. */
|
||||||
|
|
||||||
|
var startWPCount = 0;
|
||||||
|
|
||||||
|
function renderMultimissionTable() {
|
||||||
|
$('#multimissionOptionList').prop('options').length = 1;
|
||||||
|
for (var i = 1; i <= multimissionCount; i++) {
|
||||||
|
$('#multimissionOptionList').append($('<option>', {value: i, text: i}));
|
||||||
|
}
|
||||||
|
updateMultimissionState();
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateMultimissionState() {
|
||||||
|
if (!mission.isEmpty() || multimissionCount) {
|
||||||
|
if (multimissionCount < maxMultimissionCount) {
|
||||||
|
$("#addMultimissionButton").removeClass('disabled');
|
||||||
|
} else {
|
||||||
|
$("#addMultimissionButton").addClass('disabled');
|
||||||
|
}
|
||||||
|
if (multimissionCount) {
|
||||||
|
let totalmultimissionWPs = multimission.get().length + mission.get().length;
|
||||||
|
if (multimissionAllWPLoaded()) {
|
||||||
|
$('#missionDistance').text('N/A');
|
||||||
|
totalmultimissionWPs = mission.get().length;
|
||||||
|
$("#updateMultimissionButton").addClass('disabled');
|
||||||
|
}
|
||||||
|
$('#multimissionInfo').text(multimissionCount + ' missions (' + totalmultimissionWPs + '/' + mission.getMaxWaypoints() + ' WPs)');
|
||||||
|
} else {
|
||||||
|
$('#multimissionInfo').text('No multi missions loaded');
|
||||||
|
$('#cancelMultimission').trigger('click');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$("#addMultimissionButton").addClass('disabled');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateAllMultimission(missionDelete = false) {
|
||||||
|
// flag if new MM mission empty at update
|
||||||
|
let missionIsEmptyOnUpdate = mission.isEmpty() ? true : false;
|
||||||
|
|
||||||
|
var i = startWPCount;
|
||||||
|
if (!missionDelete) { // if mission set for delete update MM without adding in currently loaded mission
|
||||||
|
mission.get().forEach(function (element) {
|
||||||
|
multimission.get().splice(i, 0, element);
|
||||||
|
i++;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
multimission.get().forEach(function (element) { // renumber MM WPs
|
||||||
|
element.setNumber(i);
|
||||||
|
i++;
|
||||||
|
});
|
||||||
|
multimission.update();
|
||||||
|
// multimission.missionDisplayDebug();
|
||||||
|
|
||||||
|
mission.reinit();
|
||||||
|
mission.copy(multimission);
|
||||||
|
mission.update();
|
||||||
|
// mission.missionDisplayDebug();
|
||||||
|
|
||||||
|
/* Remove empty missions at update.
|
||||||
|
* Cancel MM if only 2 MM missions loaded and one mission is empty */
|
||||||
|
if (missionIsEmptyOnUpdate) {
|
||||||
|
multimissionCount -= multimissionCount == 2 ? 2 : 1;
|
||||||
|
if (!multimissionCount) {
|
||||||
|
multimissionCount = 0;
|
||||||
|
multimission.flush();
|
||||||
|
}
|
||||||
|
renderMultimissionTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedMarker = null;
|
||||||
|
clearEditForm();
|
||||||
|
setView(14);
|
||||||
|
refreshLayers();
|
||||||
|
updateTotalInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
function editMultimission() {
|
||||||
|
var MMCount = 0;
|
||||||
|
var endWPCount = 0;
|
||||||
|
var found = false;
|
||||||
|
startWPCount = 0;
|
||||||
|
mission.get().forEach(function (element) {
|
||||||
|
if (element.getEndMission() == 0xA5 && !found) {
|
||||||
|
MMCount ++;
|
||||||
|
endWPCount = element.getNumber();
|
||||||
|
if (MMCount == Number($('#multimissionOptionList').val())) {
|
||||||
|
found = true;
|
||||||
|
} else {
|
||||||
|
startWPCount = endWPCount + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mission.reinit();
|
||||||
|
tempMissionData = multimission.get().slice(startWPCount, endWPCount + 1); // copy selected single mission from MM
|
||||||
|
let i = 0;
|
||||||
|
tempMissionData.forEach(function (element) { // write copied mission to active mission
|
||||||
|
mission.put(element);
|
||||||
|
mission.get()[i].setNumber(i);
|
||||||
|
i++;
|
||||||
|
});
|
||||||
|
multimission.get().splice(startWPCount, (endWPCount - startWPCount + 1)) // cut current mission from MM
|
||||||
|
|
||||||
|
mission.update();
|
||||||
|
selectedMarker = null;
|
||||||
|
clearEditForm();
|
||||||
|
setView(14);
|
||||||
|
refreshLayers();
|
||||||
|
updateTotalInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
function mapSelectEditMultimission(WPNumber) {
|
||||||
|
let MMCount = 1;
|
||||||
|
|
||||||
|
mission.get().forEach(function (element) {
|
||||||
|
if (element.getEndMission() == 0xA5 && element.getNumber() < WPNumber) {
|
||||||
|
MMCount ++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#multimissionOptionList').val(MMCount).change();
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteMultimission() {
|
||||||
|
updateAllMultimission(true);
|
||||||
|
multimissionCount -= multimissionCount == 2 ? 2 : 1;
|
||||||
|
if (!multimissionCount) {
|
||||||
|
multimission.flush();
|
||||||
|
} else {
|
||||||
|
setMultimissionEditControl(false);
|
||||||
|
}
|
||||||
|
renderMultimissionTable();
|
||||||
|
|
||||||
|
$("#updateMultimissionButton").addClass('disabled');
|
||||||
|
}
|
||||||
|
|
||||||
|
function addMultimission() {
|
||||||
|
if (Number($('#multimissionOptionList').val()) || !multimissionCount) {
|
||||||
|
updateAllMultimission();
|
||||||
|
}
|
||||||
|
multimissionCount += !multimissionCount ? 2 : 1;
|
||||||
|
renderMultimissionTable();
|
||||||
|
$('#multimissionOptionList').val(multimissionCount);
|
||||||
|
|
||||||
|
removeAllWaypoints();
|
||||||
|
startWPCount = multimission.get().length;
|
||||||
|
|
||||||
|
$("#updateMultimissionButton").removeClass('disabled');
|
||||||
|
setMultimissionEditControl(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeAllMultiMissionCheck() {
|
||||||
|
if (!multimissionCount) return true;
|
||||||
|
|
||||||
|
if (!multimissionAllWPLoaded()) {
|
||||||
|
deleteMultimission();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
multimissionCount = 0;
|
||||||
|
multimission.flush();
|
||||||
|
renderMultimissionTable();
|
||||||
|
|
||||||
|
setMultimissionEditControl(true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function fileLoadMultiMissionCheck() {
|
||||||
|
if (!multimissionCount || !multimissionAllWPLoaded()) return true;
|
||||||
|
|
||||||
|
if (multimissionAllWPLoaded() && confirm(chrome.i18n.getMessage('confirm_overwrite_multimission_file_load_option'))) {
|
||||||
|
nwdialog.setContext(document);
|
||||||
|
nwdialog.openFileDialog(function(result) {
|
||||||
|
loadMissionFile(result);
|
||||||
|
multimissionCount = 0;
|
||||||
|
multimission.flush();
|
||||||
|
renderMultimissionTable();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function multimissionAllWPLoaded() {
|
||||||
|
return Number($('#multimissionOptionList').val()) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setMultimissionEditControl(enabled = true) {
|
||||||
|
if (enabled) {
|
||||||
|
disableMarkerEdit = false;
|
||||||
|
$("*", "#MPeditPoint").prop('disabled',false);
|
||||||
|
$("#addOptionsPointButton").removeClass('disabled');
|
||||||
|
$("#removePointButton").removeClass('disabled');
|
||||||
|
$("#waypointOptionsTableBody").fadeIn();
|
||||||
|
} else {
|
||||||
|
disableMarkerEdit = true;
|
||||||
|
$("*", "#MPeditPoint").prop('disabled',true);
|
||||||
|
$("#addOptionsPointButton").addClass('disabled');
|
||||||
|
$("#removePointButton").addClass('disabled');
|
||||||
|
$("#waypointOptionsTableBody").fadeOut();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// CR8
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Manage Waypoint
|
// Manage Waypoint
|
||||||
|
@ -742,7 +969,8 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
|
|
||||||
function removeAllWaypoints() {
|
function removeAllWaypoints() {
|
||||||
mission.reinit();
|
mission.reinit();
|
||||||
cleanLayers();
|
refreshLayers(); // CR8
|
||||||
|
// cleanLayers();
|
||||||
clearEditForm();
|
clearEditForm();
|
||||||
updateTotalInfo();
|
updateTotalInfo();
|
||||||
clearFilename();
|
clearFilename();
|
||||||
|
@ -811,7 +1039,8 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
let oldPos,
|
let oldPos,
|
||||||
oldAction,
|
oldAction,
|
||||||
poiList = [],
|
poiList = [],
|
||||||
oldHeading;
|
oldHeading,
|
||||||
|
multiMissionWPNum = 0; // CR8
|
||||||
let activatePoi = false;
|
let activatePoi = false;
|
||||||
let activateHead = false;
|
let activateHead = false;
|
||||||
$('#missionDistance').text(0);
|
$('#missionDistance').text(0);
|
||||||
|
@ -843,12 +1072,25 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
else if (typeof oldPos !== 'undefined' && activatePoi != true && activateHead == true) {
|
else if (typeof oldPos !== 'undefined' && activatePoi != true && activateHead == true) {
|
||||||
paintLine(oldPos, coord, element.getNumber(), color='#1497f1', lineDash=0, lineText=String(oldHeading)+"°");
|
paintLine(oldPos, coord, element.getNumber(), color='#1497f1', lineDash=0, lineText=String(oldHeading)+"°");
|
||||||
}
|
}
|
||||||
oldPos = coord;
|
// CR8
|
||||||
|
if (element.getEndMission() == 0xA5) {
|
||||||
|
oldPos = 'undefined';
|
||||||
|
activatePoi = false;
|
||||||
|
activateHead = false;
|
||||||
|
multiMissionWPNum = element.getNumber() + 1;
|
||||||
|
} else {
|
||||||
|
oldPos = coord;
|
||||||
|
}
|
||||||
|
// CR8
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (element.isAttached()) {
|
else if (element.isAttached()) {
|
||||||
if (element.getAction() == MWNP.WPTYPE.JUMP) {
|
if (element.getAction() == MWNP.WPTYPE.JUMP) {
|
||||||
let coord = ol.proj.fromLonLat([mission.getWaypoint(element.getP1()).getLonMap(), mission.getWaypoint(element.getP1()).getLatMap()]);
|
// CR8
|
||||||
|
let jumpWPIndex = 0;
|
||||||
|
jumpWPIndex = multiMissionWPNum + element.getP1();
|
||||||
|
let coord = ol.proj.fromLonLat([mission.getWaypoint(jumpWPIndex).getLonMap(), mission.getWaypoint(jumpWPIndex).getLatMap()]);
|
||||||
|
// CR8
|
||||||
paintLine(oldPos, coord, element.getNumber(), color='#e935d6', lineDash=5, lineText="Repeat x"+(element.getP2() == -1 ? " infinite" : String(element.getP2())), selection=false, arrow=true);
|
paintLine(oldPos, coord, element.getNumber(), color='#e935d6', lineDash=5, lineText="Repeat x"+(element.getP2() == -1 ? " infinite" : String(element.getP2())), selection=false, arrow=true);
|
||||||
}
|
}
|
||||||
// If classic WPs is defined with a heading = -1, change Boolean for POI to false. If it is defined with a value different from -1, activate Heading boolean
|
// If classic WPs is defined with a heading = -1, change Boolean for POI to false. If it is defined with a value different from -1, activate Heading boolean
|
||||||
|
@ -864,6 +1106,14 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
oldHeading = String(element.getP1());
|
oldHeading = String(element.getP1());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// CR8
|
||||||
|
if (element.getEndMission() == 0xA5) {
|
||||||
|
oldPos = 'undefined';
|
||||||
|
activatePoi = false;
|
||||||
|
activateHead = false;
|
||||||
|
multiMissionWPNum = element.getNumber() + 1;
|
||||||
|
}
|
||||||
|
// CR8
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//reset text position
|
//reset text position
|
||||||
|
@ -871,6 +1121,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
textGeom.setCoordinates(map.getCoordinateFromPixel([0,0]));
|
textGeom.setCoordinates(map.getCoordinateFromPixel([0,0]));
|
||||||
}
|
}
|
||||||
let lengthMission = mission.getDistance(true);
|
let lengthMission = mission.getDistance(true);
|
||||||
|
|
||||||
$('#missionDistance').text(lengthMission[lengthMission.length -1] != -1 ? lengthMission[lengthMission.length -1].toFixed(1) : 'infinite');
|
$('#missionDistance').text(lengthMission[lengthMission.length -1] != -1 ? lengthMission[lengthMission.length -1].toFixed(1) : 'infinite');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -920,7 +1171,6 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (arrow) {
|
if (arrow) {
|
||||||
var vectorSource = new ol.source.Vector({
|
var vectorSource = new ol.source.Vector({
|
||||||
features: [feature, featureArrow]
|
features: [feature, featureArrow]
|
||||||
|
@ -948,7 +1198,12 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
|
|
||||||
map.addLayer(vectorLayer);
|
map.addLayer(vectorLayer);
|
||||||
}
|
}
|
||||||
|
// CR8
|
||||||
|
function refreshLayers() {
|
||||||
|
cleanLayers();
|
||||||
|
redrawLayers();
|
||||||
|
}
|
||||||
|
// CR8
|
||||||
function cleanLayers() {
|
function cleanLayers() {
|
||||||
for (var i in lines) {
|
for (var i in lines) {
|
||||||
map.removeLayer(lines[i]);
|
map.removeLayer(lines[i]);
|
||||||
|
@ -975,8 +1230,8 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
map.addLayer(addWaypointMarker(element));
|
map.addLayer(addWaypointMarker(element));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
repaintLine4Waypoints(mission); // CR9
|
||||||
}
|
}
|
||||||
repaintLine4Waypoints(mission);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function redrawLayer() {
|
function redrawLayer() {
|
||||||
|
@ -1020,19 +1275,19 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
GUI.fillSelect($row.find(".waypointOptions-action"), waypointOptions, waypointOptions.indexOf(MWNP.WPTYPE.REV[element.getAction()]));
|
GUI.fillSelect($row.find(".waypointOptions-action"), waypointOptions, waypointOptions.indexOf(MWNP.WPTYPE.REV[element.getAction()]));
|
||||||
|
|
||||||
$row.find(".waypointOptions-action").val(waypointOptions.indexOf(MWNP.WPTYPE.REV[element.getAction()])).change(function () {
|
$row.find(".waypointOptions-action").val(waypointOptions.indexOf(MWNP.WPTYPE.REV[element.getAction()])).change(function () {
|
||||||
element.setAction(MWNP.WPTYPE[waypointOptions[$(this).val()]]);
|
element.setAction(MWNP.WPTYPE[waypointOptions[$(this).val()]]);
|
||||||
for (var i = 1; i <= 3; i++) {
|
for (var i = 1; i <= 3; i++) {
|
||||||
if (dictOfLabelParameterPoint[element.getAction()]['parameter'+String(i)] != '') {
|
if (dictOfLabelParameterPoint[element.getAction()]['parameter'+String(i)] != '') {
|
||||||
$row.find(".waypointOptions-p"+String(i)).prop("disabled", false);
|
$row.find(".waypointOptions-p"+String(i)).prop("disabled", false);
|
||||||
}
|
|
||||||
else {
|
|
||||||
$row.find(".waypointOptions-p"+String(i)).prop("disabled", true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mission.updateWaypoint(element);
|
else {
|
||||||
cleanLines();
|
$row.find(".waypointOptions-p"+String(i)).prop("disabled", true);
|
||||||
redrawLayer();
|
}
|
||||||
});
|
}
|
||||||
|
mission.updateWaypoint(element);
|
||||||
|
cleanLines();
|
||||||
|
redrawLayer();
|
||||||
|
});
|
||||||
|
|
||||||
$row.find(".waypointOptions-number").text(element.getAttachedNumber()+1);
|
$row.find(".waypointOptions-number").text(element.getAttachedNumber()+1);
|
||||||
|
|
||||||
|
@ -1092,7 +1347,13 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
localize();
|
localize();
|
||||||
return waypoint;
|
return waypoint;
|
||||||
}
|
}
|
||||||
|
// CR8
|
||||||
|
function setView(zoom) {
|
||||||
|
var coord = ol.proj.fromLonLat([mission.getWaypoint(0).getLonMap(), mission.getWaypoint(0).getLatMap()]);
|
||||||
|
map.getView().setCenter(coord);
|
||||||
|
map.getView().setZoom(zoom);
|
||||||
|
}
|
||||||
|
// CR8
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Manage Map construction
|
// Manage Map construction
|
||||||
|
@ -1217,7 +1478,6 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
element: element,
|
element: element,
|
||||||
target: options.target
|
target: options.target
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
ol.inherits(app.PlannerSafehomeControl, ol.control.Control);
|
ol.inherits(app.PlannerSafehomeControl, ol.control.Control);
|
||||||
|
|
||||||
|
@ -1254,21 +1514,56 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
element: element,
|
element: element,
|
||||||
target: options.target
|
target: options.target
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
ol.inherits(app.PlannerElevationControl, ol.control.Control);
|
ol.inherits(app.PlannerElevationControl, ol.control.Control);
|
||||||
|
|
||||||
|
// CR8
|
||||||
|
// /**
|
||||||
|
// * @constructor
|
||||||
|
// * @extends {ol.control.Control}
|
||||||
|
// * @param {Object=} opt_options Control options.
|
||||||
|
// */
|
||||||
|
app.PlannerMultiMissionControl = function (opt_options) {
|
||||||
|
var options = opt_options || {};
|
||||||
|
var button = document.createElement('button');
|
||||||
|
|
||||||
|
button.innerHTML = ' ';
|
||||||
|
button.style = 'background: url(\'../images/icons/cf_icon_multimission_white.svg\') no-repeat 1px -1px;background-color: rgba(0,60,136,.5);';
|
||||||
|
|
||||||
|
var handleShowSettings = function () {
|
||||||
|
$('#missionPlannerMultiMission').fadeIn(300);
|
||||||
|
};
|
||||||
|
|
||||||
|
button.addEventListener('click', handleShowSettings, false);
|
||||||
|
button.addEventListener('touchstart', handleShowSettings, false);
|
||||||
|
|
||||||
|
var element = document.createElement('div');
|
||||||
|
element.className = 'mission-control-multimission ol-unselectable ol-control';
|
||||||
|
element.appendChild(button);
|
||||||
|
element.title = 'MP MultiMission';
|
||||||
|
|
||||||
|
ol.control.Control.call(this, {
|
||||||
|
element: element,
|
||||||
|
target: options.target
|
||||||
|
});
|
||||||
|
};
|
||||||
|
ol.inherits(app.PlannerMultiMissionControl, ol.control.Control);
|
||||||
|
// CR8
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.MapBrowserEvent} evt Map browser event.
|
* @param {ol.MapBrowserEvent} evt Map browser event.
|
||||||
* @return {boolean} `true` to start the drag sequence.
|
* @return {boolean} `true` to start the drag sequence.
|
||||||
*/
|
*/
|
||||||
app.Drag.prototype.handleDownEvent = function (evt) {
|
app.Drag.prototype.handleDownEvent = function (evt) {
|
||||||
|
if (disableMarkerEdit) return false; // CR8
|
||||||
|
|
||||||
var map = evt.map;
|
var map = evt.map;
|
||||||
|
|
||||||
var feature = map.forEachFeatureAtPixel(evt.pixel,
|
var feature = map.forEachFeatureAtPixel(evt.pixel,
|
||||||
function (feature, layer) {
|
function (feature, layer) {
|
||||||
return feature;
|
return feature;
|
||||||
});
|
});
|
||||||
|
|
||||||
tempMarker = map.forEachFeatureAtPixel(evt.pixel,
|
tempMarker = map.forEachFeatureAtPixel(evt.pixel,
|
||||||
function (feature, layer) {
|
function (feature, layer) {
|
||||||
return layer;
|
return layer;
|
||||||
|
@ -1299,7 +1594,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
|
|
||||||
var geometry = /** @type {ol.geom.SimpleGeometry} */
|
var geometry = /** @type {ol.geom.SimpleGeometry} */
|
||||||
(this.feature_.getGeometry());
|
(this.feature_.getGeometry());
|
||||||
if (tempMarker.kind == "waypoint" ||tempMarker.kind == "safehome" || tempMarker.kind == "home") {
|
if ((tempMarker.kind == "waypoint") || tempMarker.kind == "safehome" || tempMarker.kind == "home") {
|
||||||
geometry.translate(deltaX, deltaY);
|
geometry.translate(deltaX, deltaY);
|
||||||
this.coordinate_[0] = evt.coordinate[0];
|
this.coordinate_[0] = evt.coordinate[0];
|
||||||
this.coordinate_[1] = evt.coordinate[1];
|
this.coordinate_[1] = evt.coordinate[1];
|
||||||
|
@ -1331,7 +1626,6 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
$('.home-lon').val(Math.round(coord[0] * 10000000) / 10000000);
|
$('.home-lon').val(Math.round(coord[0] * 10000000) / 10000000);
|
||||||
$('.home-lat').val(Math.round(coord[1] * 10000000) / 10000000);
|
$('.home-lat').val(Math.round(coord[1] * 10000000) / 10000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1362,7 +1656,7 @@ 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()) {
|
if (selectedMarker != null && tempMarker.number == selectedMarker.getLayerNumber()) {
|
||||||
(async () => {
|
(async () => {
|
||||||
const elevationAtWP = await mission.getWaypoint(tempMarker.number).getElevation(globalSettings);
|
const elevationAtWP = await mission.getWaypoint(tempMarker.number).getElevation(globalSettings);
|
||||||
|
@ -1409,6 +1703,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
if (CONFIGURATOR.connectionValid) {
|
if (CONFIGURATOR.connectionValid) {
|
||||||
control_list = [
|
control_list = [
|
||||||
new app.PlannerSettingsControl(),
|
new app.PlannerSettingsControl(),
|
||||||
|
new app.PlannerMultiMissionControl(), // CR8
|
||||||
new app.PlannerSafehomeControl(),
|
new app.PlannerSafehomeControl(),
|
||||||
new app.PlannerElevationControl(),
|
new app.PlannerElevationControl(),
|
||||||
]
|
]
|
||||||
|
@ -1416,8 +1711,9 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
else {
|
else {
|
||||||
control_list = [
|
control_list = [
|
||||||
new app.PlannerSettingsControl(),
|
new app.PlannerSettingsControl(),
|
||||||
|
new app.PlannerMultiMissionControl(), // CR8
|
||||||
new app.PlannerElevationControl(),
|
new app.PlannerElevationControl(),
|
||||||
//new app.PlannerSafehomeControl() // TO COMMENT FOR RELEASE : DECOMMENT FOR DEBUG
|
// new app.PlannerSafehomeControl() // TO COMMENT FOR RELEASE : DECOMMENT FOR DEBUG
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1468,6 +1764,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
map.getView().setZoom(result.missionPlanerLastValues.zoom);
|
map.getView().setZoom(result.missionPlanerLastValues.zoom);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// Map on-click behavior definition
|
// Map on-click behavior definition
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1525,7 +1822,6 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
$('#pointP2').val(selectedMarker.getP2());
|
$('#pointP2').val(selectedMarker.getP2());
|
||||||
changeSwitchery($('#pointP3'), selectedMarker.getP3() == 1);
|
changeSwitchery($('#pointP3'), selectedMarker.getP3() == 1);
|
||||||
|
|
||||||
|
|
||||||
// Selection box update depending on choice of type of waypoint
|
// Selection box update depending on choice of type of waypoint
|
||||||
for (var j in dictOfLabelParameterPoint[selectedMarker.getAction()]) {
|
for (var j in dictOfLabelParameterPoint[selectedMarker.getAction()]) {
|
||||||
if (dictOfLabelParameterPoint[selectedMarker.getAction()][j] != '') {
|
if (dictOfLabelParameterPoint[selectedMarker.getAction()][j] != '') {
|
||||||
|
@ -1539,7 +1835,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
$('#MPeditPoint').fadeIn(300);
|
$('#MPeditPoint').fadeIn(300);
|
||||||
redrawLayer();
|
redrawLayer();
|
||||||
}
|
}
|
||||||
else if (selectedFeature && tempMarker.kind == "line" && tempMarker.selection) {
|
else if (selectedFeature && tempMarker.kind == "line" && tempMarker.selection && !disableMarkerEdit) { // CR8
|
||||||
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));
|
||||||
if (homeMarkers.length && HOME.getAlt() != "N/A") {
|
if (homeMarkers.length && HOME.getAlt() != "N/A") {
|
||||||
|
@ -1549,15 +1845,13 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
|
|
||||||
mission.insertWaypoint(tempWp, tempMarker.number);
|
mission.insertWaypoint(tempWp, tempMarker.number);
|
||||||
mission.update();
|
mission.update();
|
||||||
cleanLayers();
|
refreshLayers(); // CR8
|
||||||
redrawLayers();
|
|
||||||
plotElevation();
|
plotElevation();
|
||||||
})()
|
})()
|
||||||
} else {
|
} else {
|
||||||
mission.insertWaypoint(tempWp, tempMarker.number);
|
mission.insertWaypoint(tempWp, tempMarker.number);
|
||||||
mission.update();
|
mission.update();
|
||||||
cleanLayers();
|
refreshLayers(); // CR8
|
||||||
redrawLayers();
|
|
||||||
plotElevation();
|
plotElevation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1576,7 +1870,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
$('.home-lon').val(Math.round(coord[0] * 10000000) / 10000000);
|
$('.home-lon').val(Math.round(coord[0] * 10000000) / 10000000);
|
||||||
$('.home-lat').val(Math.round(coord[1] * 10000000) / 10000000);
|
$('.home-lat').val(Math.round(coord[1] * 10000000) / 10000000);
|
||||||
}
|
}
|
||||||
else {
|
else if (!disableMarkerEdit) { // CR8
|
||||||
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));
|
||||||
if (homeMarkers.length && HOME.getAlt() != "N/A") {
|
if (homeMarkers.length && HOME.getAlt() != "N/A") {
|
||||||
|
@ -1586,21 +1880,30 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
|
|
||||||
mission.put(tempWp);
|
mission.put(tempWp);
|
||||||
mission.update();
|
mission.update();
|
||||||
cleanLayers();
|
refreshLayers(); // CR8
|
||||||
redrawLayers();
|
|
||||||
plotElevation();
|
plotElevation();
|
||||||
})()
|
})()
|
||||||
} else {
|
} else {
|
||||||
mission.put(tempWp);
|
mission.put(tempWp);
|
||||||
mission.update();
|
mission.update();
|
||||||
cleanLayers();
|
refreshLayers(); // CR8
|
||||||
redrawLayers();
|
|
||||||
plotElevation();
|
plotElevation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//mission.missionDisplayDebug();
|
//mission.missionDisplayDebug();
|
||||||
|
updateMultimissionState(); // CR8
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// CR8
|
||||||
|
map.on('dblclick', function () {
|
||||||
|
if (!(multimissionCount && multimissionAllWPLoaded()) || selectedMarker == null) return;
|
||||||
|
|
||||||
|
mapSelectEditMultimission(selectedMarker.getNumber());
|
||||||
|
updateMultimissionState();
|
||||||
|
});
|
||||||
|
// CR8
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// change mouse cursor when over marker
|
// change mouse cursor when over marker
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1701,6 +2004,19 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#showHideMultimissionButton').on('click', function () {
|
||||||
|
var src = ($(this).children().attr('class') === 'ic_hide')
|
||||||
|
? 'ic_show'
|
||||||
|
: 'ic_hide';
|
||||||
|
$(this).children().attr('class', src);
|
||||||
|
if ($(this).children().attr('class') === 'ic_hide') {
|
||||||
|
$('#multimissionContent').fadeIn(300);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#multimissionContent').fadeOut(300);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
// Callback for Waypoint edition
|
// Callback for Waypoint edition
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
|
@ -1729,8 +2045,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
selectedMarker.setLat(Math.round(Number($('#pointLat').val()) * 10000000));
|
selectedMarker.setLat(Math.round(Number($('#pointLat').val()) * 10000000));
|
||||||
mission.updateWaypoint(selectedMarker);
|
mission.updateWaypoint(selectedMarker);
|
||||||
mission.update();
|
mission.update();
|
||||||
cleanLayers();
|
refreshLayers(); // CR8
|
||||||
redrawLayers();
|
|
||||||
selectedFeature = markers[selectedMarker.getLayerNumber()].getSource().getFeatures()[0];
|
selectedFeature = markers[selectedMarker.getLayerNumber()].getSource().getFeatures()[0];
|
||||||
selectedFeature.setStyle(getWaypointIcon(selectedMarker, true));
|
selectedFeature.setStyle(getWaypointIcon(selectedMarker, true));
|
||||||
plotElevation();
|
plotElevation();
|
||||||
|
@ -1742,8 +2057,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
selectedMarker.setLon(Math.round(Number($('#pointLon').val()) * 10000000));
|
selectedMarker.setLon(Math.round(Number($('#pointLon').val()) * 10000000));
|
||||||
mission.updateWaypoint(selectedMarker);
|
mission.updateWaypoint(selectedMarker);
|
||||||
mission.update();
|
mission.update();
|
||||||
cleanLayers();
|
refreshLayers(); // CR8
|
||||||
redrawLayers();
|
|
||||||
selectedFeature = markers[selectedMarker.getLayerNumber()].getSource().getFeatures()[0];
|
selectedFeature = markers[selectedMarker.getLayerNumber()].getSource().getFeatures()[0];
|
||||||
selectedFeature.setStyle(getWaypointIcon(selectedMarker, true));
|
selectedFeature.setStyle(getWaypointIcon(selectedMarker, true));
|
||||||
plotElevation();
|
plotElevation();
|
||||||
|
@ -1781,6 +2095,11 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#pointP3').on('change', function (event) {
|
$('#pointP3').on('change', function (event) {
|
||||||
|
// CR8
|
||||||
|
if (disableMarkerEdit) {
|
||||||
|
changeSwitchery($('#pointP3'), selectedMarker.getP3() == 1);
|
||||||
|
}
|
||||||
|
// CR8
|
||||||
if (selectedMarker) {
|
if (selectedMarker) {
|
||||||
const P3Value = selectedMarker.getP3();
|
const P3Value = selectedMarker.getP3();
|
||||||
selectedMarker.setP3( $('#pointP3').prop("checked") ? 1.0 : 0.0);
|
selectedMarker.setP3( $('#pointP3').prop("checked") ? 1.0 : 0.0);
|
||||||
|
@ -1820,8 +2139,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
mission.dropAttachedFromWaypoint(selectedMarker, $(event.currentTarget).attr("data-index")-1);
|
mission.dropAttachedFromWaypoint(selectedMarker, $(event.currentTarget).attr("data-index")-1);
|
||||||
renderWaypointOptionsTable(selectedMarker);
|
renderWaypointOptionsTable(selectedMarker);
|
||||||
//cleanLines();
|
//cleanLines();
|
||||||
cleanLayers();
|
refreshLayers(); // CR8
|
||||||
redrawLayers();
|
|
||||||
selectedFeature = markers[selectedMarker.getLayerNumber()].getSource().getFeatures()[0];
|
selectedFeature = markers[selectedMarker.getLayerNumber()].getSource().getFeatures()[0];
|
||||||
selectedFeature.setStyle(getWaypointIcon(selectedMarker, true));
|
selectedFeature.setStyle(getWaypointIcon(selectedMarker, true));
|
||||||
}
|
}
|
||||||
|
@ -1832,8 +2150,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
mission.addAttachedFromWaypoint(selectedMarker);
|
mission.addAttachedFromWaypoint(selectedMarker);
|
||||||
renderWaypointOptionsTable(selectedMarker);
|
renderWaypointOptionsTable(selectedMarker);
|
||||||
//cleanLines();
|
//cleanLines();
|
||||||
cleanLayers();
|
refreshLayers(); // CR8
|
||||||
redrawLayers();
|
|
||||||
selectedFeature = markers[selectedMarker.getLayerNumber()].getSource().getFeatures()[0];
|
selectedFeature = markers[selectedMarker.getLayerNumber()].getSource().getFeatures()[0];
|
||||||
selectedFeature.setStyle(getWaypointIcon(selectedMarker, true));
|
selectedFeature.setStyle(getWaypointIcon(selectedMarker, true));
|
||||||
}
|
}
|
||||||
|
@ -1922,12 +2239,58 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// CR8
|
||||||
|
/////////////////////////////////////////////
|
||||||
|
// Callback for MULTIMISSION Table
|
||||||
|
/////////////////////////////////////////////
|
||||||
|
$('#multimissionOptionList').on('change', function () {
|
||||||
|
if (multimissionAllWPLoaded()) {
|
||||||
|
updateAllMultimission();
|
||||||
|
|
||||||
|
$("#updateMultimissionButton").addClass('disabled');
|
||||||
|
setMultimissionEditControl(multimissionCount ? false : true);
|
||||||
|
updateMultimissionState();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
// only update all missions when a single mission is loaded on map
|
||||||
|
var missions = 0;
|
||||||
|
mission.get().forEach(function (element) {
|
||||||
|
missions += element.getEndMission() == 0xA5 ? 1 : 0;
|
||||||
|
});
|
||||||
|
if (missions == 1) updateAllMultimission();
|
||||||
|
|
||||||
|
$("#updateMultimissionButton").removeClass('disabled');
|
||||||
|
setMultimissionEditControl(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
editMultimission();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#addMultimissionButton').on('click', function () {
|
||||||
|
addMultimission();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#updateMultimissionButton').on('click', function () {
|
||||||
|
$('#multimissionOptionList').val('0').change();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#cancelMultimission').on('click', function () {
|
||||||
|
$('#missionPlannerMultiMission').fadeOut(300);
|
||||||
|
});
|
||||||
|
// CR8
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
// Callback for Remove buttons
|
// Callback for Remove buttons
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
$('#removeAllPoints').on('click', function () {
|
$('#removeAllPoints').on('click', function () {
|
||||||
if (markers.length && confirm(chrome.i18n.getMessage('confirm_delete_all_points'))) {
|
if (markers.length && confirm(chrome.i18n.getMessage('confirm_delete_all_points'))) {
|
||||||
removeAllWaypoints();
|
// CR8
|
||||||
|
if (removeAllMultiMissionCheck()) {
|
||||||
|
removeAllWaypoints();
|
||||||
|
|
||||||
|
updateMultimissionState();
|
||||||
|
}
|
||||||
|
// CR8
|
||||||
plotElevation();
|
plotElevation();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1947,8 +2310,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
selectedMarker = null;
|
selectedMarker = null;
|
||||||
mission.update();
|
mission.update();
|
||||||
clearEditForm();
|
clearEditForm();
|
||||||
cleanLayers();
|
refreshLayers(); // CR8
|
||||||
redrawLayers();
|
|
||||||
plotElevation();
|
plotElevation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1957,20 +2319,19 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
selectedMarker = null;
|
selectedMarker = null;
|
||||||
mission.update();
|
mission.update();
|
||||||
clearEditForm();
|
clearEditForm();
|
||||||
cleanLayers();
|
refreshLayers(); // CR8
|
||||||
redrawLayers();
|
|
||||||
plotElevation();
|
plotElevation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
// Callback for Save/load buttons
|
// Callback for Save/load buttons
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
$('#loadFileMissionButton').on('click', function () {
|
$('#loadFileMissionButton').on('click', function () {
|
||||||
|
if (!fileLoadMultiMissionCheck()) return; // CR8
|
||||||
|
|
||||||
if (markers.length && !confirm(chrome.i18n.getMessage('confirm_delete_all_points'))) return;
|
if (markers.length && !confirm(chrome.i18n.getMessage('confirm_delete_all_points'))) return;
|
||||||
removeAllWaypoints();
|
|
||||||
nwdialog.setContext(document);
|
nwdialog.setContext(document);
|
||||||
nwdialog.openFileDialog(function(result) {
|
nwdialog.openFileDialog(function(result) {
|
||||||
loadMissionFile(result);
|
loadMissionFile(result);
|
||||||
|
@ -1993,7 +2354,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#saveMissionButton').on('click', function () {
|
$('#saveMissionButton').on('click', function () {
|
||||||
if (!mission.get().length) {
|
if (mission.isEmpty()) { // CR8
|
||||||
alert(chrome.i18n.getMessage('no_waypoints_to_save'));
|
alert(chrome.i18n.getMessage('no_waypoints_to_save'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2011,7 +2372,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#saveEepromMissionButton').on('click', function () {
|
$('#saveEepromMissionButton').on('click', function () {
|
||||||
if (!mission.get().length) {
|
if (mission.isEmpty()) { // CR8
|
||||||
alert(chrome.i18n.getMessage('no_waypoints_to_save'));
|
alert(chrome.i18n.getMessage('no_waypoints_to_save'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2040,8 +2401,6 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
closeSettingsPanel();
|
closeSettingsPanel();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
updateTotalInfo();
|
updateTotalInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2070,6 +2429,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
|
|
||||||
// parse mission file
|
// parse mission file
|
||||||
removeAllWaypoints();
|
removeAllWaypoints();
|
||||||
|
missionEndFlagCount = 0; // CR8
|
||||||
var node = null;
|
var node = null;
|
||||||
var nodemission = null;
|
var nodemission = null;
|
||||||
for (var noderoot in result) {
|
for (var noderoot in result) {
|
||||||
|
@ -2136,7 +2496,14 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
point.setP2(parseInt(node.$[attr]));
|
point.setP2(parseInt(node.$[attr]));
|
||||||
} else if (attr.match(/parameter3/i)) {
|
} else if (attr.match(/parameter3/i)) {
|
||||||
point.setP3(parseInt(node.$[attr]));
|
point.setP3(parseInt(node.$[attr]));
|
||||||
|
// CR8
|
||||||
|
} else if (attr.match(/flag/i)) {
|
||||||
|
point.setEndMission(parseInt(node.$[attr]));
|
||||||
|
if (parseInt(node.$[attr]) == 0xA5) {
|
||||||
|
missionEndFlagCount ++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// CR8
|
||||||
}
|
}
|
||||||
mission.put(point);
|
mission.put(point);
|
||||||
}
|
}
|
||||||
|
@ -2146,6 +2513,22 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
// update Attached Waypoints (i.e non Map Markers)
|
// update Attached Waypoints (i.e non Map Markers)
|
||||||
mission.update(true);
|
mission.update(true);
|
||||||
|
// CR8
|
||||||
|
if (missionEndFlagCount > 1) {
|
||||||
|
if (multimissionCount && !confirm(chrome.i18n.getMessage('confirm_multimission_file_load'))) {
|
||||||
|
mission.flush();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
multimissionCount = missionEndFlagCount;
|
||||||
|
multimission.reinit();
|
||||||
|
multimission.copy(mission);
|
||||||
|
renderMultimissionTable();
|
||||||
|
$('#missionPlannerMultiMission').fadeIn(300);
|
||||||
|
setMultimissionEditControl(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateMultimissionState();
|
||||||
|
// CR8
|
||||||
if (Object.keys(mission.getCenter()).length !== 0) {
|
if (Object.keys(mission.getCenter()).length !== 0) {
|
||||||
var coord = ol.proj.fromLonLat([mission.getCenter().lon / 10000000 , mission.getCenter().lat / 10000000]);
|
var coord = ol.proj.fromLonLat([mission.getCenter().lon / 10000000 , mission.getCenter().lat / 10000000]);
|
||||||
map.getView().setCenter(coord);
|
map.getView().setCenter(coord);
|
||||||
|
@ -2157,9 +2540,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var coord = ol.proj.fromLonLat([mission.getWaypoint(0).getLonMap(), mission.getWaypoint(0).getLatMap()]);
|
setView(16); // CR8
|
||||||
map.getView().setCenter(coord);
|
|
||||||
map.getView().setZoom(16);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
redrawLayers();
|
redrawLayers();
|
||||||
|
@ -2201,6 +2582,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
'parameter1': (MWNP.WPTYPE.REV[waypoint.getAction()] == "JUMP" ? waypoint.getP1()+1 : waypoint.getP1()),
|
'parameter1': (MWNP.WPTYPE.REV[waypoint.getAction()] == "JUMP" ? waypoint.getP1()+1 : waypoint.getP1()),
|
||||||
'parameter2': waypoint.getP2(),
|
'parameter2': waypoint.getP2(),
|
||||||
'parameter3': waypoint.getP3(),
|
'parameter3': waypoint.getP3(),
|
||||||
|
'flag': waypoint.getEndMission(), // CR8
|
||||||
} };
|
} };
|
||||||
data.missionitem.push(point);
|
data.missionitem.push(point);
|
||||||
});
|
});
|
||||||
|
@ -2221,7 +2603,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Load/Save FC mission Toolbox
|
// Load/Save FC mission Toolbox
|
||||||
//
|
// mission = configurator store, WP number indexed from 0, MISSION_PLANER = FC NVM store, WP number indexed from 1
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
function getWaypointsFromFC(loadEeprom) {
|
function getWaypointsFromFC(loadEeprom) {
|
||||||
if (loadEeprom) {
|
if (loadEeprom) {
|
||||||
|
@ -2246,9 +2628,25 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
mission.reinit();
|
mission.reinit();
|
||||||
mission.copy(MISSION_PLANER);
|
mission.copy(MISSION_PLANER);
|
||||||
mission.update(true);
|
mission.update(true);
|
||||||
var coord = ol.proj.fromLonLat([mission.getWaypoint(0).getLonMap(), mission.getWaypoint(0).getLatMap()]);
|
// CR8
|
||||||
map.getView().setCenter(coord);
|
multimissionCount = 0;
|
||||||
map.getView().setZoom(16);
|
let missionEndFlagCount = 0;
|
||||||
|
mission.get().forEach(function (element) {
|
||||||
|
if (element.getEndMission() == 0xA5) {
|
||||||
|
missionEndFlagCount ++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (missionEndFlagCount > 1) {
|
||||||
|
multimissionCount = missionEndFlagCount;
|
||||||
|
multimission.reinit();
|
||||||
|
multimission.copy(mission);
|
||||||
|
renderMultimissionTable();
|
||||||
|
$('#missionPlannerMultiMission').fadeIn(300);
|
||||||
|
setMultimissionEditControl(false);
|
||||||
|
}
|
||||||
|
updateMultimissionState();
|
||||||
|
setView(16);
|
||||||
|
// CR8
|
||||||
redrawLayers();
|
redrawLayers();
|
||||||
updateTotalInfo();
|
updateTotalInfo();
|
||||||
});
|
});
|
||||||
|
@ -2275,22 +2673,19 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
mission.reinit();
|
mission.reinit();
|
||||||
mission.copy(MISSION_PLANER);
|
mission.copy(MISSION_PLANER);
|
||||||
mission.update(true);
|
mission.update(true);
|
||||||
cleanLayers();
|
refreshLayers(); // CR8
|
||||||
redrawLayers();
|
|
||||||
$('#MPeditPoint').fadeOut(300);
|
$('#MPeditPoint').fadeOut(300);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function updateTotalInfo() {
|
function updateTotalInfo() {
|
||||||
if (CONFIGURATOR.connectionValid) {
|
if (CONFIGURATOR.connectionValid) {
|
||||||
$('#availablePoints').text(mission.getCountBusyPoints() + '/' + mission.getMaxWaypoints());
|
let availableWPs = mission.getMaxWaypoints() - mission.getCountBusyPoints(); // CR8
|
||||||
|
$('#availablePoints').text(availableWPs + '/' + mission.getMaxWaypoints());
|
||||||
$('#missionValid').html(mission.getValidMission() ? chrome.i18n.getMessage('armingCheckPass') : chrome.i18n.getMessage('armingCheckFail'));
|
$('#missionValid').html(mission.getValidMission() ? chrome.i18n.getMessage('armingCheckPass') : chrome.i18n.getMessage('armingCheckFail'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function updateFilename(filename) {
|
function updateFilename(filename) {
|
||||||
$('#missionFilename').text(filename);
|
$('#missionFilename').text(filename);
|
||||||
$('#infoMissionFilename').show();
|
$('#infoMissionFilename').show();
|
||||||
|
@ -2339,8 +2734,8 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function plotElevation() {
|
function plotElevation() {
|
||||||
if ($('#missionPlanerElevation').is(":visible")) {
|
if ($('#missionPlanerElevation').is(":visible") && !disableMarkerEdit) { // CR8
|
||||||
if (mission.get().length == 0) {
|
if (mission.isEmpty()) { // CR8
|
||||||
var data = [[0], [0]];
|
var data = [[0], [0]];
|
||||||
var layout = {showlegend: true,
|
var layout = {showlegend: true,
|
||||||
legend: {
|
legend: {
|
||||||
|
@ -2427,6 +2822,16 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// window.addEventListener("error", handleError, true);
|
||||||
|
|
||||||
|
// function handleError(evt) {
|
||||||
|
// if (evt.message) { // Chrome sometimes provides this
|
||||||
|
// alert("error: "+evt.message +" at linenumber: "+evt.lineno+" of file: "+evt.filename);
|
||||||
|
// } else {
|
||||||
|
// alert("error: "+evt.type+" from element: "+(evt.srcElement || evt.target));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
TABS.mission_control.cleanup = function (callback) {
|
TABS.mission_control.cleanup = function (callback) {
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
};
|
};
|
||||||
|
|
29
tabs/osd.js
29
tabs/osd.js
|
@ -480,7 +480,7 @@ OSD.DjiElements = {
|
||||||
"LONGITUDE",
|
"LONGITUDE",
|
||||||
"LATITUDE",
|
"LATITUDE",
|
||||||
"DIRECTION_TO_HOME",
|
"DIRECTION_TO_HOME",
|
||||||
"DISTANCE_TO_HOME"
|
"DISTANCE_TO_HOME"
|
||||||
],
|
],
|
||||||
emptyGroups: [
|
emptyGroups: [
|
||||||
"MapsAndRadars",
|
"MapsAndRadars",
|
||||||
|
@ -507,7 +507,7 @@ OSD.DjiElements = {
|
||||||
"3D_SPEED",
|
"3D_SPEED",
|
||||||
"EFFICIENCY_MAH",
|
"EFFICIENCY_MAH",
|
||||||
"TRIP_DIST"
|
"TRIP_DIST"
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
OSD.constants = {
|
OSD.constants = {
|
||||||
|
@ -784,7 +784,7 @@ OSD.constants = {
|
||||||
// Metric
|
// Metric
|
||||||
return FONT.symbol(SYM.TRIP_DIST) + FONT.symbol(SYM.DIST_KM) + FONT.embed_dot('1.57');
|
return FONT.symbol(SYM.TRIP_DIST) + FONT.symbol(SYM.DIST_KM) + FONT.embed_dot('1.57');
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
switch (OSD.data.preferences.units) {
|
switch (OSD.data.preferences.units) {
|
||||||
case 0: // Imperial
|
case 0: // Imperial
|
||||||
|
@ -908,6 +908,13 @@ OSD.constants = {
|
||||||
min_version: '3.0.0',
|
min_version: '3.0.0',
|
||||||
preview: FONT.symbol(SYM.GLIDESLOPE) + FONT.embed_dot('12.3'),
|
preview: FONT.symbol(SYM.GLIDESLOPE) + FONT.embed_dot('12.3'),
|
||||||
},
|
},
|
||||||
|
// CR8
|
||||||
|
{
|
||||||
|
name: 'MISSION INFO',
|
||||||
|
id: 128,
|
||||||
|
preview: 'M1/6>27WP'
|
||||||
|
},
|
||||||
|
// CR8
|
||||||
{
|
{
|
||||||
name: 'VERSION',
|
name: 'VERSION',
|
||||||
id: 119,
|
id: 119,
|
||||||
|
@ -2455,8 +2462,8 @@ OSD.GUI.updateFields = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#djiUnsupportedElements').prepend(
|
$('#djiUnsupportedElements').prepend(
|
||||||
$('<input type="checkbox" class="toggle" />')
|
$('<input type="checkbox" class="toggle" />')
|
||||||
.attr('checked', OSD.data.isDjiHdFpv)
|
.attr('checked', OSD.data.isDjiHdFpv)
|
||||||
.on('change', function () {
|
.on('change', function () {
|
||||||
OSD.GUI.updateDjiView(this.checked);
|
OSD.GUI.updateDjiView(this.checked);
|
||||||
OSD.GUI.updatePreviews();
|
OSD.GUI.updatePreviews();
|
||||||
|
@ -2486,7 +2493,7 @@ OSD.GUI.removeBottomLines = function(){
|
||||||
|
|
||||||
OSD.GUI.updateDjiMessageElements = function(on) {
|
OSD.GUI.updateDjiMessageElements = function(on) {
|
||||||
$('.display-field').each(function(index, element) {
|
$('.display-field').each(function(index, element) {
|
||||||
var name = $(element).find('input').attr('name');
|
var name = $(element).find('input').attr('name');
|
||||||
if (OSD.DjiElements.craftNameElements.includes(name)) {
|
if (OSD.DjiElements.craftNameElements.includes(name)) {
|
||||||
if (on) {
|
if (on) {
|
||||||
$(element)
|
$(element)
|
||||||
|
@ -2494,7 +2501,7 @@ OSD.GUI.updateDjiMessageElements = function(on) {
|
||||||
.show();
|
.show();
|
||||||
} else if ($('#djiUnsupportedElements').find('input').is(':checked')) {
|
} else if ($('#djiUnsupportedElements').find('input').is(':checked')) {
|
||||||
$(element).hide();
|
$(element).hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!on) {
|
if (!on) {
|
||||||
|
@ -2507,7 +2514,7 @@ OSD.GUI.updateDjiMessageElements = function(on) {
|
||||||
OSD.GUI.updateDjiView = function(on) {
|
OSD.GUI.updateDjiView = function(on) {
|
||||||
if (on) {
|
if (on) {
|
||||||
$(OSD.DjiElements.emptyGroups).each(function(index, groupName) {
|
$(OSD.DjiElements.emptyGroups).each(function(index, groupName) {
|
||||||
$('#osdGroup' + groupName).hide();
|
$('#osdGroup' + groupName).hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
var displayFields = $('.display-field');
|
var displayFields = $('.display-field');
|
||||||
|
@ -2520,10 +2527,10 @@ OSD.GUI.updateDjiView = function(on) {
|
||||||
|
|
||||||
var settings = $('.settings-container').find('.settings').children();
|
var settings = $('.settings-container').find('.settings').children();
|
||||||
settings.each(function(index, element) {
|
settings.each(function(index, element) {
|
||||||
var name = $(element).attr('class');
|
var name = $(element).attr('class');
|
||||||
if (!OSD.DjiElements.supportedSettings.includes(name)) {
|
if (!OSD.DjiElements.supportedSettings.includes(name)) {
|
||||||
$(element).hide();
|
$(element).hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var alarms = $('.alarms-container').find('.settings').children();
|
var alarms = $('.alarms-container').find('.settings').children();
|
||||||
|
@ -2535,7 +2542,7 @@ OSD.GUI.updateDjiView = function(on) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$(OSD.DjiElements.emptyGroups).each(function(index, groupName) {
|
$(OSD.DjiElements.emptyGroups).each(function(index, groupName) {
|
||||||
$('#osdGroup' + groupName).show();
|
$('#osdGroup' + groupName).show();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.display-field')
|
$('.display-field')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue