From 489ae28d2e18e18f0e6dbe80fea1a3586dd27de8 Mon Sep 17 00:00:00 2001 From: Adam M Rivera Date: Mon, 23 Apr 2012 09:59:45 -0500 Subject: [PATCH] Planner: Fixed binding issues with mode DDLs --- Tools/ArdupilotMegaPlanner/CurrentState.cs | 3 -- .../ConfigurationView/ConfigFlightModes.cs | 42 +------------------ 2 files changed, 2 insertions(+), 43 deletions(-) diff --git a/Tools/ArdupilotMegaPlanner/CurrentState.cs b/Tools/ArdupilotMegaPlanner/CurrentState.cs index ffd2da68ef..a185006355 100644 --- a/Tools/ArdupilotMegaPlanner/CurrentState.cs +++ b/Tools/ArdupilotMegaPlanner/CurrentState.cs @@ -535,9 +535,6 @@ namespace ArdupilotMega case (byte)(100 + Common.ac2modes.APPROACH): mode = EnumTranslator.GetDisplayText(Common.ac2modes.APPROACH); break; - case (byte)(100 + Common.ac2modes.APPROACH): - mode = "APPROACH"; - break; case (byte)(100 + Common.ac2modes.POSITION): mode = EnumTranslator.GetDisplayText(Common.ac2modes.POSITION); break; diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.cs index 863b3b9964..753e93c3b9 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.cs @@ -159,38 +159,19 @@ namespace ArdupilotMega.GCSViews.ConfigurationView CB_simple5.Visible = false; CB_simple6.Visible = false; - CMB_fmode1.Items.Clear(); - CMB_fmode2.Items.Clear(); - CMB_fmode3.Items.Clear(); - CMB_fmode4.Items.Clear(); - CMB_fmode5.Items.Clear(); - CMB_fmode6.Items.Clear(); - - var flightModes = EnumTranslator.Translate(); + var flightModes = EnumTranslator.Translate().Select(x => x.Value).OrderBy(x => x).ToList(); CMB_fmode1.DataSource = flightModes; - CMB_fmode1.ValueMember = "Value"; - CMB_fmode1.DisplayMember = "Value"; CMB_fmode2.DataSource = flightModes; - CMB_fmode2.ValueMember = "Value"; - CMB_fmode2.DisplayMember = "Value"; CMB_fmode3.DataSource = flightModes; - CMB_fmode3.ValueMember = "Value"; - CMB_fmode3.DisplayMember = "Value"; CMB_fmode4.DataSource = flightModes; - CMB_fmode4.ValueMember = "Value"; - CMB_fmode4.DisplayMember = "Value"; CMB_fmode5.DataSource = flightModes; - CMB_fmode5.ValueMember = "Value"; - CMB_fmode5.DisplayMember = "Value"; CMB_fmode6.DataSource = flightModes; - CMB_fmode6.ValueMember = "Value"; - CMB_fmode6.DisplayMember = "Value"; try { @@ -206,38 +187,19 @@ namespace ArdupilotMega.GCSViews.ConfigurationView } if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2) // ac2 { - CMB_fmode1.Items.Clear(); - CMB_fmode2.Items.Clear(); - CMB_fmode3.Items.Clear(); - CMB_fmode4.Items.Clear(); - CMB_fmode5.Items.Clear(); - CMB_fmode6.Items.Clear(); - - var flightModes = EnumTranslator.Translate(); + var flightModes = EnumTranslator.Translate().Select(x => x.Value).OrderBy(x => x).ToList(); CMB_fmode1.DataSource = flightModes; - CMB_fmode1.ValueMember = "Value"; - CMB_fmode1.DisplayMember = "Value"; CMB_fmode2.DataSource = flightModes; - CMB_fmode2.ValueMember = "Value"; - CMB_fmode2.DisplayMember = "Value"; CMB_fmode3.DataSource = flightModes; - CMB_fmode3.ValueMember = "Value"; - CMB_fmode3.DisplayMember = "Value"; CMB_fmode4.DataSource = flightModes; - CMB_fmode4.ValueMember = "Value"; - CMB_fmode4.DisplayMember = "Value"; CMB_fmode5.DataSource = flightModes; - CMB_fmode5.ValueMember = "Value"; - CMB_fmode5.DisplayMember = "Value"; CMB_fmode6.DataSource = flightModes; - CMB_fmode6.ValueMember = "Value"; - CMB_fmode6.DisplayMember = "Value"; try {