1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-24 00:35:20 +03:00

MP version 1.1

This commit is contained in:
ArnoTlse 2021-05-13 13:11:04 +02:00
parent 162beea970
commit 8224e28a35
2 changed files with 22 additions and 9 deletions

View file

@ -335,6 +335,7 @@ let WaypointCollection = function () {
self.getDistance = function() { self.getDistance = function() {
let point2measure = [] let point2measure = []
let lengthLine = [] let lengthLine = []
let jumpDict = {};
let nStart = 0; let nStart = 0;
let nLoop = 0; let nLoop = 0;
let n = 0 ; let n = 0 ;
@ -350,15 +351,27 @@ let WaypointCollection = function () {
nStart++; nStart++;
} }
else if (self.getWaypoint(nStart).getAction() == MWNP.WPTYPE.JUMP) { else if (self.getWaypoint(nStart).getAction() == MWNP.WPTYPE.JUMP) {
if ((n>=nLoop && nLoop != 0) || self.getWaypoint(nStart).getP2() == 0) { console.log("TITI");
nStart++; console.log(jumpDict);
n = 0; if (!Object.keys(jumpDict).includes(self.getWaypoint(nStart).getNumber()) ) {
jumpDict[self.getWaypoint(nStart).getNumber()] = {nStart: self.getWaypoint(nStart).getP1(), nLoop : self.getWaypoint(nStart).getP2(), n : 0};
} }
else { console.log(jumpDict);
nLoop = self.getWaypoint(nStart).getP2(); if (Object.keys(jumpDict).includes(String(self.getWaypoint(nStart).getNumber())) ) {
nStart = self.getWaypoint(nStart).getP1(); console.log("TOTO");
n++; console.log((jumpDict[self.getWaypoint(nStart).getNumber()]["n"]>=jumpDict[self.getWaypoint(nStart).getNumber()]["nLoop"] || jumpDict[self.getWaypoint(nStart).getNumber()]["nLoop"] == 0));
if ( (jumpDict[self.getWaypoint(nStart).getNumber()]["n"]>=jumpDict[self.getWaypoint(nStart).getNumber()]["nLoop"] || jumpDict[self.getWaypoint(nStart).getNumber()]["nLoop"] ==0) ) {
nStart++;
//jumpDict[self.getWaypoint(nStart).getNumber()]["n"] = 0;
}
else {
jumpDict[self.getWaypoint(nStart).getNumber()]["n"]++;
console.log(jumpDict[self.getWaypoint(nStart).getNumber()]["nStart"]);
//nStart = 0; //jumpDict[self.getWaypoint(nStart).getNumber()]["nStart"];
}
} }
//nStart++;
console.log(jumpDict);
} }
else { else {
nStart++; nStart++;

View file

@ -751,8 +751,8 @@ TABS.mission_control.initialize = function (callback) {
if (textGeom) { if (textGeom) {
textGeom.setCoordinates(map.getCoordinateFromPixel([0,0])); textGeom.setCoordinates(map.getCoordinateFromPixel([0,0]));
} }
//let lengthMission = mission.getDistance(); let lengthMission = mission.getDistance();
//$('#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');
} }
function paintLine(pos1, pos2, pos2ID, color='#1497f1', lineDash=0, lineText="", selection=true) { function paintLine(pos1, pos2, pos2ID, color='#1497f1', lineDash=0, lineText="", selection=true) {