From d36711b35bf933410ad950725a8f74cfd96b2b97 Mon Sep 17 00:00:00 2001 From: Bob Long Date: Fri, 27 Dec 2024 11:02:21 +1100 Subject: [PATCH] Joy_Mount_Mode: fix metadata --- Joystick/Joy_Mount_Mode.cs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Joystick/Joy_Mount_Mode.cs b/Joystick/Joy_Mount_Mode.cs index bac85eecc2..640607f183 100644 --- a/Joystick/Joy_Mount_Mode.cs +++ b/Joystick/Joy_Mount_Mode.cs @@ -1,5 +1,6 @@ using MissionPlanner.Utilities; using System; +using System.Collections.Generic; using System.Windows.Forms; namespace MissionPlanner.Joystick @@ -14,18 +15,18 @@ public Joy_Mount_Mode(string name) this.Tag = name; - comboBox1.ValueMember = "Key"; - comboBox1.DisplayMember = "Value"; - - var item1 = ParameterMetaDataRepository.GetParameterOptionsInt("MNT_MODE", - MainV2.comPort.MAV.cs.firmware.ToString()); - var item2 = ParameterMetaDataRepository.GetParameterOptionsInt("MNT_DEFLT_MODE", - MainV2.comPort.MAV.cs.firmware.ToString()); - if (item1.Count > 0) - comboBox1.DataSource = item1; - - if (item2.Count > 0) - comboBox1.DataSource = item2; + var mnt_mode_paramnames = new List { "MNT1_DEFLT_MODE", "MNT_DEFLT_MODE", "MNT_MODE" }; + foreach (var paramname in mnt_mode_paramnames) + { + var item = ParameterMetaDataRepository.GetParameterOptionsInt(paramname, MainV2.comPort.MAV.cs.firmware.ToString()); + if (item.Count > 0) + { + comboBox1.DataSource = item; + comboBox1.DisplayMember = "Value"; + comboBox1.ValueMember = "Key"; + break; + } + } this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);