Skip to content

Commit 6109779

Browse files
authored
Update latlon (#4349)
* Update latlon * Update virtual * Fix missing table row
1 parent 689fb7b commit 6109779

File tree

8 files changed

+43
-25
lines changed

8 files changed

+43
-25
lines changed

locales/en/messages.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2957,9 +2957,13 @@
29572957
"gpsAltitude": {
29582958
"message": "Altitude:"
29592959
},
2960-
"gpsLatLon": {
2961-
"message": "Current Latitude / Longitude:",
2962-
"description": "Show GPS position - Latitude / Longitude"
2960+
"gpsLatitude": {
2961+
"message": "Latitude:",
2962+
"description": "Show GPS position - Latitude"
2963+
},
2964+
"gpsLongitude": {
2965+
"message": "Longitude:",
2966+
"description": "Show GPS position - Longitude"
29632967
},
29642968
"gpsHeading": {
29652969
"message": "Heading IMU / GPS:",

src/js/VirtualFC.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ const VirtualFC = {
321321
const sampleGpsData = {
322322
fix: 2,
323323
numSat: 10,
324-
lat: 474919409,
325-
lon: 190539766,
324+
latitude: 474919409,
325+
longitude: 190539766,
326326
alt: 0,
327327
speed: 0,
328328
ground_course: 1337,

src/js/fc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ const FC = {
342342
this.GPS_DATA = {
343343
fix: 0,
344344
numSat: 0,
345-
lat: 0,
346-
lon: 0,
345+
latitude: 0,
346+
longitude: 0,
347347
alt: 0,
348348
speed: 0,
349349
ground_course: 0,

src/js/msp/MSPHelper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ MspHelper.prototype.process_data = function (dataHandler) {
309309
case MSPCodes.MSP_RAW_GPS:
310310
FC.GPS_DATA.fix = data.readU8();
311311
FC.GPS_DATA.numSat = data.readU8();
312-
FC.GPS_DATA.lat = data.read32();
313-
FC.GPS_DATA.lon = data.read32();
312+
FC.GPS_DATA.latitude = data.read32();
313+
FC.GPS_DATA.longitude = data.read32();
314314
FC.GPS_DATA.alt = data.readU16();
315315
FC.GPS_DATA.speed = data.readU16();
316316
FC.GPS_DATA.ground_course = data.readU16();

src/js/tabs/gps.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,9 @@ gps.initialize = async function (callback) {
334334
}
335335

336336
function update_ui() {
337-
const lat = FC.GPS_DATA.lat / 10000000;
338-
const lon = FC.GPS_DATA.lon / 10000000;
339-
const url = `https://maps.google.com/?q=${lat},${lon}`;
337+
const latitude = FC.GPS_DATA.latitude / 10000000;
338+
const longitude = FC.GPS_DATA.longitude / 10000000;
339+
const url = `https://maps.google.com/?q=${latitude},${longitude}`;
340340
const imuHeadingDegrees = FC.SENSOR_DATA.kinematics[2];
341341
// Convert to radians and add 180 degrees to make icon point in the right direction
342342
const imuHeadingRadians = ((imuHeadingDegrees + 180) * Math.PI) / 180;
@@ -353,9 +353,12 @@ gps.initialize = async function (callback) {
353353

354354
const gpsUnitText = i18n.getMessage("gpsPositionUnit");
355355
$(".GPS_info td.alt").text(`${alt} m`);
356-
$(".GPS_info td.latLon a")
356+
$(".GPS_info td.latitude a")
357357
.prop("href", url)
358-
.text(`${lat.toFixed(6)} / ${lon.toFixed(6)} ${gpsUnitText}`);
358+
.text(`${latitude.toFixed(6)} ${gpsUnitText}`);
359+
$(".GPS_info td.longitude a")
360+
.prop("href", url)
361+
.text(`${longitude.toFixed(6)} ${gpsUnitText}`);
359362
$(".GPS_info td.heading").text(`${imuHeadingDegrees.toFixed(0)} / ${gpsHeading.toFixed(0)} ${gpsUnitText}`);
360363
$(".GPS_info td.speed").text(`${FC.GPS_DATA.speed} cm/s`);
361364
$(".GPS_info td.sats").text(FC.GPS_DATA.numSat);
@@ -384,12 +387,12 @@ gps.initialize = async function (callback) {
384387
if (ispConnected()) {
385388
$("#connect").hide();
386389

387-
gpsFoundPosition = !!(lon && lat);
390+
gpsFoundPosition = !!(longitude && latitude);
388391

389392
if (gpsFoundPosition) {
390393
(hasMag ? iconStyleMag : iconStyleGPS).getImage().setRotation(imuHeadingRadians);
391394
iconFeature.setStyle(hasMag ? iconStyleMag : iconStyleGPS);
392-
const center = fromLonLat([lon, lat]);
395+
const center = fromLonLat([longitude, latitude]);
393396
mapView.setCenter(center);
394397
iconGeometry.setCoordinates(center);
395398
} else {

src/js/tabs/setup.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -524,13 +524,16 @@ setup.initialize = function (callback) {
524524
gpsFix_e.toggleClass("ready", FC.GPS_DATA.fix != 0);
525525
gpsSats_e.text(FC.GPS_DATA.numSat);
526526

527-
const lat = FC.GPS_DATA.lat / 10000000;
528-
const lon = FC.GPS_DATA.lon / 10000000;
529-
const url = `https://maps.google.com/?q=${lat},${lon}`;
527+
const latitude = FC.GPS_DATA.latitude / 10000000;
528+
const longitude = FC.GPS_DATA.longitude / 10000000;
529+
const url = `https://maps.google.com/?q=${latitude},${longitude}`;
530530
const gpsUnitText = i18n.getMessage("gpsPositionUnit");
531-
$(".GPS_info td.latLon a")
531+
$(".GPS_info td.latitude a")
532532
.prop("href", url)
533-
.text(`${lat.toFixed(4)} / ${lon.toFixed(4)} ${gpsUnitText}`);
533+
.text(`${latitude.toFixed(4)} ${gpsUnitText}`);
534+
$(".GPS_info td.longitude a")
535+
.prop("href", url)
536+
.text(`${longitude.toFixed(4)} ${gpsUnitText}`);
534537
}
535538

536539
function get_fast_data() {

src/tabs/gps.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,12 @@
114114
<td class="heading"></td>
115115
</tr>
116116
<tr>
117-
<td i18n="gpsLatLon"></td>
118-
<td class="latLon"><a href="#" target="_blank">0.0000 deg</a></td>
117+
<td i18n="gpsLatitude"></td>
118+
<td class="latitude"><a href="#" target="_blank">0.0000 deg</a></td>
119+
</tr>
120+
<tr>
121+
<td i18n="gpsLongitude"></td>
122+
<td class="longitude"><a href="#" target="_blank">0.0000 deg</a></td>
119123
</tr>
120124
<tr>
121125
<td i18n="gpsDistToHome"></td>

src/tabs/setup.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,12 @@
112112
<td class="gpsSats"></td>
113113
</tr>
114114
<tr>
115-
<td i18n="gpsLatLon"></td>
116-
<td class="latLon"><a href="#" target="_blank">0.0000 deg</a></td>
115+
<td i18n="gpsLatitude"></td>
116+
<td class="latitude"><a href="#" target="_blank">0.0000 deg</a></td>
117+
</tr>
118+
<tr>
119+
<td i18n="gpsLongitude"></td>
120+
<td class="longitude"><a href="#" target="_blank">0.0000 deg</a></td>
117121
</tr>
118122
</tbody>
119123
</table>

0 commit comments

Comments
 (0)