mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-16 12:55:13 +03:00
Update MSPHelper.js
This commit is contained in:
parent
bfeb8ff33d
commit
075e4a6f3d
1 changed files with 27 additions and 28 deletions
|
@ -2988,32 +2988,30 @@ var mspHelper = (function (gui) {
|
|||
|
||||
self.loadWaypoints = function (callback) {
|
||||
MISSION_PLANER.reinit();
|
||||
let waypointId = 1;
|
||||
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, getFirstWP);
|
||||
let waypointId = 0;
|
||||
let startTime = new Date().getTime();
|
||||
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, loadWaypoint);
|
||||
|
||||
function getFirstWP() {
|
||||
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, nextWaypoint)
|
||||
};
|
||||
|
||||
function nextWaypoint() {
|
||||
function loadWaypoint() {
|
||||
waypointId++;
|
||||
if (waypointId < MISSION_PLANER.getCountBusyPoints()) {
|
||||
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, nextWaypoint);
|
||||
}
|
||||
else {
|
||||
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, loadWaypoint);
|
||||
} else {
|
||||
GUI.log('Receive time: ' + (new Date().getTime() - startTime) + 'ms');
|
||||
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, callback);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
self.saveWaypoints = function (callback) {
|
||||
let waypointId = 1;
|
||||
MSP.send_message(MSPCodes.MSP_SET_WP, MISSION_PLANER.extractBuffer(waypointId), false, nextWaypoint)
|
||||
let waypointId = 0;
|
||||
let startTime = new Date().getTime();
|
||||
sendWaypoint();
|
||||
|
||||
function nextWaypoint() {
|
||||
function sendWaypoint() {
|
||||
waypointId++;
|
||||
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 {
|
||||
MSP.send_message(MSPCodes.MSP_SET_WP, MISSION_PLANER.extractBuffer(waypointId), false, endMission);
|
||||
|
@ -3021,6 +3019,7 @@ var mspHelper = (function (gui) {
|
|||
};
|
||||
|
||||
function endMission() {
|
||||
GUI.log('Send time: ' + (new Date().getTime() - startTime) + 'ms');
|
||||
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, callback);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue