mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 12:25:13 +03:00
planer to planner
This commit is contained in:
parent
bf3fc89e6d
commit
d0e1788318
5 changed files with 53 additions and 53 deletions
6
js/fc.js
6
js/fc.js
|
@ -30,7 +30,7 @@ var CONFIG,
|
|||
MOTOR_DATA,
|
||||
SERVO_DATA,
|
||||
GPS_DATA,
|
||||
MISSION_PLANER,
|
||||
MISSION_PLANNER,
|
||||
ANALOG,
|
||||
ARMING_CONFIG,
|
||||
FC_CONFIG,
|
||||
|
@ -246,7 +246,7 @@ var FC = {
|
|||
packetCount: 0
|
||||
};
|
||||
|
||||
/* MISSION_PLANER = {
|
||||
/* MISSION_PLANNER = {
|
||||
maxWaypoints: 0,
|
||||
isValidMission: 0,
|
||||
countBusyPoints: 0,
|
||||
|
@ -263,7 +263,7 @@ var FC = {
|
|||
}
|
||||
}; */
|
||||
|
||||
MISSION_PLANER = new WaypointCollection();
|
||||
MISSION_PLANNER = new WaypointCollection();
|
||||
|
||||
ANALOG = {
|
||||
voltage: 0,
|
||||
|
|
|
@ -447,7 +447,7 @@ var mspHelper = (function (gui) {
|
|||
}
|
||||
break;
|
||||
case MSPCodes.MSP_WP:
|
||||
MISSION_PLANER.put(new Waypoint(
|
||||
MISSION_PLANNER.put(new Waypoint(
|
||||
data.getUint8(0),
|
||||
data.getUint8(1),
|
||||
data.getInt32(2, true),
|
||||
|
@ -1422,9 +1422,9 @@ var mspHelper = (function (gui) {
|
|||
break;
|
||||
case MSPCodes.MSP_WP_GETINFO:
|
||||
// Reserved for waypoint capabilities data.getUint8(0);
|
||||
MISSION_PLANER.setMaxWaypoints(data.getUint8(1));
|
||||
MISSION_PLANER.setValidMission(data.getUint8(2));
|
||||
MISSION_PLANER.setCountBusyPoints(data.getUint8(3));
|
||||
MISSION_PLANNER.setMaxWaypoints(data.getUint8(1));
|
||||
MISSION_PLANNER.setValidMission(data.getUint8(2));
|
||||
MISSION_PLANNER.setCountBusyPoints(data.getUint8(3));
|
||||
break;
|
||||
case MSPCodes.MSP_SET_WP:
|
||||
console.log('Point saved');
|
||||
|
@ -2988,14 +2988,14 @@ var mspHelper = (function (gui) {
|
|||
};
|
||||
|
||||
self.loadWaypoints = function (callback) {
|
||||
MISSION_PLANER.reinit();
|
||||
MISSION_PLANNER.reinit();
|
||||
let waypointId = 0;
|
||||
let startTime = new Date().getTime();
|
||||
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, loadWaypoint);
|
||||
|
||||
function loadWaypoint() {
|
||||
waypointId++;
|
||||
if (waypointId < MISSION_PLANER.getCountBusyPoints()) {
|
||||
if (waypointId < MISSION_PLANNER.getCountBusyPoints()) {
|
||||
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, loadWaypoint);
|
||||
} else {
|
||||
GUI.log('Receive time: ' + (new Date().getTime() - startTime) + 'ms');
|
||||
|
@ -3011,11 +3011,11 @@ var mspHelper = (function (gui) {
|
|||
|
||||
function sendWaypoint() {
|
||||
waypointId++;
|
||||
if (waypointId < MISSION_PLANER.get().length) {
|
||||
MSP.send_message(MSPCodes.MSP_SET_WP, MISSION_PLANER.extractBuffer(waypointId), false, sendWaypoint);
|
||||
if (waypointId < MISSION_PLANNER.get().length) {
|
||||
MSP.send_message(MSPCodes.MSP_SET_WP, MISSION_PLANNER.extractBuffer(waypointId), false, sendWaypoint);
|
||||
}
|
||||
else {
|
||||
MSP.send_message(MSPCodes.MSP_SET_WP, MISSION_PLANER.extractBuffer(waypointId), false, endMission);
|
||||
MSP.send_message(MSPCodes.MSP_SET_WP, MISSION_PLANNER.extractBuffer(waypointId), false, endMission);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@
|
|||
height: 100%;
|
||||
}
|
||||
|
||||
/* #missionPlanerElevation {
|
||||
/* #missionPlannerElevation {
|
||||
height: 40%;
|
||||
} */
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<div class="tab-mission-control">
|
||||
<div style="padding-top: 20px;padding-left: 20px; padding-right: 20px;position: relative;">
|
||||
<div class="tab_title" data-i18n="tabMissionControl">Mission planer</div>
|
||||
<div class="tab_title" data-i18n="tabMissionControl">Mission planner</div>
|
||||
</div>
|
||||
<div class="content_wrapper">
|
||||
<div class="cf_column fourth" id="missionControls">
|
||||
<div class="spacer_right">
|
||||
<div id="missionPlanerAction" class="gui_box grey">
|
||||
<div id="missionPlannerAction" class="gui_box grey">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title i18n-replaced" data-i18n="missionActionMenuHead">Action Menu</div>
|
||||
<div class="btnMenu btnMenuIcon show_btn" id="showHideActionButton">
|
||||
|
@ -38,7 +38,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="missionPlanerTotalInfo" class="gui_box grey">
|
||||
<div id="missionPlannerTotalInfo" class="gui_box grey">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title i18n-replaced" data-i18n="missionTotalInformationHead">Total information</div>
|
||||
<div class="btnMenu btnMenuIcon show_btn" id="showHideInfoButton">
|
||||
|
@ -65,7 +65,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="missionPlanerSettings" class="gui_box grey" style="display: none">
|
||||
<div id="missionPlannerSettings" class="gui_box grey" style="display: none">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title i18n-replaced" data-i18n="missionDefaultSettingsHead">Default settings</div>
|
||||
<div class="btnMenu btnMenuIcon save_btn">
|
||||
|
@ -129,7 +129,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="missionPlanerHome" class="gui_box grey" style="display: none">
|
||||
<div id="missionPlannerHome" class="gui_box grey" style="display: none">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title i18n-replaced" data-i18n="missionHomeHead">Take Off home</div>
|
||||
<div class="btnMenu btnMenuIcon save_btn">
|
||||
|
@ -170,7 +170,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="missionPlanerSafehome" class="gui_box grey" style="display: none">
|
||||
<div id="missionPlannerSafehome" class="gui_box grey" style="display: none">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title i18n-replaced" data-i18n="missionSafehomeHead">Safe Home manager</div>
|
||||
<div class="btnMenu btnMenuIcon save_btn">
|
||||
|
@ -331,7 +331,7 @@
|
|||
</div>
|
||||
<div class="cf_column threefourth_left" style="height: 100%;">
|
||||
<div id="missionMap"></div>
|
||||
<div id="missionPlanerElevation" class="gui_box grey" style="display: none">
|
||||
<div id="missionPlannerElevation" class="gui_box grey" style="display: none">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title i18n-replaced" data-i18n="missionDefaultElevationHead">Elevation Profile</div>
|
||||
<div class="btnMenu btnMenuIcon save_btn">
|
||||
|
|
|
@ -301,9 +301,9 @@ TABS.mission_control.initialize = function (callback) {
|
|||
//update RTH every 5th GPS update since it really shouldn't change
|
||||
if(rthUpdateInterval >= 5)
|
||||
{
|
||||
MISSION_PLANER.bufferPoint.number = -1; //needed to get point 0 which id RTH
|
||||
MISSION_PLANNER.bufferPoint.number = -1; //needed to get point 0 which id RTH
|
||||
MSP.send_message(MSPCodes.MSP_WP, mspHelper.crunch(MSPCodes.MSP_WP), false, function rth_update() {
|
||||
var coord = ol.proj.fromLonLat([MISSION_PLANER.bufferPoint.lon, MISSION_PLANER.bufferPoint.lat]);
|
||||
var coord = ol.proj.fromLonLat([MISSION_PLANNER.bufferPoint.lon, MISSION_PLANNER.bufferPoint.lat]);
|
||||
rthGeo.setCoordinates(coord);
|
||||
});
|
||||
rthUpdateInterval = 0;
|
||||
|
@ -433,16 +433,16 @@ TABS.mission_control.initialize = function (callback) {
|
|||
//
|
||||
/////////////////////////////////////////////
|
||||
function loadSettings() {
|
||||
chrome.storage.local.get('missionPlanerSettings', function (result) {
|
||||
if (result.missionPlanerSettings) {
|
||||
settings = result.missionPlanerSettings;
|
||||
chrome.storage.local.get('missionPlannerSettings', function (result) {
|
||||
if (result.missionPlannerSettings) {
|
||||
settings = result.missionPlannerSettings;
|
||||
}
|
||||
refreshSettings();
|
||||
});
|
||||
}
|
||||
|
||||
function saveSettings() {
|
||||
chrome.storage.local.set({'missionPlanerSettings': settings});
|
||||
chrome.storage.local.set({'missionPlannerSettings': settings});
|
||||
}
|
||||
|
||||
function refreshSettings() {
|
||||
|
@ -452,7 +452,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function closeSettingsPanel() {
|
||||
$('#missionPlanerSettings').hide();
|
||||
$('#missionPlannerSettings').hide();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
|
@ -461,7 +461,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
//
|
||||
/////////////////////////////////////////////
|
||||
function closeSafehomePanel() {
|
||||
$('#missionPlanerSafehome').hide();
|
||||
$('#missionPlannerSafehome').hide();
|
||||
cleanSafehomeLayers();
|
||||
}
|
||||
|
||||
|
@ -636,8 +636,8 @@ TABS.mission_control.initialize = function (callback) {
|
|||
//
|
||||
/////////////////////////////////////////////
|
||||
function closeHomePanel() {
|
||||
$('#missionPlanerHome').hide();
|
||||
$('#missionPlanerElevation').hide();
|
||||
$('#missionPlannerHome').hide();
|
||||
$('#missionPlannerElevation').hide();
|
||||
cleanHomeLayers();
|
||||
}
|
||||
|
||||
|
@ -1436,7 +1436,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 () {
|
||||
$('#missionPlanerSettings').fadeIn(300);
|
||||
$('#missionPlannerSettings').fadeIn(300);
|
||||
};
|
||||
|
||||
button.addEventListener('click', handleShowSettings, false);
|
||||
|
@ -1469,7 +1469,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
button.style = 'background: url(\'../images/icons/cf_icon_safehome_white.svg\') no-repeat 1px -1px;background-color: rgba(0,60,136,.5);';
|
||||
|
||||
var handleShowSafehome = function () {
|
||||
$('#missionPlanerSafehome').fadeIn(300);
|
||||
$('#missionPlannerSafehome').fadeIn(300);
|
||||
//SAFEHOMES.flush();
|
||||
//mspHelper.loadSafehomes();
|
||||
cleanSafehomeLayers();
|
||||
|
@ -1507,11 +1507,11 @@ TABS.mission_control.initialize = function (callback) {
|
|||
button.style = 'background: url(\'../images/icons/cf_icon_elevation_white.svg\') no-repeat 1px -1px;background-color: rgba(0,60,136,.5);';
|
||||
|
||||
var handleShowSettings = function () {
|
||||
$('#missionPlanerHome').fadeIn(300);
|
||||
$('#missionPlannerHome').fadeIn(300);
|
||||
cleanHomeLayers();
|
||||
renderHomeTable();
|
||||
renderHomeOnMap();
|
||||
$('#missionPlanerElevation').fadeIn(300);
|
||||
$('#missionPlannerElevation').fadeIn(300);
|
||||
plotElevation();
|
||||
};
|
||||
|
||||
|
@ -1768,7 +1768,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
// save map view settings when user moves it
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
map.on('moveend', function (evt) {
|
||||
chrome.storage.local.set({'missionPlanerLastValues': {
|
||||
chrome.storage.local.set({'missionPlannerLastValues': {
|
||||
center: ol.proj.toLonLat(map.getView().getCenter()),
|
||||
zoom: map.getView().getZoom()
|
||||
}});
|
||||
|
@ -1776,10 +1776,10 @@ TABS.mission_control.initialize = function (callback) {
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
// load map view settings on startup
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
chrome.storage.local.get('missionPlanerLastValues', function (result) {
|
||||
if (result.missionPlanerLastValues && result.missionPlanerLastValues.center) {
|
||||
map.getView().setCenter(ol.proj.fromLonLat(result.missionPlanerLastValues.center));
|
||||
map.getView().setZoom(result.missionPlanerLastValues.zoom);
|
||||
chrome.storage.local.get('missionPlannerLastValues', function (result) {
|
||||
if (result.missionPlannerLastValues && result.missionPlannerLastValues.center) {
|
||||
map.getView().setCenter(ol.proj.fromLonLat(result.missionPlannerLastValues.center));
|
||||
map.getView().setZoom(result.missionPlannerLastValues.zoom);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -2616,7 +2616,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
/////////////////////////////////////////////
|
||||
//
|
||||
// Load/Save FC mission Toolbox
|
||||
// mission = configurator store, WP number indexed from 0, MISSION_PLANER = FC NVM store, WP number indexed from 1
|
||||
// mission = configurator store, WP number indexed from 0, MISSION_PLANNER = FC NVM store, WP number indexed from 1
|
||||
/////////////////////////////////////////////
|
||||
function getWaypointsFromFC(loadEeprom) {
|
||||
if (loadEeprom) {
|
||||
|
@ -2634,12 +2634,12 @@ TABS.mission_control.initialize = function (callback) {
|
|||
} else {
|
||||
$('#loadMissionButton').removeClass('disabled');
|
||||
}
|
||||
if (!MISSION_PLANER.getCountBusyPoints()) {
|
||||
if (!MISSION_PLANNER.getCountBusyPoints()) {
|
||||
alert(chrome.i18n.getMessage('no_waypoints_to_load'));
|
||||
return;
|
||||
}
|
||||
mission.reinit();
|
||||
mission.copy(MISSION_PLANER);
|
||||
mission.copy(MISSION_PLANNER);
|
||||
mission.update(false, true);
|
||||
|
||||
/* check multimissions */
|
||||
|
@ -2665,9 +2665,9 @@ TABS.mission_control.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function sendWaypointsToFC(saveEeprom) {
|
||||
MISSION_PLANER.reinit();
|
||||
MISSION_PLANER.copy(mission);
|
||||
MISSION_PLANER.update(false, true, true);
|
||||
MISSION_PLANNER.reinit();
|
||||
MISSION_PLANNER.copy(mission);
|
||||
MISSION_PLANNER.update(false, true, true);
|
||||
mspHelper.saveWaypoints(function() {
|
||||
GUI.log('End send point');
|
||||
if (saveEeprom) {
|
||||
|
@ -2677,12 +2677,12 @@ TABS.mission_control.initialize = function (callback) {
|
|||
} else {
|
||||
$('#saveMissionButton').removeClass('disabled');
|
||||
}
|
||||
mission.setMaxWaypoints(MISSION_PLANER.getMaxWaypoints());
|
||||
mission.setValidMission(MISSION_PLANER.getValidMission());
|
||||
mission.setCountBusyPoints(MISSION_PLANER.getCountBusyPoints());
|
||||
mission.setMaxWaypoints(MISSION_PLANNER.getMaxWaypoints());
|
||||
mission.setValidMission(MISSION_PLANNER.getValidMission());
|
||||
mission.setCountBusyPoints(MISSION_PLANNER.getCountBusyPoints());
|
||||
updateTotalInfo();
|
||||
mission.reinit();
|
||||
mission.copy(MISSION_PLANER);
|
||||
mission.copy(MISSION_PLANNER);
|
||||
mission.update(false, true);
|
||||
refreshLayers();
|
||||
$('#MPeditPoint').fadeOut(300);
|
||||
|
@ -2753,7 +2753,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function plotElevation() {
|
||||
if ($('#missionPlanerElevation').is(":visible") && !disableMarkerEdit) {
|
||||
if ($('#missionPlannerElevation').is(":visible") && !disableMarkerEdit) {
|
||||
if (mission.isEmpty()) {
|
||||
var data = [[0], [0]];
|
||||
var layout = {showlegend: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue