From 57bc463ffe477fe916076f7773afd9a1f26275e8 Mon Sep 17 00:00:00 2001 From: Mark Haslinghuis Date: Sun, 16 Feb 2025 01:15:51 +0100 Subject: [PATCH] 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 --- locales/en/messages.json | 3 ++- src/css/tabs/gps.less | 3 +++ src/js/Features.js | 2 +- src/js/VirtualFC.js | 13 ++++++++++++- src/js/tabs/configuration.js | 14 -------------- src/js/tabs/gps.js | 8 -------- src/js/utils/updateTabList.js | 2 +- src/tabs/gps.html | 8 ++++++++ 8 files changed, 27 insertions(+), 26 deletions(-) diff --git a/locales/en/messages.json b/locales/en/messages.json index 64c56ac0..08fec262 100755 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -1285,7 +1285,8 @@ "message": "GPS for navigation and telemetry" }, "featureGPSTip": { - "message": "Configure port scenario first" + "message": "Enable / Disable GPS data. If GPS cannot be enabled, check that a Port is assigned to GPS in the Ports Tab", + "description": "Message that pops up to describe the GPS feature" }, "featureSONAR": { "message": "Sonar" diff --git a/src/css/tabs/gps.less b/src/css/tabs/gps.less index 61b6ecab..85efa54c 100644 --- a/src/css/tabs/gps.less +++ b/src/css/tabs/gps.less @@ -88,6 +88,9 @@ width: 38px; } } + table { + width: fit-content; + } } dl.features { dt { diff --git a/src/js/Features.js b/src/js/Features.js index 6324069e..4fc0208c 100644 --- a/src/js/Features.js +++ b/src/js/Features.js @@ -14,7 +14,7 @@ const Features = function (config) { { bit: 4, group: "escMotorStop", name: "MOTOR_STOP", haveTip: true }, { bit: 5, group: "other", name: "SERVO_TILT", haveTip: true, dependsOn: "SERVOS" }, { bit: 6, group: "other", name: "SOFTSERIAL", haveTip: true }, - { bit: 7, group: "other", name: "GPS", haveTip: true, dependsOn: "GPS" }, + { bit: 7, group: "gps", name: "GPS", dependsOn: "GPS" }, { bit: 9, group: "other", name: "SONAR", haveTip: true, dependsOn: "RANGEFINDER" }, { bit: 10, group: "telemetry", name: "TELEMETRY", haveTip: true, dependsOn: "TELEMETRY" }, { bit: 12, group: "3D", name: "3D", haveTip: true }, diff --git a/src/js/VirtualFC.js b/src/js/VirtualFC.js index ca3d3601..10e983ee 100644 --- a/src/js/VirtualFC.js +++ b/src/js/VirtualFC.js @@ -21,7 +21,18 @@ const VirtualFC = { virtualFC.CONFIG.cpuTemp = 48; virtualFC.CONFIG.buildInfo = "now"; - virtualFC.CONFIG.buildOptions = []; + virtualFC.CONFIG.buildOptions = [ + "USE_ESC_SENSOR", + "USE_DASHBOARD", + "USE_GPS", + "USE_LED_STRIP", + "USE_OSD", + "USE_SOFTSERIAL", + "USE_SONAR", + "USE_TELEMETRY", + "USE_SERVOS", + "USE_TRANSPONDER", + ]; virtualFC.CONFIG.craftName = "BetaFlight"; virtualFC.CONFIG.pilotName = "BF pilot"; diff --git a/src/js/tabs/configuration.js b/src/js/tabs/configuration.js index 13653261..9a7c0938 100644 --- a/src/js/tabs/configuration.js +++ b/src/js/tabs/configuration.js @@ -397,23 +397,11 @@ configuration.initialize = function (callback) { // UI hooks - function checkUpdateGpsControls() { - if (FC.FEATURE_CONFIG.features.isEnabled("GPS")) { - $(".gpsSettings").show(); - } else { - $(".gpsSettings").hide(); - } - } - $("input.feature", features_e).change(function () { const element = $(this); FC.FEATURE_CONFIG.features.updateData(element); updateTabList(FC.FEATURE_CONFIG.features); - - if (element.attr("name") === "GPS") { - checkUpdateGpsControls(); - } }); $('input[id="accHardwareSwitch"]') @@ -437,8 +425,6 @@ configuration.initialize = function (callback) { FC.BEEPER_CONFIG.beepers.updateData(element); }); - checkUpdateGpsControls(); - $("a.save").on("click", function () { // gather data that doesn't have automatic change event bound FC.BOARD_ALIGNMENT_CONFIG.roll = parseInt($('input[name="board_align_roll"]').val()); diff --git a/src/js/tabs/gps.js b/src/js/tabs/gps.js index c2047d43..9d1024cd 100644 --- a/src/js/tabs/gps.js +++ b/src/js/tabs/gps.js @@ -80,21 +80,13 @@ gps.initialize = async function (callback) { FC.FEATURE_CONFIG.features.generateElements(features_e); - const checkUpdateGpsControls = () => $(".gpsSettings").toggle(FC.FEATURE_CONFIG.features.isEnabled("GPS")); - $("input.feature", features_e).on("change", function () { const element = $(this); FC.FEATURE_CONFIG.features.updateData(element); updateTabList(FC.FEATURE_CONFIG.features); - - if (element.attr("name") === "GPS") { - checkUpdateGpsControls(); - } }); - checkUpdateGpsControls(); - // generate GPS const gpsProtocols = sensorTypes().gps.elements; diff --git a/src/js/utils/updateTabList.js b/src/js/utils/updateTabList.js index ccfe9a73..980d32cf 100644 --- a/src/js/utils/updateTabList.js +++ b/src/js/utils/updateTabList.js @@ -12,7 +12,7 @@ export function updateTabList(features) { isExpertModeEnabled && FC.CONFIG?.buildOptions?.includes("USE_SERVOS"), ); - $("#tabs ul.mode-connected li.tab_gps").toggle(features.isEnabled("GPS")); + $("#tabs ul.mode-connected li.tab_gps").toggle(FC.CONFIG?.buildOptions?.includes("USE_GPS")); $("#tabs ul.mode-connected li.tab_led_strip").toggle(features.isEnabled("LED_STRIP")); $("#tabs ul.mode-connected li.tab_transponder").toggle(features.isEnabled("TRANSPONDER")); $("#tabs ul.mode-connected li.tab_osd").toggle(features.isEnabled("OSD")); diff --git a/src/tabs/gps.html b/src/tabs/gps.html index c89b4a60..6a49c81e 100755 --- a/src/tabs/gps.html +++ b/src/tabs/gps.html @@ -15,6 +15,14 @@
+
+ + + + +
+
+