From 8518b6c5c08c5099202e467d45d4ab73900b1949 Mon Sep 17 00:00:00 2001 From: Mark Haslinghuis Date: Mon, 15 Sep 2025 17:06:49 +0200 Subject: [PATCH] Fix gyro enable box --- locales/en/messages.json | 3 +++ src/js/tabs/configuration.js | 28 ++++++++-------------------- src/tabs/configuration.html | 23 ++++++++++++++++++++++- 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/locales/en/messages.json b/locales/en/messages.json index 276582ddde..2c8a9881f7 100755 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -1501,6 +1501,9 @@ "configurationGyroActiveIMU": { "message": "Active IMU" }, + "configurationGyroActiveIMUHelp": { + "message": "Select which gyro to use as the primary gyro. The primary gyro is used for stabilization and control. If you have only one gyro, it will be selected automatically.

It is not always possible to enable multiple gyros, when they are of different types or brands." + }, "configurationGyroAlignmentRoll": { "message": "$t(configurationBoardAlignmentRoll.message)", "description": "Don't translate!!!" diff --git a/src/js/tabs/configuration.js b/src/js/tabs/configuration.js index e560278fdb..b535227e08 100644 --- a/src/js/tabs/configuration.js +++ b/src/js/tabs/configuration.js @@ -240,10 +240,8 @@ configuration.initialize = function (callback) { // Multi gyro handling for newer firmware if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) { - // Hide unused legacy elements - $(".gyro_alignment_inputs_selection").hide(); - $(".gyro_alignment_inputs_first").hide(); - $(".gyro_alignment_inputs_second").hide(); + // Hide deprecated gyro_box + $(".tab-configuration .gyro_box").parent().hide(); // Define gyro detection flags const GYRO_DETECTION_FLAGS = { DETECTED_DUAL_GYROS: 1 << 7 }; @@ -264,23 +262,10 @@ configuration.initialize = function (callback) { FC.SENSOR_ALIGNMENT.gyro_enable_mask = 1; } - // Use the specific gyro container (not the general sensor_align_content) - const gyroContainer = $(".sensor_align_content .gyro_align_box"); - // Clear any existing content in the gyro container - gyroContainer.empty(); - if (gyroCount > 1) { // Track which gyros are detected const detected_gyros = []; - $(".tab-configuration .gyro_box .spacer_box_title") - .attr("i18n", "configurationGyroActiveIMU") - .removeClass("i18n-replaced"); - i18n.localizePage(); // Update the title text - - // Make the gyro container visible - gyroContainer.show(); - function createGyroBox(gyroIndex, container) { // Create a new gyro alignment div const gyroBox = $(`
`); @@ -340,17 +325,20 @@ configuration.initialize = function (callback) { // If gyro is detected, create UI for it if (detected_gyros[i]) { - createGyroBox(i, gyroContainer); + createGyroBox(i, $(".tab-configuration .gyro_enable_configuration")); } } // Only show not found message if no gyros are detected - $(".gyro_alignment_inputs_notfound").toggle(!detected_gyros.some((detected) => detected)); + $(".gyro_notfound").toggle(!detected_gyros.some((detected) => detected)); } else { // Hide the gyro container if not needed - $(".tab-configuration .gyro_box").parent().hide(); + $(".tab-configuration .gyro_enable_box").parent().hide(); } } else { + // Hide the gyro enable box introduced in 1.47 + $(".tab-configuration .gyro_enable_box").parent().hide(); + // Original code for older firmware versions remains unchanged const orientation_gyro_to_use_e = $("select.gyro_to_use"); const orientation_gyro_1_align_e = $("select.gyro_1_align"); diff --git a/src/tabs/configuration.html b/src/tabs/configuration.html index 51771b089b..736c4f2508 100644 --- a/src/tabs/configuration.html +++ b/src/tabs/configuration.html @@ -185,7 +185,8 @@ - + +
@@ -229,6 +230,26 @@
+ + +
+
+
+
+
+
+ + + + +
+
+
+ +
+
+ +