Merge pull request #2318 from haslinghuis/gps

Change lexical scope gps
10.8-maintenance
Michael Keller 2020-12-16 15:09:53 +01:00 committed by GitHub
commit 0f8a2911d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 14 deletions

View File

@ -2,7 +2,6 @@
TABS.gps = {}; TABS.gps = {};
TABS.gps.initialize = function (callback) { TABS.gps.initialize = function (callback) {
var self = this;
if (GUI.active_tab !== 'gps') { if (GUI.active_tab !== 'gps') {
GUI.active_tab = 'gps'; GUI.active_tab = 'gps';
@ -43,13 +42,13 @@ TABS.gps.initialize = function (callback) {
} }
// To not flicker the divs while the fix is unstable // To not flicker the divs while the fix is unstable
var gpsWasFixed = false; let gpsWasFixed = false;
function update_ui() { function update_ui() {
var lat = FC.GPS_DATA.lat / 10000000; const lat = FC.GPS_DATA.lat / 10000000;
var lon = FC.GPS_DATA.lon / 10000000; const lon = FC.GPS_DATA.lon / 10000000;
var url = 'https://maps.google.com/?q=' + lat + ',' + lon; const url = `https://maps.google.com/?q=${lat},${lon}`;
var alt = FC.GPS_DATA.alt; let alt = FC.GPS_DATA.alt;
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_39)) { if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_39)) {
alt = alt / 10; alt = alt / 10;
} }
@ -63,10 +62,10 @@ TABS.gps.initialize = function (callback) {
$('.GPS_info td.distToHome').text(FC.GPS_DATA.distanceToHome + ' m'); $('.GPS_info td.distToHome').text(FC.GPS_DATA.distanceToHome + ' m');
// Update GPS Signal Strengths // Update GPS Signal Strengths
var e_ss_table = $('div.GPS_signal_strength table tr:not(.titles)'); const eSsTable = $('div.GPS_signal_strength table tr:not(.titles)');
for (var i = 0; i < FC.GPS_DATA.chn.length; i++) { for (let i = 0; i < FC.GPS_DATA.chn.length; i++) {
var row = e_ss_table.eq(i); const row = eSsTable.eq(i);
$('td', row).eq(0).text(FC.GPS_DATA.svid[i]); $('td', row).eq(0).text(FC.GPS_DATA.svid[i]);
$('td', row).eq(1).text(FC.GPS_DATA.quality[i]); $('td', row).eq(1).text(FC.GPS_DATA.quality[i]);
@ -74,13 +73,13 @@ TABS.gps.initialize = function (callback) {
} }
var message = { const message = {
action: 'center', action: 'center',
lat: lat, lat: lat,
lon: lon lon: lon
}; };
var frame = document.getElementById('map'); frame = document.getElementById('map');
if (navigator.onLine) { if (navigator.onLine) {
$('#connect').hide(); $('#connect').hide();
@ -139,11 +138,11 @@ TABS.gps.initialize = function (callback) {
} }
}); });
var frame = document.getElementById('map'); let frame = document.getElementById('map');
$('#zoom_in').click(function() { $('#zoom_in').click(function() {
console.log('zoom in'); console.log('zoom in');
var message = { const message = {
action: 'zoom_in' action: 'zoom_in'
}; };
frame.contentWindow.postMessage(message, '*'); frame.contentWindow.postMessage(message, '*');
@ -151,7 +150,7 @@ TABS.gps.initialize = function (callback) {
$('#zoom_out').click(function() { $('#zoom_out').click(function() {
console.log('zoom out'); console.log('zoom out');
var message = { const message = {
action: 'zoom_out' action: 'zoom_out'
}; };
frame.contentWindow.postMessage(message, '*'); frame.contentWindow.postMessage(message, '*');