|
|
@ -2988,32 +2988,30 @@ var mspHelper = (function (gui) {
|
|
|
|
|
|
|
|
|
|
|
|
self.loadWaypoints = function (callback) {
|
|
|
|
self.loadWaypoints = function (callback) {
|
|
|
|
MISSION_PLANER.reinit();
|
|
|
|
MISSION_PLANER.reinit();
|
|
|
|
let waypointId = 1;
|
|
|
|
let waypointId = 0;
|
|
|
|
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, getFirstWP);
|
|
|
|
let startTime = new Date().getTime();
|
|
|
|
|
|
|
|
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, loadWaypoint);
|
|
|
|
|
|
|
|
|
|
|
|
function getFirstWP() {
|
|
|
|
function loadWaypoint() {
|
|
|
|
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, 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, loadWaypoint);
|
|
|
|
}
|
|
|
|
} 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 = 0;
|
|
|
|
MSP.send_message(MSPCodes.MSP_SET_WP, MISSION_PLANER.extractBuffer(waypointId), false, nextWaypoint)
|
|
|
|
let startTime = new Date().getTime();
|
|
|
|
|
|
|
|
sendWaypoint();
|
|
|
|
|
|
|
|
|
|
|
|
function nextWaypoint() {
|
|
|
|
function sendWaypoint() {
|
|
|
|
waypointId++;
|
|
|
|
waypointId++;
|
|
|
|
if (waypointId < MISSION_PLANER.get().length) {
|
|
|
|
if (waypointId < MISSION_PLANER.get().length) {
|
|
|
|
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, sendWaypoint);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
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);
|
|
|
@ -3021,6 +3019,7 @@ var mspHelper = (function (gui) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|