some minor bugs correction

pull/1173/head
ArnoTlse 4 years ago
parent 5fde0022a5
commit 1169f64ade

@ -3123,6 +3123,9 @@
},
"missionDefaultSettingsHead": {
"message": "Default settings"
},
"missionTemplateHead": {
"message": "Mission template"
},
"useOnlyStandalone": {
"message": "Use stand-alone application.<br> Please visit the <a href=\"https://github.com/iNavFlight/inav-configurator/releases\" target=\"_blank\">website</a> to read the release notes and download."

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.0"
id="svg5730"
sodipodi:docname="CF_template_white.svg"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
x="0px"
y="0px"
viewBox="0 0 141.7 141.7"
enable-background="new 0 0 141.7 141.7"
xml:space="preserve"
inkscape:export-filename="C:\Users\arnau\Documents\GitHub\inav-configurator\images\CF_settings_white.png"
inkscape:export-xdpi="74"
inkscape:export-ydpi="74"><metadata
id="metadata13"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>CF_Settings_Icon</dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs11"><marker
style="overflow:visible"
id="Arrow1Lstart"
refX="0.0"
refY="0.0"
orient="auto"
inkscape:stockid="Arrow1Lstart"
inkscape:isstock="true"><path
transform="scale(0.8) translate(12.5,0)"
style="fill-rule:evenodd;stroke:#ffffff;stroke-width:1pt;stroke-opacity:1;fill:#ffffff;fill-opacity:1"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
id="path888" /></marker></defs>
<title
id="title5799">CF_Settings_Icon</title>
<sodipodi:namedview
id="namedview5733"
inkscape:window-width="1368"
inkscape:window-y="-6"
inkscape:window-x="-6"
inkscape:pageopacity="0"
fit-margin-right="0"
inkscape:pageshadow="2"
inkscape:window-height="850"
inkscape:current-layer="layer3"
fit-margin-bottom="0"
inkscape:window-maximized="1"
gridtolerance="10"
inkscape:zoom="3.3714885"
fit-margin-left="0"
bordercolor="#666666"
inkscape:cx="60.994685"
inkscape:cy="76.88531"
fit-margin-top="0"
borderopacity="1"
objecttolerance="10"
guidetolerance="10"
showgrid="false"
pagecolor="#ffffff"
inkscape:document-rotation="0"
inkscape:snap-page="false"
showguides="false">
</sodipodi:namedview>
<g
inkscape:groupmode="layer"
id="layer1"
inkscape:label="Layer 1"
style="display:none"><rect
style="fill:#000000;stroke:#000000;stroke-width:1.53423;stroke-opacity:0"
id="rect867"
width="141.7"
height="141.7"
x="1.7763568e-14"
y="0" /></g><g
inkscape:groupmode="layer"
id="layer3"
inkscape:label="Layer 3"
style="display:inline"><path
style="fill:none;stroke:#ffffff;stroke-width:11.3821;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:100;stroke-opacity:1"
d="m 14.495066,29.47847 h 25.804626 v 90.99432 h 29.06728 V 30.279006 h 30.253699 v 92.328544 h 27.584259"
id="path1250" /></g></svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

@ -26,7 +26,14 @@
</div>
</div>
</div>
<div id="missionPalnerTotalInfo" class="gui_box grey">
<!--<div id="missionPlanerTemplate" class="gui_box grey" style="display: none">
<div class="gui_box_titlebar">
<div class="spacer_box_title i18n-replaced" data-i18n="missionTemplateHead">Mission Template</div>
</div>
<div class="spacer">
</div>
</div>-->
<div id="missionPlanerTotalInfo" class="gui_box grey">
<div class="gui_box_titlebar">
<div class="spacer_box_title i18n-replaced" data-i18n="missionTotalInformationHead">Total information</div>
</div>

@ -607,7 +607,7 @@ TABS.mission_control.initialize = function (callback) {
button.style = 'background: url(\'../images/CF_settings_white.svg\') no-repeat 1px -1px;background-color: rgba(0,60,136,.5);';
var handleShowSettings = function () {
$('#MPeditPoint, #missionPalnerTotalInfo').hide();
$('#MPeditPoint, #missionPlanerTotalInfo','#missionPlanerTemplate').hide();
$('#missionPlanerSettings').fadeIn(300);
};
@ -627,25 +627,26 @@ TABS.mission_control.initialize = function (callback) {
};
ol.inherits(app.PlannerSettingsControl, ol.control.Control);
/**
* @constructor
* @extends {ol.control.Control}
* @param {Object=} opt_options Control options.
*/
app.PlannerTemplateControl = function (opt_options) {
/*app.PlannerTemplateControl = function (opt_options) {
var options = opt_options || {};
var button = document.createElement('button');
button.innerHTML = ' ';
button.style = 'background: url(\'../images/CF_settings_white.svg\') no-repeat 1px -1px;background-color: rgba(0,60,136,.5);';
button.style = 'background: url(\'../images/CF_template_white.svg\') no-repeat 1px -1px;background-color: rgba(0,60,136,.5);';
var handleShowSettings = function () {
$('#MPeditPoint, #missionPalnerTotalInfo', '#missionPlanerSettings').hide();
$('#missionPlanerSettings').fadeIn(300);
var handleShowTemplate = function () {
$('#MPeditPoint, #missionPlanerTotalInfo', '#missionPlanerSettings').hide();
$('#missionPlanerTemplate').fadeIn(300);
};
button.addEventListener('click', handleShowSettings, false);
button.addEventListener('touchstart', handleShowSettings, false);
button.addEventListener('click', handleShowTemplate, false);
button.addEventListener('touchstart', handleShowTemplate, false);
var element = document.createElement('div');
element.className = 'mission-control-template ol-unselectable ol-control';
@ -659,7 +660,7 @@ TABS.mission_control.initialize = function (callback) {
};
ol.inherits(app.PlannerTemplateControl, ol.control.Control);
*/
/**
* @param {ol.MapBrowserEvent} evt Map browser event.
@ -764,7 +765,7 @@ TABS.mission_control.initialize = function (callback) {
}
}).extend([
new app.PlannerSettingsControl(),
new app.PlannerTemplateControl()
//new app.PlannerTemplateControl()
]),
interactions: ol.interaction.defaults().extend([new app.Drag()]),
layers: [
@ -847,6 +848,7 @@ TABS.mission_control.initialize = function (callback) {
$('#pointP2').val(selectedMarker.parameter2);
$('#pointP3').val(selectedMarker.parameter3);
$('[name=Options]').filter('[value='+selectedMarker.options['key']+']').prop('checked', true);
// Manage RTH, JUMP, SET_HEAD options for WP
if (selectedMarker.options.key == "RTH") {
console.log(selectedMarker.options.landAfter);
$('#Options_LandRTH').prop('checked', selectedMarker.options.landAfter);
@ -868,8 +870,6 @@ TABS.mission_control.initialize = function (callback) {
}
else {$('#pointP'+String(j).slice(-1)+'class').fadeOut(300);}
}
console.log(selectedMarker.action);
console.log(typeof selectedMarker.action);
if ([1,2,3,8].includes(selectedMarker.action) || ['1','2','3','8'].includes(selectedMarker.action)) {
$('#pointOptionclass').fadeIn(300);
}
@ -932,6 +932,7 @@ TABS.mission_control.initialize = function (callback) {
}
});
// SavePoint function updated to take into account P1 to P3 parameter and JUMP,RTH, SET_HEAD options for WP
$('#savePoint').on('click', function () {
if (selectedMarker) {
map.getLayers().forEach(function (t) {
@ -940,18 +941,23 @@ TABS.mission_control.initialize = function (callback) {
geometry.setCoordinates(ol.proj.fromLonLat([parseFloat($('#pointLon').val()), parseFloat($('#pointLat').val())]));
t.alt = $('#pointAlt').val();
t.action = $('#pointType').val();
console.log(typeof t.action);
if (t.action == '5' || t.action == '2' || t.action == '8') {
t.P1Value = 0;
t.P2Value = 0;
t.P3Value = 0;
}
else {
t.P1Value = $('#pointP1').val();
t.P2Value = $('#pointP2').val();
t.P3Value = $('#pointP3').val();
}
if ($('input[name=Options]:checked').val() == "RTH") {
t.options = {key: $('input[name=Options]:checked').val(),
landAfter: $('#Options_LandRTH').prop('checked')
};
}
else if ($('input[name=Options]:checked').val() == "JUMP") {
console.log(Array.from({length: markers.length}, (v, i) => i+1));
console.log($('#Options_TargetJUMP').val());
console.log(typeof $('#Options_TargetJUMP').val());
if (!Array.from({length: markers.length}, (v, i) => i+1).includes(Number($('#Options_TargetJUMP').val())) || (Number($('#Options_NumberJUMP').val())<0 || Number($('#Options_NumberJUMP').val())>99)) {
alert(chrome.i18n.getMessage('MissionPlannerJumpSettingsCheck'))
t.options = {key: 'None'}
@ -977,7 +983,6 @@ TABS.mission_control.initialize = function (callback) {
else {
t.options = {key: $('input[name=Options]:checked').val()}
}
console.log(t.options);
}
});
@ -1035,6 +1040,7 @@ TABS.mission_control.initialize = function (callback) {
MSP.send_message(MSPCodes.MSP_WP_MISSION_SAVE, [0], false);
});
// RTH missions commented as integrated into WP options direclty
/*$('#rthEndMission').on('change', function () {
if ($(this).is(':checked')) {
$('#rthSettings').fadeIn(300);
@ -1054,6 +1060,7 @@ TABS.mission_control.initialize = function (callback) {
closeSettingsPanel();
});
// Add function to update parameter i field in the selected Edit WP Box
$('#pointType').on('change', function () {
selectedMarker.action = $('#pointType').val();
@ -1077,7 +1084,7 @@ TABS.mission_control.initialize = function (callback) {
function closeSettingsPanel() {
$('#missionPlanerSettings').hide();
$('#missionPalnerTotalInfo').fadeIn(300);
$('#missionPlanerTotalInfo').fadeIn(300);
if (selectedMarker !== null) {
$('#MPeditPoint').fadeIn(300);
}
@ -1090,6 +1097,7 @@ TABS.mission_control.initialize = function (callback) {
markers = [];
clearEditForm();
updateTotalInfo();
// RTH section commented as RTH options is integrated into WP box
/*$('#rthEndMission').prop('checked', false);
$('#rthSettings').fadeOut(300);
$('#rthLanding').prop('checked', false);*/
@ -1187,7 +1195,7 @@ TABS.mission_control.initialize = function (callback) {
// draw actual mission
removeAllPoints();
console.log(mission);
// Updated code to take into account WP options (JUMP, SET_HEAD, RTH)
for (var i = 0; i < mission.points.length; i++) {
if ([MWNP.WPTYPE.WAYPOINT,MWNP.WPTYPE.PH_UNLIM,MWNP.WPTYPE.PH_TIME,MWNP.WPTYPE.LAND, MWNP.WPTYPE.SET_POI].includes(mission.points[i].action)) {
if (i < mission.points.length-1) {
@ -1260,13 +1268,21 @@ TABS.mission_control.initialize = function (callback) {
for (var i = 0; i < markers.length; i++) {
var geometry = markers[i].getSource().getFeatures()[0].getGeometry();
var coordinate = ol.proj.toLonLat(geometry.getCoordinates());
/*var point = { $: {
'no': (i + 1),
'action': ((markers[i].action == MWNP.WPTYPE.WAYPOINT) ? 'WAYPOINT' : markers[i].action),
if (markers[i].action == '5' || markers[i].action == '2' || markers[i].action == '8' ) {
var point = { $: {
'no': (j),
'action': MWNP.WPTYPE.REV[markers[i].action],
'lon': (Math.round(coordinate[0] * 10000000) / 10000000),
'lat': (Math.round(coordinate[1] * 10000000) / 10000000),
'alt': (markers[i].alt / 100)
} };*/
'alt': (markers[i].alt / 100),
'parameter1': 0,
'parameter2': 0,
'parameter3': 0,
} };
data.missionitem.push(point);
j++;
}
else {
var point = { $: {
'no': (j),
'action': MWNP.WPTYPE.REV[markers[i].action],
@ -1277,14 +1293,11 @@ TABS.mission_control.initialize = function (callback) {
'parameter2': markers[i].parameter2,
'parameter3': markers[i].parameter3,
} };
//if ((markers[i].action == MWNP.WPTYPE.WAYPOINT) && (markers[i].parameter1 > 0)) point.$['parameter1'] = markers[i].parameter1; /*parameter1 = SpeedValue in this case*/
data.missionitem.push(point);
j++;
}
if (markers[i].options.key == "JUMP") {
nonMarkerPoint.push(i);
console.log(nonMarkerPoint);
console.log(Number(markers[i].options.targetWP));
console.log(getNumberOfNonMarkerForJump(nonMarkerPoint, Number(markers[i].options.targetWP)-1));
point = { $: {
'no': (j),
'action': 'JUMP',
@ -1330,7 +1343,7 @@ TABS.mission_control.initialize = function (callback) {
};
}
// add last RTH point
// add last RTH point - Section commented as RTH is directly integrated as a WP options
/*if ($('#rthEndMission').is(':checked')) {
data.missionitem.push({ $: { 'no': (markers.length + 1), 'action': 'RTH', 'lon': 0, 'lat': 0, 'alt': (settings.alt / 100), 'parameter1': ($('#rthLanding').is(':checked') ? 1 : 0) } });
}*/
@ -1345,13 +1358,10 @@ TABS.mission_control.initialize = function (callback) {
GUI.log('File saved');
});
}
// New function to get number of Non Marker point such as JUMP, SET_HEAD and RTH
function getNumberOfNonMarkerForJump(nonMarkerPointList, numTargetMarker) {
console.log(nonMarkerPointList.length);
for (i = 0; i < nonMarkerPointList.length; i++) {
console.log(String(nonMarkerPointList[i+1])+" "+String(nonMarkerPointList[i]));
if (numTargetMarker<=nonMarkerPointList[i+1] && numTargetMarker>nonMarkerPointList[i]) {
console.log(i+1);
return i+1;
}
else {

Loading…
Cancel
Save