mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 04:15:28 +03:00
Move GPS configuration to GPS tab
This commit is contained in:
parent
23d434e52d
commit
155855b5fa
6 changed files with 192 additions and 109 deletions
|
@ -973,7 +973,7 @@
|
|||
"message": "Cycles/Sec (Hz)"
|
||||
},
|
||||
"configurationGPS": {
|
||||
"message": "GPS"
|
||||
"message": "Configuration"
|
||||
},
|
||||
"configurationGPSProtocol": {
|
||||
"message": "Protocol"
|
||||
|
@ -1624,10 +1624,10 @@
|
|||
"message":"<ol><li>Remove propellers</li><li>Connect LiPo and use Outputs Tab to test all motors</li><li>Note the position of each motor (motor #1 - Left Top and so on)</li><li>Fill the table below</li></ol>"
|
||||
},
|
||||
"gpsHead": {
|
||||
"message": "GPS"
|
||||
"message": "Position"
|
||||
},
|
||||
"gpsStatHead": {
|
||||
"message": "GPS Statistics"
|
||||
"message": "Statistics"
|
||||
},
|
||||
"gpsMapHead": {
|
||||
"message": "Current GPS location"
|
||||
|
|
2
js/fc.js
2
js/fc.js
|
@ -576,7 +576,7 @@ var FC = {
|
|||
{bit: 1, group: 'batteryVoltage', name: 'VBAT'},
|
||||
{bit: 4, group: 'other', name: 'MOTOR_STOP'},
|
||||
{bit: 6, group: 'other', name: 'SOFTSERIAL', haveTip: true, showNameInTip: true},
|
||||
{bit: 7, group: 'gps', name: 'GPS', haveTip: true},
|
||||
{bit: 7, group: 'other', name: 'GPS', haveTip: true},
|
||||
{bit: 10, group: 'other', name: 'TELEMETRY', showNameInTip: true},
|
||||
{bit: 11, group: 'batteryCurrent', name: 'CURRENT_METER'},
|
||||
{bit: 12, group: 'other', name: 'REVERSIBLE_MOTORS', showNameInTip: true},
|
||||
|
|
|
@ -76,64 +76,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-section gui_box grey">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title" data-i18n="configurationGPS"></div>
|
||||
</div>
|
||||
<div class="spacer_box">
|
||||
<div class="note">
|
||||
<div class="note_spacer">
|
||||
<p data-i18n="configurationGPSHelp"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="features gps"></div>
|
||||
<!--feature list generated content-->
|
||||
|
||||
<div class="select">
|
||||
<select id="gps_protocol" class="gps_protocol">
|
||||
<!-- list generated here -->
|
||||
</select>
|
||||
<label for="gps_protocol">
|
||||
<span data-i18n="configurationGPSProtocol"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="select">
|
||||
<select id="gps_ubx_sbas" class="gps_ubx_sbas">
|
||||
<!-- list generated here -->
|
||||
</select>
|
||||
<label for="gps_ubx_sbas">
|
||||
<span data-i18n="configurationGPSubxSbas"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="number is-hidden">
|
||||
<input type="number" id="mag_declination" name="mag_declination" step="0.1" min="-180" max="180" />
|
||||
<label for="mag_declination">
|
||||
<span data-i18n="configurationMagDeclination"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" class="toggle update_preview" data-setting="gps_ublox_use_galileo" data-live="true">
|
||||
<label for="gps_use_galileo">
|
||||
<span data-i18n="configurationGPSUseGalileo"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="number">
|
||||
<input type="number" id="tzOffset" data-setting="tz_offset" data-setting-multiplier="1" step="1" min="-1440" max="1440" />
|
||||
<label for="tzOffset">
|
||||
<span data-i18n="tzOffset"></span>
|
||||
</label>
|
||||
<div class="helpicon cf_tip" data-i18n_title="tzOffsetHelp"></div>
|
||||
</div>
|
||||
<div class="select">
|
||||
<select id="tzAutomaticDST" data-setting="tz_automatic_dst"></select>
|
||||
<label for="tzAutomaticDST">
|
||||
<span data-i18n="tzAutomaticDST"></span>
|
||||
</label>
|
||||
<div class="helpicon cf_tip" data-i18n_title="tzAutomaticDSTHelp"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="config-section gui_box grey">
|
||||
<div class="gui_box_titlebar">
|
||||
|
|
|
@ -146,32 +146,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
orientation_mag_e.val(SENSOR_ALIGNMENT.align_mag);
|
||||
|
||||
// generate GPS
|
||||
var gpsProtocols = FC.getGpsProtocols();
|
||||
var gpsSbas = FC.getGpsSbasProviders();
|
||||
|
||||
var gps_protocol_e = $('#gps_protocol');
|
||||
for (i = 0; i < gpsProtocols.length; i++) {
|
||||
gps_protocol_e.append('<option value="' + i + '">' + gpsProtocols[i] + '</option>');
|
||||
}
|
||||
|
||||
gps_protocol_e.change(function () {
|
||||
MISC.gps_type = parseInt($(this).val());
|
||||
});
|
||||
|
||||
gps_protocol_e.val(MISC.gps_type);
|
||||
|
||||
var gps_ubx_sbas_e = $('#gps_ubx_sbas');
|
||||
for (i = 0; i < gpsSbas.length; i++) {
|
||||
gps_ubx_sbas_e.append('<option value="' + i + '">' + gpsSbas[i] + '</option>');
|
||||
}
|
||||
|
||||
gps_ubx_sbas_e.change(function () {
|
||||
MISC.gps_ubx_sbas = parseInt($(this).val());
|
||||
});
|
||||
|
||||
gps_ubx_sbas_e.val(MISC.gps_ubx_sbas);
|
||||
|
||||
// VTX
|
||||
var config_vtx = $('.config-vtx');
|
||||
if (VTX_CONFIG.device_type != VTX.DEV_UNKNOWN) {
|
||||
|
|
|
@ -1,8 +1,78 @@
|
|||
<div class="tab-gps">
|
||||
<div class="tab-gps toolbar_fixed_bottom">
|
||||
<div class="content_wrapper">
|
||||
<div class="tab_title" data-i18n="tabGPS">GPS</div>
|
||||
<div class="cf_column fourth">
|
||||
<div class="cf_column third_left">
|
||||
<div class="spacer_right">
|
||||
|
||||
<div class="config-section gui_box grey">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title" data-i18n="configurationGPS"></div>
|
||||
</div>
|
||||
<div class="spacer_box">
|
||||
<div class="note">
|
||||
<div class="note_spacer">
|
||||
<p data-i18n="configurationGPSHelp"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" data-bit="7" class="feature toggle" name="GPS" title="GPS"
|
||||
id="feature-7">
|
||||
<label for="feature-7">
|
||||
<span data-i18n="featureGPS"></span>
|
||||
</label>
|
||||
<div class="helpicon cf_tip" data-i18n_title="featureGPSTip"></div>
|
||||
</div>
|
||||
|
||||
<div class="select">
|
||||
<select id="gps_protocol" class="gps_protocol">
|
||||
<!-- list generated here -->
|
||||
</select>
|
||||
<label for="gps_protocol">
|
||||
<span data-i18n="configurationGPSProtocol"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="select">
|
||||
<select id="gps_ubx_sbas" class="gps_ubx_sbas">
|
||||
<!-- list generated here -->
|
||||
</select>
|
||||
<label for="gps_ubx_sbas">
|
||||
<span data-i18n="configurationGPSubxSbas"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="number is-hidden">
|
||||
<input type="number" id="mag_declination" name="mag_declination" step="0.1" min="-180"
|
||||
max="180" />
|
||||
<label for="mag_declination">
|
||||
<span data-i18n="configurationMagDeclination"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" class="toggle update_preview" data-setting="gps_ublox_use_galileo"
|
||||
data-live="true">
|
||||
<label for="gps_use_galileo">
|
||||
<span data-i18n="configurationGPSUseGalileo"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="number">
|
||||
<input type="number" id="tzOffset" data-setting="tz_offset" data-setting-multiplier="1"
|
||||
step="1" min="-1440" max="1440" />
|
||||
<label for="tzOffset">
|
||||
<span data-i18n="tzOffset"></span>
|
||||
</label>
|
||||
<div class="helpicon cf_tip" data-i18n_title="tzOffsetHelp"></div>
|
||||
</div>
|
||||
<div class="select">
|
||||
<select id="tzAutomaticDST" data-setting="tz_automatic_dst"></select>
|
||||
<label for="tzAutomaticDST">
|
||||
<span data-i18n="tzAutomaticDST"></span>
|
||||
</label>
|
||||
<div class="helpicon cf_tip" data-i18n_title="tzAutomaticDSTHelp"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="gui_box grey">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title" data-i18n="gpsHead"></div>
|
||||
|
@ -80,7 +150,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cf_column threefourth_left">
|
||||
<div class="cf_column twothird">
|
||||
<div class="gui_box grey gps_map">
|
||||
<div class="gui_box_titlebar" style="margin-bottom: 0;">
|
||||
<div class="spacer_box_title" data-i18n="gpsMapHead"></div>
|
||||
|
@ -93,5 +163,10 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content_toolbar">
|
||||
<div class="btn save_btn">
|
||||
<a class="save" href="#" data-i18n="configurationButtonSave"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
104
tabs/gps.js
104
tabs/gps.js
|
@ -1,3 +1,4 @@
|
|||
/*global $,MSPChainerClass,googleAnalytics,mspHelper,MSPCodes,GUI,chrome,MSP,TABS,Settings,helper,ol*/
|
||||
'use strict';
|
||||
|
||||
TABS.gps = {};
|
||||
|
@ -8,11 +9,49 @@ TABS.gps.initialize = function (callback) {
|
|||
googleAnalytics.sendAppView('GPS');
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
GUI.load("./tabs/gps.html", process_html);
|
||||
var loadChainer = new MSPChainerClass();
|
||||
|
||||
var loadChain = [
|
||||
mspHelper.loadBfConfig,
|
||||
mspHelper.loadMiscV2
|
||||
];
|
||||
|
||||
loadChainer.setChain(loadChain);
|
||||
loadChainer.setExitPoint(load_html);
|
||||
loadChainer.execute();
|
||||
|
||||
var saveChainer = new MSPChainerClass();
|
||||
|
||||
var saveChain = [
|
||||
mspHelper.saveBfConfig,
|
||||
mspHelper.saveMiscV2,
|
||||
saveSettings,
|
||||
mspHelper.saveToEeprom
|
||||
];
|
||||
|
||||
function saveSettings(onComplete) {
|
||||
Settings.saveInputs().then(onComplete);
|
||||
}
|
||||
|
||||
load_html();
|
||||
saveChainer.setChain(saveChain);
|
||||
saveChainer.setExitPoint(reboot);
|
||||
|
||||
function reboot() {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||
|
||||
GUI.tab_switch_cleanup(function () {
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, function () {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect($('.tab_gps a'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
GUI.load("./tabs/gps.html", Settings.processHtml(process_html));
|
||||
}
|
||||
|
||||
let cursorInitialized = false;
|
||||
let iconStyle;
|
||||
|
@ -23,6 +62,36 @@ TABS.gps.initialize = function (callback) {
|
|||
function process_html() {
|
||||
localize();
|
||||
|
||||
var features = FC.getFeatures();
|
||||
|
||||
helper.features.updateUI($('.tab-gps'), BF_CONFIG.features);
|
||||
|
||||
// generate GPS
|
||||
var gpsProtocols = FC.getGpsProtocols();
|
||||
var gpsSbas = FC.getGpsSbasProviders();
|
||||
|
||||
var gps_protocol_e = $('#gps_protocol');
|
||||
for (i = 0; i < gpsProtocols.length; i++) {
|
||||
gps_protocol_e.append('<option value="' + i + '">' + gpsProtocols[i] + '</option>');
|
||||
}
|
||||
|
||||
gps_protocol_e.change(function () {
|
||||
MISC.gps_type = parseInt($(this).val());
|
||||
});
|
||||
|
||||
gps_protocol_e.val(MISC.gps_type);
|
||||
|
||||
var gps_ubx_sbas_e = $('#gps_ubx_sbas');
|
||||
for (i = 0; i < gpsSbas.length; i++) {
|
||||
gps_ubx_sbas_e.append('<option value="' + i + '">' + gpsSbas[i] + '</option>');
|
||||
}
|
||||
|
||||
gps_ubx_sbas_e.change(function () {
|
||||
MISC.gps_ubx_sbas = parseInt($(this).val());
|
||||
});
|
||||
|
||||
gps_ubx_sbas_e.val(MISC.gps_ubx_sbas);
|
||||
|
||||
let mapView = new ol.View({
|
||||
center: ol.proj.fromLonLat([0, 0]),
|
||||
zoom: 15
|
||||
|
@ -36,16 +105,16 @@ TABS.gps.initialize = function (callback) {
|
|||
imagerySet: 'AerialWithLabels',
|
||||
maxZoom: 19
|
||||
});
|
||||
} else if ( globalSettings.mapProviderType == 'mapproxy' ) {
|
||||
} else if (globalSettings.mapProviderType == 'mapproxy') {
|
||||
mapLayer = new ol.source.TileWMS({
|
||||
url: globalSettings.proxyURL,
|
||||
params: {'LAYERS':globalSettings.proxyLayer}
|
||||
params: { 'LAYERS': globalSettings.proxyLayer }
|
||||
})
|
||||
} else {
|
||||
mapLayer = new ol.source.OSM();
|
||||
}
|
||||
|
||||
$("#center_button").click(function(){
|
||||
$("#center_button").click(function () {
|
||||
let lat = GPS_DATA.lat / 10000000;
|
||||
let lon = GPS_DATA.lon / 10000000;
|
||||
let center = ol.proj.fromLonLat([lon, lat]);
|
||||
|
@ -172,6 +241,29 @@ TABS.gps.initialize = function (callback) {
|
|||
get_raw_gps_data();
|
||||
});
|
||||
|
||||
|
||||
$('a.save').on('click', function () {
|
||||
if (FC.isFeatureEnabled('GPS', features)) {
|
||||
googleAnalytics.sendEvent('Setting', 'GpsProtocol', gpsProtocols[MISC.gps_type]);
|
||||
googleAnalytics.sendEvent('Setting', 'GpsSbas', gpsSbas[MISC.gps_ubx_sbas]);
|
||||
}
|
||||
|
||||
googleAnalytics.sendEvent('Setting', 'GPSEnabled', FC.isFeatureEnabled('GPS', features) ? "true" : "false");
|
||||
|
||||
for (var i = 0; i < features.length; i++) {
|
||||
var featureName = features[i].name;
|
||||
if (FC.isFeatureEnabled(featureName, features)) {
|
||||
googleAnalytics.sendEvent('Setting', 'Feature', featureName);
|
||||
}
|
||||
}
|
||||
|
||||
helper.features.reset();
|
||||
helper.features.fromUI($('.tab-gps'));
|
||||
helper.features.execute(function () {
|
||||
saveChainer.execute();
|
||||
});
|
||||
});
|
||||
|
||||
GUI.content_ready(callback);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue