Skip to content

Commit

Permalink
Update message
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis committed Apr 7, 2024
1 parent 9383beb commit 1cd352e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 30 deletions.
2 changes: 1 addition & 1 deletion locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2853,7 +2853,7 @@
"message": "Signal Strength"
},
"gpsSignalLost": {
"message": "It takes a few seconds for the GNSS unit to be recognized by the flight controller. The GPS icon will appear in red color when it is recognized and in yellow color when we have established a GPS fix.<br>If the icon does not light up, please check your wiring and configuration. Some units must power the device using a battery and in that case the flight controller must be restarted after power is applied to be recognized."
"message": "Connecting...<br /><br />The GPS icon lights up when Betaflight is connected to a GPS module. This usually takes a couple of seconds.<br>It will be red at first, then change to yellow when it gets a 3D fix.<br>If the GPS icon does not light up, check your wiring and configuration, and confirm that the GPS module is receiving power.<br>The CLI 'status' command provides more information about the state of the GPS connection."
},
"gpsSignalGnssId": {
"message": "Gnss ID"
Expand Down
65 changes: 36 additions & 29 deletions src/js/tabs/gps.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ gps.initialize = async function (callback) {
$('div.mag_declination').hide();
}

if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) {
const positionalDop = FC.GPS_DATA.positionalDop / 100;
$('.GPS_info td.positionalDop').text(`${positionalDop.toFixed(2)}`);
} else {
$('.GPS_info td.positionalDop').parent().hide();
}

const {
mapView,
iconStyleMag,
Expand All @@ -214,6 +221,10 @@ gps.initialize = async function (callback) {

// End GPS Configuration

const gnssArray = ['GPS', 'SBAS', 'Galileo', 'BeiDou', 'IMES', 'QZSS', 'Glonass'];
const qualityArray = ['gnssQualityNoSignal', 'gnssQualitySearching', 'gnssQualityAcquired', 'gnssQualityUnusable', 'gnssQualityLocked', 'gnssQualityFullyLocked', 'gnssQualityFullyLocked', 'gnssQualityFullyLocked'];
const usedArray = ['gnssUsedUnused', 'gnssUsedUsed'];

// GPS Signal Strengths
function updateSignalStrengths() {
const eSsTable = $('div.GPS_signal_strength table');
Expand All @@ -237,37 +248,9 @@ gps.initialize = async function (callback) {
</tr>
`);

if (FC.GPS_DATA.chn.length <= 16) {
// Legacy code path: old BF firmware or old ublox module
for (let i = 0; i < FC.GPS_DATA.chn.length; i++) {
eSsTable.append(`
<tr>
<td>-</td>
<td>${FC.GPS_DATA.svid[i]}</td>
<td><meter value="${FC.GPS_DATA.cno[i]}" max="55"></meter></td>
<td>${FC.GPS_DATA.quality[i]}</td>
</tr>
`);
}
// Cleanup the rest of the table
for (let i = FC.GPS_DATA.chn.length; i < 32; i++) {
eSsTable.append(`
<tr>
<td>-</td>
<td>-</td>
<td><meter value="0" max="55"></meter></td>
<td> </td>
</tr>
`);
}
} else {
if (FC.GPS_DATA.chn.length > 16) {
// M8N/M9N on newer firmware

const gnssArray = ['GPS', 'SBAS', 'Galileo', 'BeiDou', 'IMES', 'QZSS', 'Glonass'];
const qualityArray = ['gnssQualityNoSignal', 'gnssQualitySearching', 'gnssQualityAcquired', 'gnssQualityUnusable', 'gnssQualityLocked',
'gnssQualityFullyLocked', 'gnssQualityFullyLocked', 'gnssQualityFullyLocked'];
const usedArray = ['gnssUsedUnused', 'gnssUsedUsed'];

const maxUIChannels = 32; //the list in html can only show 32 channels but future firmware could send more
let channels = Math.min(maxUIChannels, FC.GPS_DATA.chn.length) || 32;

Expand Down Expand Up @@ -315,6 +298,30 @@ gps.initialize = async function (callback) {
}
eSsTable.append(`<tr>${rowContent}</tr>`);
}
} else {
// Legacy code path: old BF firmware or old ublox module
for (let i = 0; i < FC.GPS_DATA.chn.length; i++) {
eSsTable.append(`
<tr>
<td>-</td>
<td>${FC.GPS_DATA.svid[i]}</td>
<td><meter value="${FC.GPS_DATA.cno[i]}" max="55"></meter></td>
<td>${FC.GPS_DATA.quality[i]}</td>
</tr>
`);
}

// Cleanup the rest of the table
for (let i = FC.GPS_DATA.chn.length; i < 32; i++) {
eSsTable.append(`
<tr>
<td>-</td>
<td>-</td>
<td><meter value="0" max="55"></meter></td>
<td> </td>
</tr>
`);
}
}
}

Expand Down

0 comments on commit 1cd352e

Please sign in to comment.