Skip to content

Commit

Permalink
Add positional DOP to GUI (betaflight#3857)
Browse files Browse the repository at this point in the history
* Display positional DOP

* Fix DOP presentation
  • Loading branch information
haslinghuis authored and chmelevskij committed Apr 27, 2024
1 parent 819cabc commit e429c68
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2839,6 +2839,9 @@
"gpsDistToHome": {
"message": "Dist to Home:"
},
"gpsPositionalDop": {
"message": "Positional DOP:"
},
"gpsSignalStrHead": {
"message": "GPS Signal Strength"
},
Expand Down
1 change: 1 addition & 0 deletions src/js/VirtualFC.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ const sampleGpsData = {
"alt": 0,
"speed": 0,
"ground_course": 1337,
"positionalDop": 0,
"distanceToHome": 0,
"directionToHome": 0,
"update": 0,
Expand Down
1 change: 1 addition & 0 deletions src/js/fc.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ const FC = {
alt: 0,
speed: 0,
ground_course: 0,
positionalDop: 0,
distanceToHome: 0,
directionToHome: 0,
update: 0,
Expand Down
3 changes: 3 additions & 0 deletions src/js/msp/MSPHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
FC.GPS_DATA.alt = data.readU16();
FC.GPS_DATA.speed = data.readU16();
FC.GPS_DATA.ground_course = data.readU16();
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) {
FC.GPS_DATA.positionalDop = data.readU16();
}
break;
case MSPCodes.MSP_COMP_GPS:
FC.GPS_DATA.distanceToHome = data.readU16();
Expand Down
7 changes: 7 additions & 0 deletions src/js/tabs/gps.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,13 @@ gps.initialize = async function (callback) {
$('.GPS_info td.sats').text(FC.GPS_DATA.numSat);
$('.GPS_info td.distToHome').text(`${FC.GPS_DATA.distanceToHome} m`);

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();
}

// Update GPS Signal Strengths
const eSsTable = $('div.GPS_signal_strength table');

Expand Down
4 changes: 4 additions & 0 deletions src/tabs/gps.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@
<td i18n="gpsDistToHome"></td>
<td class="distToHome"></td>
</tr>
<tr>
<td i18n="gpsPositionalDop"></td>
<td class="positionalDop"></td>
</tr>
</table>
</div>
</div>
Expand Down

0 comments on commit e429c68

Please sign in to comment.