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

Waypoint OOP version 1.5

This commit is contained in:
ArnoTlse 2021-04-09 01:22:36 +02:00
parent 26f21b2880
commit 949e511d28
6 changed files with 237 additions and 290 deletions

View file

@ -2934,13 +2934,13 @@ var mspHelper = (function (gui) {
self.loadWaypoints = function (callback) {
MISSION_PLANER.flush();
getMissionInfo();
mspHelper.getMissionInfo();
let waypointId = 0;
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, nextWaypoint);
function nextWaypoint() {
waypointId++;
if (waypointId < SAFEHOMES.getMaxSafehomeCount()-1) {
if (waypointId < MISSION_PLANER.get().length-1) {
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, nextWaypoint);
}
else {
@ -2949,6 +2949,30 @@ var mspHelper = (function (gui) {
};
};
self.saveWaypoints = function (callback) {
let waypointId = 0;
console.log("saveWaypoints legth ",MISSION_PLANER.get().length);
console.log("WP Number : ",MISSION_PLANER.getWaypoint(waypointId).getNumber());
MSP.send_message(MSPCodes.MSP_SET_WP, MISSION_PLANER.extractBuffer(waypointId), false, nextWaypoint)
function nextWaypoint() {
waypointId++;
console.log("WP Number : ",MISSION_PLANER.getWaypoint(waypointId).getNumber());
console.log("End mission : ",MISSION_PLANER.getWaypoint(waypointId).getEndMission());
if (waypointId < MISSION_PLANER.get().length-1) {
MSP.send_message(MSPCodes.MSP_SET_WP, MISSION_PLANER.extractBuffer(waypointId), false, nextWaypoint);
}
else {
MSP.send_message(MSPCodes.MSP_SET_WP, MISSION_PLANER.extractBuffer(waypointId), false, endMission);
}
};
function endMission() {
GUI.log('End send point');
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, callback);
}
};
self.loadSafehomes = function (callback) {
SAFEHOMES.flush();
let safehomeId = 0;