mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-23 16:25:22 +03:00
Update latlon (#4349)
* Update latlon * Update virtual * Fix missing table row
This commit is contained in:
parent
689fb7b894
commit
6109779e6f
8 changed files with 43 additions and 25 deletions
|
@ -2957,9 +2957,13 @@
|
|||
"gpsAltitude": {
|
||||
"message": "Altitude:"
|
||||
},
|
||||
"gpsLatLon": {
|
||||
"message": "Current Latitude / Longitude:",
|
||||
"description": "Show GPS position - Latitude / Longitude"
|
||||
"gpsLatitude": {
|
||||
"message": "Latitude:",
|
||||
"description": "Show GPS position - Latitude"
|
||||
},
|
||||
"gpsLongitude": {
|
||||
"message": "Longitude:",
|
||||
"description": "Show GPS position - Longitude"
|
||||
},
|
||||
"gpsHeading": {
|
||||
"message": "Heading IMU / GPS:",
|
||||
|
|
|
@ -321,8 +321,8 @@ const VirtualFC = {
|
|||
const sampleGpsData = {
|
||||
fix: 2,
|
||||
numSat: 10,
|
||||
lat: 474919409,
|
||||
lon: 190539766,
|
||||
latitude: 474919409,
|
||||
longitude: 190539766,
|
||||
alt: 0,
|
||||
speed: 0,
|
||||
ground_course: 1337,
|
||||
|
|
|
@ -342,8 +342,8 @@ const FC = {
|
|||
this.GPS_DATA = {
|
||||
fix: 0,
|
||||
numSat: 0,
|
||||
lat: 0,
|
||||
lon: 0,
|
||||
latitude: 0,
|
||||
longitude: 0,
|
||||
alt: 0,
|
||||
speed: 0,
|
||||
ground_course: 0,
|
||||
|
|
|
@ -309,8 +309,8 @@ MspHelper.prototype.process_data = function (dataHandler) {
|
|||
case MSPCodes.MSP_RAW_GPS:
|
||||
FC.GPS_DATA.fix = data.readU8();
|
||||
FC.GPS_DATA.numSat = data.readU8();
|
||||
FC.GPS_DATA.lat = data.read32();
|
||||
FC.GPS_DATA.lon = data.read32();
|
||||
FC.GPS_DATA.latitude = data.read32();
|
||||
FC.GPS_DATA.longitude = data.read32();
|
||||
FC.GPS_DATA.alt = data.readU16();
|
||||
FC.GPS_DATA.speed = data.readU16();
|
||||
FC.GPS_DATA.ground_course = data.readU16();
|
||||
|
|
|
@ -334,9 +334,9 @@ gps.initialize = async function (callback) {
|
|||
}
|
||||
|
||||
function update_ui() {
|
||||
const lat = FC.GPS_DATA.lat / 10000000;
|
||||
const lon = FC.GPS_DATA.lon / 10000000;
|
||||
const url = `https://maps.google.com/?q=${lat},${lon}`;
|
||||
const latitude = FC.GPS_DATA.latitude / 10000000;
|
||||
const longitude = FC.GPS_DATA.longitude / 10000000;
|
||||
const url = `https://maps.google.com/?q=${latitude},${longitude}`;
|
||||
const imuHeadingDegrees = FC.SENSOR_DATA.kinematics[2];
|
||||
// Convert to radians and add 180 degrees to make icon point in the right direction
|
||||
const imuHeadingRadians = ((imuHeadingDegrees + 180) * Math.PI) / 180;
|
||||
|
@ -353,9 +353,12 @@ gps.initialize = async function (callback) {
|
|||
|
||||
const gpsUnitText = i18n.getMessage("gpsPositionUnit");
|
||||
$(".GPS_info td.alt").text(`${alt} m`);
|
||||
$(".GPS_info td.latLon a")
|
||||
$(".GPS_info td.latitude a")
|
||||
.prop("href", url)
|
||||
.text(`${lat.toFixed(6)} / ${lon.toFixed(6)} ${gpsUnitText}`);
|
||||
.text(`${latitude.toFixed(6)} ${gpsUnitText}`);
|
||||
$(".GPS_info td.longitude a")
|
||||
.prop("href", url)
|
||||
.text(`${longitude.toFixed(6)} ${gpsUnitText}`);
|
||||
$(".GPS_info td.heading").text(`${imuHeadingDegrees.toFixed(0)} / ${gpsHeading.toFixed(0)} ${gpsUnitText}`);
|
||||
$(".GPS_info td.speed").text(`${FC.GPS_DATA.speed} cm/s`);
|
||||
$(".GPS_info td.sats").text(FC.GPS_DATA.numSat);
|
||||
|
@ -384,12 +387,12 @@ gps.initialize = async function (callback) {
|
|||
if (ispConnected()) {
|
||||
$("#connect").hide();
|
||||
|
||||
gpsFoundPosition = !!(lon && lat);
|
||||
gpsFoundPosition = !!(longitude && latitude);
|
||||
|
||||
if (gpsFoundPosition) {
|
||||
(hasMag ? iconStyleMag : iconStyleGPS).getImage().setRotation(imuHeadingRadians);
|
||||
iconFeature.setStyle(hasMag ? iconStyleMag : iconStyleGPS);
|
||||
const center = fromLonLat([lon, lat]);
|
||||
const center = fromLonLat([longitude, latitude]);
|
||||
mapView.setCenter(center);
|
||||
iconGeometry.setCoordinates(center);
|
||||
} else {
|
||||
|
|
|
@ -524,13 +524,16 @@ setup.initialize = function (callback) {
|
|||
gpsFix_e.toggleClass("ready", FC.GPS_DATA.fix != 0);
|
||||
gpsSats_e.text(FC.GPS_DATA.numSat);
|
||||
|
||||
const lat = FC.GPS_DATA.lat / 10000000;
|
||||
const lon = FC.GPS_DATA.lon / 10000000;
|
||||
const url = `https://maps.google.com/?q=${lat},${lon}`;
|
||||
const latitude = FC.GPS_DATA.latitude / 10000000;
|
||||
const longitude = FC.GPS_DATA.longitude / 10000000;
|
||||
const url = `https://maps.google.com/?q=${latitude},${longitude}`;
|
||||
const gpsUnitText = i18n.getMessage("gpsPositionUnit");
|
||||
$(".GPS_info td.latLon a")
|
||||
$(".GPS_info td.latitude a")
|
||||
.prop("href", url)
|
||||
.text(`${lat.toFixed(4)} / ${lon.toFixed(4)} ${gpsUnitText}`);
|
||||
.text(`${latitude.toFixed(4)} ${gpsUnitText}`);
|
||||
$(".GPS_info td.longitude a")
|
||||
.prop("href", url)
|
||||
.text(`${longitude.toFixed(4)} ${gpsUnitText}`);
|
||||
}
|
||||
|
||||
function get_fast_data() {
|
||||
|
|
|
@ -114,8 +114,12 @@
|
|||
<td class="heading"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td i18n="gpsLatLon"></td>
|
||||
<td class="latLon"><a href="#" target="_blank">0.0000 deg</a></td>
|
||||
<td i18n="gpsLatitude"></td>
|
||||
<td class="latitude"><a href="#" target="_blank">0.0000 deg</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td i18n="gpsLongitude"></td>
|
||||
<td class="longitude"><a href="#" target="_blank">0.0000 deg</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td i18n="gpsDistToHome"></td>
|
||||
|
|
|
@ -112,8 +112,12 @@
|
|||
<td class="gpsSats"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td i18n="gpsLatLon"></td>
|
||||
<td class="latLon"><a href="#" target="_blank">0.0000 deg</a></td>
|
||||
<td i18n="gpsLatitude"></td>
|
||||
<td class="latitude"><a href="#" target="_blank">0.0000 deg</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td i18n="gpsLongitude"></td>
|
||||
<td class="longitude"><a href="#" target="_blank">0.0000 deg</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue