Skip to content

Commit 57bc463

Browse files
authored
Improve configuration for MSP GNSS (#4344)
* Improve configuration for MSP GNSS * Move gps feature to gps tab * Add virtualFC build options * GPS for everyone * Add more virtual options * Add tooltip manually * Update tooltip
1 parent 3864cbb commit 57bc463

File tree

8 files changed

+27
-26
lines changed

8 files changed

+27
-26
lines changed

locales/en/messages.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,8 @@
12851285
"message": "GPS for navigation and telemetry"
12861286
},
12871287
"featureGPSTip": {
1288-
"message": "Configure port scenario first"
1288+
"message": "Enable / Disable GPS data. If GPS cannot be enabled, check that a Port is assigned to GPS in the Ports Tab",
1289+
"description": "Message that pops up to describe the GPS feature"
12891290
},
12901291
"featureSONAR": {
12911292
"message": "Sonar"

src/css/tabs/gps.less

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@
8888
width: 38px;
8989
}
9090
}
91+
table {
92+
width: fit-content;
93+
}
9194
}
9295
dl.features {
9396
dt {

src/js/Features.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const Features = function (config) {
1414
{ bit: 4, group: "escMotorStop", name: "MOTOR_STOP", haveTip: true },
1515
{ bit: 5, group: "other", name: "SERVO_TILT", haveTip: true, dependsOn: "SERVOS" },
1616
{ bit: 6, group: "other", name: "SOFTSERIAL", haveTip: true },
17-
{ bit: 7, group: "other", name: "GPS", haveTip: true, dependsOn: "GPS" },
17+
{ bit: 7, group: "gps", name: "GPS", dependsOn: "GPS" },
1818
{ bit: 9, group: "other", name: "SONAR", haveTip: true, dependsOn: "RANGEFINDER" },
1919
{ bit: 10, group: "telemetry", name: "TELEMETRY", haveTip: true, dependsOn: "TELEMETRY" },
2020
{ bit: 12, group: "3D", name: "3D", haveTip: true },

src/js/VirtualFC.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,18 @@ const VirtualFC = {
2121
virtualFC.CONFIG.cpuTemp = 48;
2222

2323
virtualFC.CONFIG.buildInfo = "now";
24-
virtualFC.CONFIG.buildOptions = [];
24+
virtualFC.CONFIG.buildOptions = [
25+
"USE_ESC_SENSOR",
26+
"USE_DASHBOARD",
27+
"USE_GPS",
28+
"USE_LED_STRIP",
29+
"USE_OSD",
30+
"USE_SOFTSERIAL",
31+
"USE_SONAR",
32+
"USE_TELEMETRY",
33+
"USE_SERVOS",
34+
"USE_TRANSPONDER",
35+
];
2536

2637
virtualFC.CONFIG.craftName = "BetaFlight";
2738
virtualFC.CONFIG.pilotName = "BF pilot";

src/js/tabs/configuration.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -397,23 +397,11 @@ configuration.initialize = function (callback) {
397397

398398
// UI hooks
399399

400-
function checkUpdateGpsControls() {
401-
if (FC.FEATURE_CONFIG.features.isEnabled("GPS")) {
402-
$(".gpsSettings").show();
403-
} else {
404-
$(".gpsSettings").hide();
405-
}
406-
}
407-
408400
$("input.feature", features_e).change(function () {
409401
const element = $(this);
410402

411403
FC.FEATURE_CONFIG.features.updateData(element);
412404
updateTabList(FC.FEATURE_CONFIG.features);
413-
414-
if (element.attr("name") === "GPS") {
415-
checkUpdateGpsControls();
416-
}
417405
});
418406

419407
$('input[id="accHardwareSwitch"]')
@@ -437,8 +425,6 @@ configuration.initialize = function (callback) {
437425
FC.BEEPER_CONFIG.beepers.updateData(element);
438426
});
439427

440-
checkUpdateGpsControls();
441-
442428
$("a.save").on("click", function () {
443429
// gather data that doesn't have automatic change event bound
444430
FC.BOARD_ALIGNMENT_CONFIG.roll = parseInt($('input[name="board_align_roll"]').val());

src/js/tabs/gps.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,13 @@ gps.initialize = async function (callback) {
8080

8181
FC.FEATURE_CONFIG.features.generateElements(features_e);
8282

83-
const checkUpdateGpsControls = () => $(".gpsSettings").toggle(FC.FEATURE_CONFIG.features.isEnabled("GPS"));
84-
8583
$("input.feature", features_e).on("change", function () {
8684
const element = $(this);
8785

8886
FC.FEATURE_CONFIG.features.updateData(element);
8987
updateTabList(FC.FEATURE_CONFIG.features);
90-
91-
if (element.attr("name") === "GPS") {
92-
checkUpdateGpsControls();
93-
}
9488
});
9589

96-
checkUpdateGpsControls();
97-
9890
// generate GPS
9991
const gpsProtocols = sensorTypes().gps.elements;
10092

src/js/utils/updateTabList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function updateTabList(features) {
1212
isExpertModeEnabled && FC.CONFIG?.buildOptions?.includes("USE_SERVOS"),
1313
);
1414

15-
$("#tabs ul.mode-connected li.tab_gps").toggle(features.isEnabled("GPS"));
15+
$("#tabs ul.mode-connected li.tab_gps").toggle(FC.CONFIG?.buildOptions?.includes("USE_GPS"));
1616
$("#tabs ul.mode-connected li.tab_led_strip").toggle(features.isEnabled("LED_STRIP"));
1717
$("#tabs ul.mode-connected li.tab_transponder").toggle(features.isEnabled("TRANSPONDER"));
1818
$("#tabs ul.mode-connected li.tab_osd").toggle(features.isEnabled("OSD"));

src/tabs/gps.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
<div class="spacer_box">
1616
<div class="gps_config">
1717
<div>
18+
<div class="select line">
19+
<table>
20+
<tbody class="features gps">
21+
<!-- table generated here -->
22+
</tbody>
23+
</table>
24+
<div class="helpicon cf_tip" i18n_title="featureGPSTip"></div>
25+
</div>
1826
<div class="select line">
1927
<select class="gps_protocol">
2028
<!-- list generated here -->

0 commit comments

Comments
 (0)