diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs index 66eeef9582..d411445607 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs @@ -501,6 +501,8 @@ namespace ArdupilotMega.GCSViews string name = line.Substring(0, index); float value = float.Parse(line.Substring(index + 1), new System.Globalization.CultureInfo("en-US")); + MAVLink.modifyParamForDisplay(true,name,ref value); + // set param table as well foreach (DataGridViewRow row in Params.Rows) { @@ -541,7 +543,11 @@ namespace ArdupilotMega.GCSViews sw.WriteLine("NOTE: " + input.Replace(',', '|')); foreach (DataGridViewRow row in Params.Rows) { - sw.WriteLine(row.Cells[0].Value.ToString() + "," + float.Parse(row.Cells[1].Value.ToString()).ToString(new System.Globalization.CultureInfo("en-US"))); + float value = float.Parse(row.Cells[1].Value.ToString()); + + MAVLink.modifyParamForDisplay(false, row.Cells[0].Value.ToString(), ref value); + + sw.WriteLine(row.Cells[0].Value.ToString() + "," + value); } sw.Close(); } @@ -931,6 +937,8 @@ namespace ArdupilotMega.GCSViews string name = line.Substring(0, index); float value = float.Parse(line.Substring(index + 1), new System.Globalization.CultureInfo("en-US")); + MAVLink.modifyParamForDisplay(true, name, ref value); + if (name == "SYSID_SW_MREV") continue; if (name == "WP_TOTAL") diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs index 15f3a849f7..71408d070d 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs @@ -25,18 +25,18 @@ namespace ArdupilotMega.GCSViews private System.Windows.Forms.PictureBox pictureBoxY6; private System.Windows.Forms.Label lbl_status; private System.Windows.Forms.ProgressBar progress; - private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label lbl_AP; private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label6; - private Label label8; + private System.Windows.Forms.Label lbl_APHil; + private System.Windows.Forms.Label lbl_ACQuad; + private System.Windows.Forms.Label lbl_ACHexa; + private System.Windows.Forms.Label lbl_ACTri; + private Label lbl_Heli; private PictureBox pictureBoxHeli; private MyButton BUT_setup; - private Label label9; + private Label lbl_ACHil; private PictureBox pictureBoxQuadHil; - private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label lbl_ACY6; private void InitializeComponent() { @@ -49,16 +49,16 @@ namespace ArdupilotMega.GCSViews this.pictureBoxY6 = new System.Windows.Forms.PictureBox(); this.lbl_status = new System.Windows.Forms.Label(); this.progress = new System.Windows.Forms.ProgressBar(); - this.label1 = new System.Windows.Forms.Label(); + this.lbl_AP = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); + this.lbl_APHil = new System.Windows.Forms.Label(); + this.lbl_ACQuad = new System.Windows.Forms.Label(); + this.lbl_ACHexa = new System.Windows.Forms.Label(); + this.lbl_ACTri = new System.Windows.Forms.Label(); + this.lbl_ACY6 = new System.Windows.Forms.Label(); + this.lbl_Heli = new System.Windows.Forms.Label(); this.pictureBoxHeli = new System.Windows.Forms.PictureBox(); - this.label9 = new System.Windows.Forms.Label(); + this.lbl_ACHil = new System.Windows.Forms.Label(); this.pictureBoxQuadHil = new System.Windows.Forms.PictureBox(); this.BUT_setup = new ArdupilotMega.MyButton(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxAPM)).BeginInit(); @@ -136,45 +136,45 @@ namespace ArdupilotMega.GCSViews this.progress.Name = "progress"; this.progress.Step = 1; // - // label1 + // lbl_AP // - resources.ApplyResources(this.label1, "label1"); - this.label1.Name = "label1"; + resources.ApplyResources(this.lbl_AP, "lbl_AP"); + this.lbl_AP.Name = "lbl_AP"; // // label2 // resources.ApplyResources(this.label2, "label2"); this.label2.Name = "label2"; // - // label3 + // lbl_APHil // - resources.ApplyResources(this.label3, "label3"); - this.label3.Name = "label3"; + resources.ApplyResources(this.lbl_APHil, "lbl_APHil"); + this.lbl_APHil.Name = "lbl_APHil"; // - // label4 + // lbl_ACQuad // - resources.ApplyResources(this.label4, "label4"); - this.label4.Name = "label4"; + resources.ApplyResources(this.lbl_ACQuad, "lbl_ACQuad"); + this.lbl_ACQuad.Name = "lbl_ACQuad"; // - // label5 + // lbl_ACHexa // - resources.ApplyResources(this.label5, "label5"); - this.label5.Name = "label5"; + resources.ApplyResources(this.lbl_ACHexa, "lbl_ACHexa"); + this.lbl_ACHexa.Name = "lbl_ACHexa"; // - // label6 + // lbl_ACTri // - resources.ApplyResources(this.label6, "label6"); - this.label6.Name = "label6"; + resources.ApplyResources(this.lbl_ACTri, "lbl_ACTri"); + this.lbl_ACTri.Name = "lbl_ACTri"; // - // label7 + // lbl_ACY6 // - resources.ApplyResources(this.label7, "label7"); - this.label7.Name = "label7"; + resources.ApplyResources(this.lbl_ACY6, "lbl_ACY6"); + this.lbl_ACY6.Name = "lbl_ACY6"; // - // label8 + // lbl_Heli // - resources.ApplyResources(this.label8, "label8"); - this.label8.Name = "label8"; + resources.ApplyResources(this.lbl_Heli, "lbl_Heli"); + this.lbl_Heli.Name = "lbl_Heli"; // // pictureBoxHeli // @@ -185,10 +185,10 @@ namespace ArdupilotMega.GCSViews this.pictureBoxHeli.TabStop = false; this.pictureBoxHeli.Click += new System.EventHandler(this.pictureBoxHeli_Click); // - // label9 + // lbl_ACHil // - resources.ApplyResources(this.label9, "label9"); - this.label9.Name = "label9"; + resources.ApplyResources(this.lbl_ACHil, "lbl_ACHil"); + this.lbl_ACHil.Name = "lbl_ACHil"; // // pictureBoxQuadHil // @@ -210,18 +210,18 @@ namespace ArdupilotMega.GCSViews // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.label9); + this.Controls.Add(this.lbl_ACHil); this.Controls.Add(this.pictureBoxQuadHil); this.Controls.Add(this.BUT_setup); - this.Controls.Add(this.label8); + this.Controls.Add(this.lbl_Heli); this.Controls.Add(this.pictureBoxHeli); - this.Controls.Add(this.label7); - this.Controls.Add(this.label6); - this.Controls.Add(this.label5); - this.Controls.Add(this.label4); - this.Controls.Add(this.label3); + this.Controls.Add(this.lbl_ACY6); + this.Controls.Add(this.lbl_ACTri); + this.Controls.Add(this.lbl_ACHexa); + this.Controls.Add(this.lbl_ACQuad); + this.Controls.Add(this.lbl_APHil); this.Controls.Add(this.label2); - this.Controls.Add(this.label1); + this.Controls.Add(this.lbl_AP); this.Controls.Add(this.lbl_status); this.Controls.Add(this.progress); this.Controls.Add(this.pictureBoxY6); @@ -335,6 +335,12 @@ namespace ArdupilotMega.GCSViews temp.url2560 = url2560; temp.k_format_version = k_format_version; + try + { + updateDisplayName(temp); + } + catch { } // just in case + softwares.Add(temp); } url = ""; @@ -356,6 +362,42 @@ namespace ArdupilotMega.GCSViews catch (Exception ex) { MessageBox.Show("Failed to get Firmware List : " + ex.Message); } } + void updateDisplayName(software temp) + { + if (temp.url.ToLower().Contains("firmware/AP-1".ToLower())) + { + lbl_AP.Text = temp.name; + } + else if (temp.url.ToLower().Contains("firmware/APHIL-".ToLower())) + { + lbl_APHil.Text = temp.name; + } + else if (temp.url.ToLower().Contains("firmware/ac2-quad-".ToLower())) + { + lbl_ACQuad.Text = temp.name; + } + else if (temp.url.ToLower().Contains("firmware/ac2-tri".ToLower())) + { + lbl_ACTri.Text = temp.name; + } + else if (temp.url.ToLower().Contains("firmware/ac2-hexa".ToLower())) + { + lbl_ACHexa.Text = temp.name; + } + else if (temp.url.ToLower().Contains("firmware/ac2-y6".ToLower())) + { + lbl_ACY6.Text = temp.name; + } + else if (temp.url.ToLower().Contains("firmware/ac2-heli".ToLower())) + { + lbl_Heli.Text = temp.name; + } + else if (temp.url.ToLower().Contains("firmware/ac2-quadhil".ToLower())) + { + lbl_ACHil.Text = temp.name; + } + } + void findfirmware(string findwhat) { foreach (software temp in softwares) @@ -376,7 +418,7 @@ namespace ArdupilotMega.GCSViews private void pictureBoxAPM_Click(object sender, EventArgs e) { - findfirmware("firmware/AP-"); + findfirmware("firmware/AP-1"); } private void pictureBoxAPMHIL_Click(object sender, EventArgs e) diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.resx b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.resx index 7283c0a474..ff5d72d8b1 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.resx @@ -336,34 +336,34 @@ 13 - - True - - + NoControl - - 113, 167 + + 42, 168 - - 56, 13 + + 190, 13 - + 8 - + ArduPlane - - label1 + + TopCenter - + + lbl_AP + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 11 @@ -396,184 +396,184 @@ 10 - - True - - + NoControl - - 74, 361 + + 42, 361 - - 142, 13 + + 190, 13 - + 10 - + ArduPlane (Xplane simulator) - - label3 + + TopCenter - + + lbl_APHil + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 9 - - True - - + NoControl - - 612, 168 + + 560, 168 - - 89, 13 + + 190, 13 - + 11 - + ArduCopter Quad - - label4 + + TopCenter - + + lbl_ACQuad + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 8 - - True - - + NoControl - - 817, 167 + + 767, 168 - - 88, 13 + + 190, 13 - + 12 - + ArduCopter Hexa - - label5 + + TopCenter - + + lbl_ACHexa + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 7 - - True - - + NoControl - - 623, 355 + + 560, 361 - - 75, 13 + + 190, 13 - + 13 - + ArduCopter Tri - - label6 + + TopCenter - + + lbl_ACTri + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 6 - - True - - + NoControl - - 831, 355 + + 767, 361 - - 76, 13 + + 190, 13 - + 14 - + ArduCopter Y6 - - label7 + + TopCenter - + + lbl_ACY6 + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 5 - - True - - + NoControl - - 372, 168 + + 310, 167 - - 81, 13 + + 190, 13 - + 18 - + ArduCopter Heli - - label8 + + TopCenter - + + lbl_Heli + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 3 @@ -603,34 +603,34 @@ 4 - - True - - + NoControl - - 337, 361 + + 310, 361 - - 141, 13 + + 190, 13 - + 21 - + ArduCopter Quad (Simulator) - - label9 + + TopCenter - + + lbl_ACHil + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 0 diff --git a/Tools/ArdupilotMegaPlanner/MAVLink.cs b/Tools/ArdupilotMegaPlanner/MAVLink.cs index 62f74a93c7..cbc84537ed 100644 --- a/Tools/ArdupilotMegaPlanner/MAVLink.cs +++ b/Tools/ArdupilotMegaPlanner/MAVLink.cs @@ -646,7 +646,7 @@ namespace ArdupilotMega return param; } - void modifyParamForDisplay(bool fromapm, string paramname, ref float value) + public static void modifyParamForDisplay(bool fromapm, string paramname, ref float value) { if (paramname.ToUpper().EndsWith("_IMAX") || paramname.ToUpper().EndsWith("ALT_HOLD_RTL") || paramname.ToUpper().EndsWith("TRIM_ARSPD_CM") || paramname.ToUpper().EndsWith("XTRK_ANGLE_CD") || paramname.ToUpper().EndsWith("LIM_PITCH_MAX") || paramname.ToUpper().EndsWith("LIM_PITCH_MIN") diff --git a/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs b/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs index d3bb6cfd8a..639de564f4 100644 --- a/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs +++ b/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs @@ -34,5 +34,5 @@ using System.Resources; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.73")] +[assembly: AssemblyFileVersion("1.0.74")] [assembly: NeutralResourcesLanguageAttribute("")] diff --git a/Tools/ArdupilotMegaPlanner/Setup/Setup.Designer.cs b/Tools/ArdupilotMegaPlanner/Setup/Setup.Designer.cs index 4bf673fa62..f591710b7b 100644 --- a/Tools/ArdupilotMegaPlanner/Setup/Setup.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/Setup/Setup.Designer.cs @@ -49,7 +49,6 @@ this.BARyaw = new ArdupilotMega.HorizontalProgressBar2(); this.BARroll = new ArdupilotMega.HorizontalProgressBar2(); this.tabModes = new System.Windows.Forms.TabPage(); - this.label29 = new System.Windows.Forms.Label(); this.CB_simple6 = new System.Windows.Forms.CheckBox(); this.CB_simple5 = new System.Windows.Forms.CheckBox(); this.CB_simple4 = new System.Windows.Forms.CheckBox(); @@ -81,20 +80,31 @@ this.BUT_SaveModes = new ArdupilotMega.MyButton(); this.tabHardware = new System.Windows.Forms.TabPage(); this.linkLabelmagdec = new System.Windows.Forms.LinkLabel(); - this.label106 = new System.Windows.Forms.Label(); - this.label105 = new System.Windows.Forms.Label(); - this.TXT_battcapacity = new System.Windows.Forms.TextBox(); - this.CMB_batmontype = new System.Windows.Forms.ComboBox(); this.label100 = new System.Windows.Forms.Label(); this.TXT_declination = new System.Windows.Forms.TextBox(); this.CHK_enableairspeed = new System.Windows.Forms.CheckBox(); this.CHK_enablesonar = new System.Windows.Forms.CheckBox(); - this.CHK_enablebattmon = new System.Windows.Forms.CheckBox(); this.CHK_enablecompass = new System.Windows.Forms.CheckBox(); this.pictureBox4 = new System.Windows.Forms.PictureBox(); this.pictureBox3 = new System.Windows.Forms.PictureBox(); - this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.tabBattery = new System.Windows.Forms.TabPage(); + this.TXT_ampspervolt = new System.Windows.Forms.TextBox(); + this.TXT_divider = new System.Windows.Forms.TextBox(); + this.TXT_voltage = new System.Windows.Forms.TextBox(); + this.TXT_measuredvoltage = new System.Windows.Forms.TextBox(); + this.TXT_inputvoltage = new System.Windows.Forms.TextBox(); + this.label35 = new System.Windows.Forms.Label(); + this.label34 = new System.Windows.Forms.Label(); + this.label33 = new System.Windows.Forms.Label(); + this.label32 = new System.Windows.Forms.Label(); + this.label31 = new System.Windows.Forms.Label(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.label29 = new System.Windows.Forms.Label(); + this.label30 = new System.Windows.Forms.Label(); + this.TXT_battcapacity = new System.Windows.Forms.TextBox(); + this.CMB_batmontype = new System.Windows.Forms.ComboBox(); + this.pictureBox5 = new System.Windows.Forms.PictureBox(); this.tabArducopter = new System.Windows.Forms.TabPage(); this.label28 = new System.Windows.Forms.Label(); this.label16 = new System.Windows.Forms.Label(); @@ -144,8 +154,9 @@ this.tabHardware.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.tabBattery.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit(); this.tabArducopter.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuadX)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuad)).BeginInit(); @@ -162,6 +173,7 @@ this.tabControl1.Controls.Add(this.tabRadioIn); this.tabControl1.Controls.Add(this.tabModes); this.tabControl1.Controls.Add(this.tabHardware); + this.tabControl1.Controls.Add(this.tabBattery); this.tabControl1.Controls.Add(this.tabArducopter); this.tabControl1.Controls.Add(this.tabHeli); resources.ApplyResources(this.tabControl1, "tabControl1"); @@ -364,7 +376,6 @@ // // tabModes // - this.tabModes.Controls.Add(this.label29); this.tabModes.Controls.Add(this.CB_simple6); this.tabModes.Controls.Add(this.CB_simple5); this.tabModes.Controls.Add(this.CB_simple4); @@ -398,11 +409,6 @@ this.tabModes.Name = "tabModes"; this.tabModes.UseVisualStyleBackColor = true; // - // label29 - // - resources.ApplyResources(this.label29, "label29"); - this.label29.Name = "label29"; - // // CB_simple6 // resources.ApplyResources(this.CB_simple6, "CB_simple6"); @@ -585,19 +591,13 @@ // this.tabHardware.BackColor = System.Drawing.Color.DarkRed; this.tabHardware.Controls.Add(this.linkLabelmagdec); - this.tabHardware.Controls.Add(this.label106); - this.tabHardware.Controls.Add(this.label105); - this.tabHardware.Controls.Add(this.TXT_battcapacity); - this.tabHardware.Controls.Add(this.CMB_batmontype); this.tabHardware.Controls.Add(this.label100); this.tabHardware.Controls.Add(this.TXT_declination); this.tabHardware.Controls.Add(this.CHK_enableairspeed); this.tabHardware.Controls.Add(this.CHK_enablesonar); - this.tabHardware.Controls.Add(this.CHK_enablebattmon); this.tabHardware.Controls.Add(this.CHK_enablecompass); this.tabHardware.Controls.Add(this.pictureBox4); this.tabHardware.Controls.Add(this.pictureBox3); - this.tabHardware.Controls.Add(this.pictureBox2); this.tabHardware.Controls.Add(this.pictureBox1); resources.ApplyResources(this.tabHardware, "tabHardware"); this.tabHardware.Name = "tabHardware"; @@ -609,35 +609,6 @@ this.linkLabelmagdec.TabStop = true; this.linkLabelmagdec.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); // - // label106 - // - resources.ApplyResources(this.label106, "label106"); - this.label106.Name = "label106"; - // - // label105 - // - resources.ApplyResources(this.label105, "label105"); - this.label105.Name = "label105"; - // - // TXT_battcapacity - // - resources.ApplyResources(this.TXT_battcapacity, "TXT_battcapacity"); - this.TXT_battcapacity.Name = "TXT_battcapacity"; - this.TXT_battcapacity.Validated += new System.EventHandler(this.TXT_battcapacity_Validated); - // - // CMB_batmontype - // - this.CMB_batmontype.FormattingEnabled = true; - this.CMB_batmontype.Items.AddRange(new object[] { - resources.GetString("CMB_batmontype.Items"), - resources.GetString("CMB_batmontype.Items1"), - resources.GetString("CMB_batmontype.Items2"), - resources.GetString("CMB_batmontype.Items3"), - resources.GetString("CMB_batmontype.Items4")}); - resources.ApplyResources(this.CMB_batmontype, "CMB_batmontype"); - this.CMB_batmontype.Name = "CMB_batmontype"; - this.CMB_batmontype.SelectedIndexChanged += new System.EventHandler(this.CMB_batmontype_SelectedIndexChanged); - // // label100 // resources.ApplyResources(this.label100, "label100"); @@ -664,13 +635,6 @@ this.CHK_enablesonar.UseVisualStyleBackColor = true; this.CHK_enablesonar.CheckedChanged += new System.EventHandler(this.CHK_enablesonar_CheckedChanged); // - // CHK_enablebattmon - // - resources.ApplyResources(this.CHK_enablebattmon, "CHK_enablebattmon"); - this.CHK_enablebattmon.Name = "CHK_enablebattmon"; - this.CHK_enablebattmon.UseVisualStyleBackColor = true; - this.CHK_enablebattmon.CheckedChanged += new System.EventHandler(this.CHK_enablebattmon_CheckedChanged); - // // CHK_enablecompass // resources.ApplyResources(this.CHK_enablecompass, "CHK_enablecompass"); @@ -696,15 +660,6 @@ this.pictureBox3.Name = "pictureBox3"; this.pictureBox3.TabStop = false; // - // pictureBox2 - // - this.pictureBox2.BackColor = System.Drawing.Color.White; - this.pictureBox2.BackgroundImage = global::ArdupilotMega.Properties.Resources.attocurrent; - resources.ApplyResources(this.pictureBox2, "pictureBox2"); - this.pictureBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.pictureBox2.Name = "pictureBox2"; - this.pictureBox2.TabStop = false; - // // pictureBox1 // this.pictureBox1.BackgroundImage = global::ArdupilotMega.Properties.Resources.compass; @@ -713,6 +668,133 @@ this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.TabStop = false; // + // tabBattery + // + this.tabBattery.Controls.Add(this.TXT_ampspervolt); + this.tabBattery.Controls.Add(this.TXT_divider); + this.tabBattery.Controls.Add(this.TXT_voltage); + this.tabBattery.Controls.Add(this.TXT_measuredvoltage); + this.tabBattery.Controls.Add(this.TXT_inputvoltage); + this.tabBattery.Controls.Add(this.label35); + this.tabBattery.Controls.Add(this.label34); + this.tabBattery.Controls.Add(this.label33); + this.tabBattery.Controls.Add(this.label32); + this.tabBattery.Controls.Add(this.label31); + this.tabBattery.Controls.Add(this.textBox3); + this.tabBattery.Controls.Add(this.label29); + this.tabBattery.Controls.Add(this.label30); + this.tabBattery.Controls.Add(this.TXT_battcapacity); + this.tabBattery.Controls.Add(this.CMB_batmontype); + this.tabBattery.Controls.Add(this.pictureBox5); + resources.ApplyResources(this.tabBattery, "tabBattery"); + this.tabBattery.Name = "tabBattery"; + this.tabBattery.UseVisualStyleBackColor = true; + // + // TXT_ampspervolt + // + resources.ApplyResources(this.TXT_ampspervolt, "TXT_ampspervolt"); + this.TXT_ampspervolt.Name = "TXT_ampspervolt"; + this.TXT_ampspervolt.Validating += new System.ComponentModel.CancelEventHandler(this.TXT_ampspervolt_Validating); + this.TXT_ampspervolt.Validated += new System.EventHandler(this.TXT_ampspervolt_Validated); + // + // TXT_divider + // + resources.ApplyResources(this.TXT_divider, "TXT_divider"); + this.TXT_divider.Name = "TXT_divider"; + this.TXT_divider.Validating += new System.ComponentModel.CancelEventHandler(this.TXT_divider_Validating); + this.TXT_divider.Validated += new System.EventHandler(this.TXT_divider_Validated); + // + // TXT_voltage + // + this.TXT_voltage.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.currentStateBindingSource, "battery_voltage", true)); + resources.ApplyResources(this.TXT_voltage, "TXT_voltage"); + this.TXT_voltage.Name = "TXT_voltage"; + this.TXT_voltage.ReadOnly = true; + // + // TXT_measuredvoltage + // + resources.ApplyResources(this.TXT_measuredvoltage, "TXT_measuredvoltage"); + this.TXT_measuredvoltage.Name = "TXT_measuredvoltage"; + this.TXT_measuredvoltage.Validating += new System.ComponentModel.CancelEventHandler(this.TXT_measuredvoltage_Validating); + this.TXT_measuredvoltage.Validated += new System.EventHandler(this.TXT_measuredvoltage_Validated); + // + // TXT_inputvoltage + // + resources.ApplyResources(this.TXT_inputvoltage, "TXT_inputvoltage"); + this.TXT_inputvoltage.Name = "TXT_inputvoltage"; + this.TXT_inputvoltage.Validating += new System.ComponentModel.CancelEventHandler(this.TXT_inputvoltage_Validating); + this.TXT_inputvoltage.Validated += new System.EventHandler(this.TXT_inputvoltage_Validated); + // + // label35 + // + resources.ApplyResources(this.label35, "label35"); + this.label35.Name = "label35"; + // + // label34 + // + resources.ApplyResources(this.label34, "label34"); + this.label34.Name = "label34"; + // + // label33 + // + resources.ApplyResources(this.label33, "label33"); + this.label33.Name = "label33"; + // + // label32 + // + resources.ApplyResources(this.label32, "label32"); + this.label32.Name = "label32"; + // + // label31 + // + resources.ApplyResources(this.label31, "label31"); + this.label31.Name = "label31"; + // + // textBox3 + // + resources.ApplyResources(this.textBox3, "textBox3"); + this.textBox3.Name = "textBox3"; + this.textBox3.ReadOnly = true; + // + // label29 + // + resources.ApplyResources(this.label29, "label29"); + this.label29.Name = "label29"; + // + // label30 + // + resources.ApplyResources(this.label30, "label30"); + this.label30.Name = "label30"; + // + // TXT_battcapacity + // + resources.ApplyResources(this.TXT_battcapacity, "TXT_battcapacity"); + this.TXT_battcapacity.Name = "TXT_battcapacity"; + this.TXT_battcapacity.Validating += new System.ComponentModel.CancelEventHandler(this.TXT_battcapacity_Validating); + this.TXT_battcapacity.Validated += new System.EventHandler(this.TXT_battcapacity_Validated); + // + // CMB_batmontype + // + this.CMB_batmontype.FormattingEnabled = true; + this.CMB_batmontype.Items.AddRange(new object[] { + resources.GetString("CMB_batmontype.Items"), + resources.GetString("CMB_batmontype.Items1"), + resources.GetString("CMB_batmontype.Items2"), + resources.GetString("CMB_batmontype.Items3"), + resources.GetString("CMB_batmontype.Items4")}); + resources.ApplyResources(this.CMB_batmontype, "CMB_batmontype"); + this.CMB_batmontype.Name = "CMB_batmontype"; + this.CMB_batmontype.SelectedIndexChanged += new System.EventHandler(this.CMB_batmontype_SelectedIndexChanged); + // + // pictureBox5 + // + this.pictureBox5.BackColor = System.Drawing.Color.White; + this.pictureBox5.BackgroundImage = global::ArdupilotMega.Properties.Resources.attocurrent; + resources.ApplyResources(this.pictureBox5, "pictureBox5"); + this.pictureBox5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.pictureBox5.Name = "pictureBox5"; + this.pictureBox5.TabStop = false; + // // tabArducopter // this.tabArducopter.Controls.Add(this.label28); @@ -1188,8 +1270,10 @@ this.tabHardware.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.tabBattery.ResumeLayout(false); + this.tabBattery.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit(); this.tabArducopter.ResumeLayout(false); this.tabArducopter.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuadX)).EndInit(); @@ -1246,17 +1330,11 @@ private System.Windows.Forms.Label LBL_flightmodepwm; private System.Windows.Forms.PictureBox pictureBox4; private System.Windows.Forms.PictureBox pictureBox3; - private System.Windows.Forms.PictureBox pictureBox2; private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.Label label106; - private System.Windows.Forms.Label label105; - private System.Windows.Forms.TextBox TXT_battcapacity; - private System.Windows.Forms.ComboBox CMB_batmontype; private System.Windows.Forms.Label label100; private System.Windows.Forms.TextBox TXT_declination; private System.Windows.Forms.CheckBox CHK_enableairspeed; private System.Windows.Forms.CheckBox CHK_enablesonar; - private System.Windows.Forms.CheckBox CHK_enablebattmon; private System.Windows.Forms.CheckBox CHK_enablecompass; private System.Windows.Forms.TabPage tabReset; private MyButton BUT_reset; @@ -1312,6 +1390,22 @@ private System.Windows.Forms.CheckBox CB_simple2; private System.Windows.Forms.CheckBox CB_simple1; private System.Windows.Forms.Label label29; + private System.Windows.Forms.TabPage tabBattery; + private System.Windows.Forms.Label label30; + private System.Windows.Forms.TextBox TXT_battcapacity; + private System.Windows.Forms.ComboBox CMB_batmontype; + private System.Windows.Forms.PictureBox pictureBox5; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.Label label31; + private System.Windows.Forms.TextBox TXT_ampspervolt; + private System.Windows.Forms.TextBox TXT_divider; + private System.Windows.Forms.TextBox TXT_voltage; + private System.Windows.Forms.TextBox TXT_measuredvoltage; + private System.Windows.Forms.TextBox TXT_inputvoltage; + private System.Windows.Forms.Label label35; + private System.Windows.Forms.Label label34; + private System.Windows.Forms.Label label33; + private System.Windows.Forms.Label label32; } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/Setup/Setup.cs b/Tools/ArdupilotMegaPlanner/Setup/Setup.cs index 9e0d0cd219..8d52363560 100644 --- a/Tools/ArdupilotMegaPlanner/Setup/Setup.cs +++ b/Tools/ArdupilotMegaPlanner/Setup/Setup.cs @@ -334,20 +334,47 @@ namespace ArdupilotMega.Setup if (MainV2.comPort.param["MAG_ENABLE"] != null) CHK_enablecompass.Checked = MainV2.comPort.param["MAG_ENABLE"].ToString() == "1" ? true : false; + if (MainV2.comPort.param["COMPASS_DEC"] != null) + TXT_declination.Text = (float.Parse(MainV2.comPort.param["COMPASS_DEC"].ToString()) * rad2deg).ToString(); + startup = false; + } + + if (tabControl1.SelectedTab == tabBattery) + { + startup = true; + bool not_supported = false; if (MainV2.comPort.param["BATT_MONITOR"] != null) { if (MainV2.comPort.param["BATT_MONITOR"].ToString() != "0") { - CHK_enablebattmon.Checked = true; CMB_batmontype.SelectedIndex = (int)float.Parse(MainV2.comPort.param["BATT_MONITOR"].ToString()); } } - if (MainV2.comPort.param["COMPASS_DEC"] != null) - TXT_declination.Text = (float.Parse(MainV2.comPort.param["COMPASS_DEC"].ToString()) * rad2deg).ToString(); if (MainV2.comPort.param["BATT_CAPACITY"] != null) TXT_battcapacity.Text = MainV2.comPort.param["BATT_CAPACITY"].ToString(); + if (MainV2.comPort.param["INPUT_VOLTS"] != null) + TXT_inputvoltage.Text = MainV2.comPort.param["INPUT_VOLTS"].ToString(); + else + not_supported = true; + TXT_voltage.Text = MainV2.cs.battery_voltage.ToString(); + TXT_measuredvoltage.Text = TXT_voltage.Text; + if (MainV2.comPort.param["VOLT_DIVIDER"] != null) + TXT_divider.Text = MainV2.comPort.param["VOLT_DIVIDER"].ToString(); + else + not_supported = true; + if (MainV2.comPort.param["AMP_PER_VOLT"] != null) + TXT_ampspervolt.Text = MainV2.comPort.param["AMP_PER_VOLT"].ToString(); + else + not_supported = true; + if (not_supported) + { + TXT_inputvoltage.Enabled = false; + TXT_measuredvoltage.Enabled = false; + TXT_divider.Enabled = false; + TXT_ampspervolt.Enabled = false; + } startup = false; } @@ -434,44 +461,13 @@ namespace ArdupilotMega.Setup } catch { MessageBox.Show("Failed to set Flight modes"); } } + private void TXT_declination_Validating(object sender, CancelEventArgs e) { float ans = 0; e.Cancel = !float.TryParse(TXT_declination.Text, out ans); } - private void TXT_battcapacity_Validating(object sender, CancelEventArgs e) - { - float ans = 0; - e.Cancel = !float.TryParse(TXT_declination.Text, out ans); - } - - private void CMB_batmontype_SelectedIndexChanged(object sender, EventArgs e) - { - if (startup) - return; - try - { - if (MainV2.comPort.param["BATT_MONITOR"] == null) - { - MessageBox.Show("Not Available"); - } - else - { - MainV2.comPort.setParam("BATT_MONITOR", CMB_batmontype.SelectedIndex); - if (CMB_batmontype.SelectedIndex != 0) - { - CHK_enablebattmon.Checked = true; - } - else - { - CHK_enablebattmon.Checked = false; - } - } - } - catch { MessageBox.Show("Set BATT_MONITOR Failed"); } - } - private void TXT_declination_Validated(object sender, EventArgs e) { if (startup) @@ -508,23 +504,6 @@ namespace ArdupilotMega.Setup catch { MessageBox.Show("Set COMPASS_DEC Failed"); } } - private void TXT_battcapacity_Validated(object sender, EventArgs e) - { - if (startup || ((TextBox)sender).Enabled == false) - return; - try - { - if (MainV2.comPort.param["BATT_CAPACITY"] == null) - { - MessageBox.Show("Not Available"); - } - else - { - MainV2.comPort.setParam("BATT_CAPACITY", float.Parse(TXT_battcapacity.Text)); - } - } - catch { MessageBox.Show("Set BATT_CAPACITY Failed"); } - } private void CHK_enablecompass_CheckedChanged(object sender, EventArgs e) { @@ -546,24 +525,6 @@ namespace ArdupilotMega.Setup //((CheckBox)sender).Checked = !((CheckBox)sender).Checked; - private void CHK_enablebattmon_CheckedChanged(object sender, EventArgs e) - { - if (startup) - return; - try - { - if (((CheckBox)sender).Checked == false) - { - CMB_batmontype.SelectedIndex = 0; - } - else - { - if (CMB_batmontype.SelectedIndex <= 0) - CMB_batmontype.SelectedIndex = 1; - } - } - catch { MessageBox.Show("Set BATT_MONITOR Failed"); } - } private void CHK_enablesonar_CheckedChanged(object sender, EventArgs e) { @@ -600,6 +561,158 @@ namespace ArdupilotMega.Setup } catch { MessageBox.Show("Set ARSPD_ENABLE Failed"); } } + private void CHK_enablebattmon_CheckedChanged(object sender, EventArgs e) + { + if (startup) + return; + try + { + if (((CheckBox)sender).Checked == false) + { + CMB_batmontype.SelectedIndex = 0; + } + else + { + if (CMB_batmontype.SelectedIndex <= 0) + CMB_batmontype.SelectedIndex = 1; + } + } + catch { MessageBox.Show("Set BATT_MONITOR Failed"); } + } + private void TXT_battcapacity_Validating(object sender, CancelEventArgs e) + { + float ans = 0; + e.Cancel = !float.TryParse(TXT_declination.Text, out ans); + } + private void TXT_battcapacity_Validated(object sender, EventArgs e) + { + if (startup || ((TextBox)sender).Enabled == false) + return; + try + { + if (MainV2.comPort.param["BATT_CAPACITY"] == null) + { + MessageBox.Show("Not Available"); + } + else + { + MainV2.comPort.setParam("BATT_CAPACITY", float.Parse(TXT_battcapacity.Text)); + } + } + catch { MessageBox.Show("Set BATT_CAPACITY Failed"); } + } + private void CMB_batmontype_SelectedIndexChanged(object sender, EventArgs e) + { + if (startup) + return; + try + { + if (MainV2.comPort.param["BATT_MONITOR"] == null) + { + MessageBox.Show("Not Available"); + } + else + { + MainV2.comPort.setParam("BATT_MONITOR", CMB_batmontype.SelectedIndex); + } + } + catch { MessageBox.Show("Set BATT_MONITOR Failed"); } + } + private void TXT_inputvoltage_Validating(object sender, CancelEventArgs e) + { + float ans = 0; + e.Cancel = !float.TryParse(TXT_inputvoltage.Text, out ans); + } + private void TXT_inputvoltage_Validated(object sender, EventArgs e) + { + if (startup || ((TextBox)sender).Enabled == false) + return; + try + { + if (MainV2.comPort.param["INPUT_VOLTS"] == null) + { + MessageBox.Show("Not Available"); + } + else + { + MainV2.comPort.setParam("INPUT_VOLTS", float.Parse(TXT_inputvoltage.Text)); + } + } + catch { MessageBox.Show("Set INPUT_VOLTS Failed"); } + } + private void TXT_measuredvoltage_Validating(object sender, CancelEventArgs e) + { + float ans = 0; + e.Cancel = !float.TryParse(TXT_measuredvoltage.Text, out ans); + } + private void TXT_measuredvoltage_Validated(object sender, EventArgs e) + { + if (startup || ((TextBox)sender).Enabled == false) + return; + float measuredvoltage = float.Parse(TXT_measuredvoltage.Text); + float voltage = float.Parse(TXT_voltage.Text); + float divider = float.Parse(TXT_divider.Text); + if (voltage == 0) + return; + float new_divider = (measuredvoltage * divider) / voltage; + TXT_divider.Text = new_divider.ToString(); + try + { + if (MainV2.comPort.param["VOLT_DIVIDER"] == null) + { + MessageBox.Show("Not Available"); + } + else + { + MainV2.comPort.setParam("VOLT_DIVIDER", float.Parse(TXT_divider.Text)); + } + } + catch { MessageBox.Show("Set VOLT_DIVIDER Failed"); } + } + private void TXT_divider_Validating(object sender, CancelEventArgs e) + { + float ans = 0; + e.Cancel = !float.TryParse(TXT_divider.Text, out ans); + } + private void TXT_divider_Validated(object sender, EventArgs e) + { + if (startup || ((TextBox)sender).Enabled == false) + return; + try + { + if (MainV2.comPort.param["VOLT_DIVIDER"] == null) + { + MessageBox.Show("Not Available"); + } + else + { + MainV2.comPort.setParam("VOLT_DIVIDER", float.Parse(TXT_divider.Text)); + } + } + catch { MessageBox.Show("Set VOLT_DIVIDER Failed"); } + } + private void TXT_ampspervolt_Validating(object sender, CancelEventArgs e) + { + float ans = 0; + e.Cancel = !float.TryParse(TXT_ampspervolt.Text, out ans); + } + private void TXT_ampspervolt_Validated(object sender, EventArgs e) + { + if (startup || ((TextBox)sender).Enabled == false) + return; + try + { + if (MainV2.comPort.param["AMP_PER_VOLT"] == null) + { + MessageBox.Show("Not Available"); + } + else + { + MainV2.comPort.setParam("AMP_PER_VOLT", float.Parse(TXT_ampspervolt.Text)); + } + } + catch { MessageBox.Show("Set AMP_PER_VOLT Failed"); } + } private void BUT_reset_Click(object sender, EventArgs e) { diff --git a/Tools/ArdupilotMegaPlanner/Setup/Setup.resx b/Tools/ArdupilotMegaPlanner/Setup/Setup.resx index 2c2973ce03..d62fdbd971 100644 --- a/Tools/ArdupilotMegaPlanner/Setup/Setup.resx +++ b/Tools/ArdupilotMegaPlanner/Setup/Setup.resx @@ -516,33 +516,6 @@ 1 - - True - - - 90, 310 - - - 487, 13 - - - 120 - - - NOTE: Please use the CLI to set modes For AC 2.0.42 or bellow as the mode numbers have changed. - - - label29 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabModes - - - 0 - True @@ -550,7 +523,10 @@ NoControl - 372, 235 + 380, 235 + + + 2, 2, 2, 2 87, 17 @@ -571,7 +547,7 @@ tabModes - 1 + 0 True @@ -580,7 +556,10 @@ NoControl - 373, 208 + 380, 208 + + + 2, 2, 2, 2 87, 17 @@ -601,7 +580,7 @@ tabModes - 2 + 1 True @@ -610,7 +589,10 @@ NoControl - 372, 181 + 380, 181 + + + 2, 2, 2, 2 87, 17 @@ -631,7 +613,7 @@ tabModes - 3 + 2 True @@ -640,7 +622,10 @@ NoControl - 373, 154 + 380, 154 + + + 2, 2, 2, 2 87, 17 @@ -661,7 +646,7 @@ tabModes - 4 + 3 True @@ -670,7 +655,10 @@ NoControl - 372, 127 + 380, 127 + + + 2, 2, 2, 2 87, 17 @@ -691,13 +679,16 @@ tabModes - 5 + 4 True - 373, 101 + 380, 100 + + + 2, 2, 2, 2 87, 17 @@ -718,7 +709,7 @@ tabModes - 6 + 5 True @@ -748,7 +739,7 @@ tabModes - 7 + 6 True @@ -778,7 +769,7 @@ tabModes - 8 + 7 True @@ -808,7 +799,7 @@ tabModes - 9 + 8 True @@ -838,7 +829,7 @@ tabModes - 10 + 9 True @@ -847,7 +838,7 @@ NoControl - 483, 101 + 506, 101 76, 13 @@ -871,7 +862,7 @@ tabModes - 11 + 10 True @@ -880,7 +871,7 @@ NoControl - 483, 236 + 506, 236 70, 13 @@ -904,7 +895,7 @@ tabModes - 12 + 11 True @@ -913,7 +904,7 @@ NoControl - 483, 209 + 506, 209 94, 13 @@ -937,7 +928,7 @@ tabModes - 13 + 12 True @@ -946,7 +937,7 @@ NoControl - 483, 182 + 506, 182 94, 13 @@ -970,7 +961,7 @@ tabModes - 14 + 13 True @@ -979,7 +970,7 @@ NoControl - 483, 155 + 506, 155 94, 13 @@ -1003,7 +994,7 @@ tabModes - 15 + 14 True @@ -1012,7 +1003,7 @@ NoControl - 483, 128 + 506, 128 94, 13 @@ -1036,7 +1027,7 @@ tabModes - 16 + 15 True @@ -1066,7 +1057,7 @@ tabModes - 17 + 16 245, 233 @@ -1087,7 +1078,7 @@ tabModes - 18 + 17 True @@ -1117,7 +1108,7 @@ tabModes - 19 + 18 245, 206 @@ -1138,7 +1129,7 @@ tabModes - 20 + 19 True @@ -1168,7 +1159,7 @@ tabModes - 21 + 20 245, 179 @@ -1189,7 +1180,7 @@ tabModes - 22 + 21 True @@ -1219,7 +1210,7 @@ tabModes - 23 + 22 245, 152 @@ -1240,7 +1231,7 @@ tabModes - 24 + 23 True @@ -1270,7 +1261,7 @@ tabModes - 25 + 24 245, 125 @@ -1291,7 +1282,7 @@ tabModes - 26 + 25 True @@ -1321,7 +1312,7 @@ tabModes - 27 + 26 245, 98 @@ -1342,7 +1333,7 @@ tabModes - 28 + 27 NoControl @@ -1369,7 +1360,7 @@ tabModes - 29 + 28 4, 22 @@ -1425,117 +1416,6 @@ 0 - - NoControl - - - 492, 139 - - - 48, 13 - - - 18 - - - Capacity - - - label106 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabHardware - - - 1 - - - NoControl - - - 310, 138 - - - 42, 13 - - - 19 - - - Monitor - - - label105 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabHardware - - - 2 - - - 553, 136 - - - 83, 20 - - - 21 - - - TXT_battcapacity - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabHardware - - - 3 - - - 0: Disabled - - - 1: 3 Cell - - - 2: 4 Cell - - - 3: Battery Volts - - - 4: Volts & Current - - - 364, 135 - - - 121, 21 - - - 22 - - - CMB_batmontype - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabHardware - - - 4 - NoControl @@ -1561,7 +1441,7 @@ tabHardware - 5 + 1 383, 57 @@ -1588,13 +1468,13 @@ tabHardware - 6 + 2 NoControl - 162, 294 + 162, 214 103, 17 @@ -1615,13 +1495,13 @@ tabHardware - 7 + 3 NoControl - 159, 216 + 159, 136 90, 17 @@ -1642,34 +1522,7 @@ tabHardware - 8 - - - NoControl - - - 162, 135 - - - 133, 17 - - - 26 - - - Enable Battery Monitor - - - CHK_enablebattmon - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabHardware - - - 9 + 4 NoControl @@ -1696,7 +1549,7 @@ tabHardware - 10 + 5 Zoom @@ -1705,7 +1558,7 @@ NoControl - 78, 268 + 78, 188 75, 75 @@ -1723,7 +1576,7 @@ tabHardware - 11 + 6 Zoom @@ -1732,7 +1585,7 @@ NoControl - 78, 187 + 78, 106 75, 75 @@ -1750,34 +1603,7 @@ tabHardware - 12 - - - Zoom - - - NoControl - - - 78, 106 - - - 75, 75 - - - 1 - - - pictureBox2 - - - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabHardware - - - 13 + 7 Zoom @@ -1810,7 +1636,7 @@ tabHardware - 14 + 8 4, 22 @@ -1839,6 +1665,492 @@ 3 + + 162, 267 + + + 2, 2, 2, 2 + + + 76, 20 + + + 38 + + + TXT_ampspervolt + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabBattery + + + 0 + + + 162, 245 + + + 2, 2, 2, 2 + + + 76, 20 + + + 37 + + + TXT_divider + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabBattery + + + 1 + + + 162, 224 + + + 2, 2, 2, 2 + + + 76, 20 + + + 36 + + + TXT_voltage + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabBattery + + + 2 + + + 162, 202 + + + 2, 2, 2, 2 + + + 76, 20 + + + 35 + + + TXT_measuredvoltage + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabBattery + + + 3 + + + 162, 180 + + + 2, 2, 2, 2 + + + 76, 20 + + + 34 + + + TXT_inputvoltage + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabBattery + + + 4 + + + True + + + NoControl + + + 29, 270 + + + 2, 0, 2, 0 + + + 89, 13 + + + 33 + + + Amperes per volt: + + + label35 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabBattery + + + 5 + + + True + + + NoControl + + + 28, 248 + + + 2, 0, 2, 0 + + + 80, 13 + + + 32 + + + Voltage divider: + + + label34 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabBattery + + + 6 + + + True + + + NoControl + + + 28, 227 + + + 2, 0, 2, 0 + + + 81, 13 + + + 31 + + + Battery voltage: + + + label33 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabBattery + + + 7 + + + True + + + NoControl + + + 28, 205 + + + 2, 0, 2, 0 + + + 130, 13 + + + 30 + + + Measured battery voltage: + + + label32 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabBattery + + + 8 + + + True + + + NoControl + + + 28, 183 + + + 2, 0, 2, 0 + + + 72, 13 + + + 29 + + + Input voltage: + + + label31 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabBattery + + + 9 + + + 31, 110 + + + 2, 2, 2, 2 + + + True + + + 428, 62 + + + 28 + + + Voltage sensor calibration: +1. Measure APM input voltage and enter it to the box below +2. Measure battery voltage and enter it to the box below +3. From current sensor datasheet, enter amperes per volt value to the box below + + + textBox3 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabBattery + + + 10 + + + True + + + NoControl + + + 305, 50 + + + 48, 13 + + + 23 + + + Capacity + + + label29 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabBattery + + + 11 + + + NoControl + + + 123, 50 + + + 42, 13 + + + 24 + + + Monitor + + + label30 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabBattery + + + 12 + + + 366, 47 + + + 83, 20 + + + 25 + + + TXT_battcapacity + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabBattery + + + 13 + + + 0: Disabled + + + 1: 3 Cell + + + 2: 4 Cell + + + 3: Battery Volts + + + 4: Volts & Current + + + 177, 46 + + + 121, 21 + + + 26 + + + CMB_batmontype + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabBattery + + + 14 + + + Zoom + + + NoControl + + + 31, 21 + + + 75, 75 + + + 2 + + + pictureBox5 + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabBattery + + + 15 + + + 4, 22 + + + 2, 2, 2, 2 + + + 666, 393 + + + 6 + + + Battery + + + tabBattery + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabControl1 + + + 4 + True @@ -2033,7 +2345,7 @@ will work with hexa's etc tabControl1 - 4 + 5 True @@ -2933,7 +3245,7 @@ will work with hexa's etc tabControl1 - 5 + 6 Fill diff --git a/Tools/ArdupilotMegaPlanner/bin/Release/GCSViews/Firmware.resx b/Tools/ArdupilotMegaPlanner/bin/Release/GCSViews/Firmware.resx index 7283c0a474..ff5d72d8b1 100644 --- a/Tools/ArdupilotMegaPlanner/bin/Release/GCSViews/Firmware.resx +++ b/Tools/ArdupilotMegaPlanner/bin/Release/GCSViews/Firmware.resx @@ -336,34 +336,34 @@ 13 - - True - - + NoControl - - 113, 167 + + 42, 168 - - 56, 13 + + 190, 13 - + 8 - + ArduPlane - - label1 + + TopCenter - + + lbl_AP + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 11 @@ -396,184 +396,184 @@ 10 - - True - - + NoControl - - 74, 361 + + 42, 361 - - 142, 13 + + 190, 13 - + 10 - + ArduPlane (Xplane simulator) - - label3 + + TopCenter - + + lbl_APHil + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 9 - - True - - + NoControl - - 612, 168 + + 560, 168 - - 89, 13 + + 190, 13 - + 11 - + ArduCopter Quad - - label4 + + TopCenter - + + lbl_ACQuad + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 8 - - True - - + NoControl - - 817, 167 + + 767, 168 - - 88, 13 + + 190, 13 - + 12 - + ArduCopter Hexa - - label5 + + TopCenter - + + lbl_ACHexa + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 7 - - True - - + NoControl - - 623, 355 + + 560, 361 - - 75, 13 + + 190, 13 - + 13 - + ArduCopter Tri - - label6 + + TopCenter - + + lbl_ACTri + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 6 - - True - - + NoControl - - 831, 355 + + 767, 361 - - 76, 13 + + 190, 13 - + 14 - + ArduCopter Y6 - - label7 + + TopCenter - + + lbl_ACY6 + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 5 - - True - - + NoControl - - 372, 168 + + 310, 167 - - 81, 13 + + 190, 13 - + 18 - + ArduCopter Heli - - label8 + + TopCenter - + + lbl_Heli + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 3 @@ -603,34 +603,34 @@ 4 - - True - - + NoControl - - 337, 361 + + 310, 361 - - 141, 13 + + 190, 13 - + 21 - + ArduCopter Quad (Simulator) - - label9 + + TopCenter - + + lbl_ACHil + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 0 diff --git a/Tools/ArdupilotMegaPlanner/paramcompare.Designer.cs b/Tools/ArdupilotMegaPlanner/paramcompare.Designer.cs index 9c25523b01..8e87811847 100644 --- a/Tools/ArdupilotMegaPlanner/paramcompare.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/paramcompare.Designer.cs @@ -30,11 +30,12 @@ { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ParamCompare)); this.Params = new System.Windows.Forms.DataGridView(); - this.BUT_save = new ArdupilotMega.MyButton(); this.Command = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Value = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.newvalue = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Use = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.BUT_save = new ArdupilotMega.MyButton(); + this.CHK_toggleall = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.Params)).BeginInit(); this.SuspendLayout(); // @@ -54,16 +55,6 @@ this.Params.Size = new System.Drawing.Size(428, 467); this.Params.TabIndex = 0; // - // BUT_save - // - this.BUT_save.Location = new System.Drawing.Point(185, 485); - this.BUT_save.Name = "BUT_save"; - this.BUT_save.Size = new System.Drawing.Size(75, 23); - this.BUT_save.TabIndex = 1; - this.BUT_save.Text = "Continue"; - this.BUT_save.UseVisualStyleBackColor = true; - this.BUT_save.Click += new System.EventHandler(this.BUT_save_Click); - // // Command // this.Command.HeaderText = "Command"; @@ -89,11 +80,35 @@ this.Use.Name = "Use"; this.Use.Width = 50; // + // BUT_save + // + this.BUT_save.Location = new System.Drawing.Point(185, 485); + this.BUT_save.Name = "BUT_save"; + this.BUT_save.Size = new System.Drawing.Size(75, 23); + this.BUT_save.TabIndex = 1; + this.BUT_save.Text = "Continue"; + this.BUT_save.UseVisualStyleBackColor = true; + this.BUT_save.Click += new System.EventHandler(this.BUT_save_Click); + // + // CHK_toggleall + // + this.CHK_toggleall.AutoSize = true; + this.CHK_toggleall.Checked = true; + this.CHK_toggleall.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_toggleall.Location = new System.Drawing.Point(320, 489); + this.CHK_toggleall.Name = "CHK_toggleall"; + this.CHK_toggleall.Size = new System.Drawing.Size(120, 17); + this.CHK_toggleall.TabIndex = 2; + this.CHK_toggleall.Text = "Check/Uncheck All"; + this.CHK_toggleall.UseVisualStyleBackColor = true; + this.CHK_toggleall.CheckedChanged += new System.EventHandler(this.CHK_toggleall_CheckedChanged); + // // ParamCompare // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(457, 516); + this.Controls.Add(this.CHK_toggleall); this.Controls.Add(this.BUT_save); this.Controls.Add(this.Params); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; @@ -102,6 +117,7 @@ this.Text = "ParamCompare"; ((System.ComponentModel.ISupportInitialize)(this.Params)).EndInit(); this.ResumeLayout(false); + this.PerformLayout(); } @@ -113,5 +129,6 @@ private System.Windows.Forms.DataGridViewTextBoxColumn Value; private System.Windows.Forms.DataGridViewTextBoxColumn newvalue; private System.Windows.Forms.DataGridViewCheckBoxColumn Use; + private System.Windows.Forms.CheckBox CHK_toggleall; } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/paramcompare.cs b/Tools/ArdupilotMegaPlanner/paramcompare.cs index 46624e07f9..99ef5a6976 100644 --- a/Tools/ArdupilotMegaPlanner/paramcompare.cs +++ b/Tools/ArdupilotMegaPlanner/paramcompare.cs @@ -38,17 +38,18 @@ namespace ArdupilotMega //System.Diagnostics.Debug.WriteLine("Doing: " + value); try { - if (param[value] != param2[value]) + if (param[value].ToString() != param2[value].ToString()) // this will throw is there is no matching key { + Console.WriteLine("{0} {1} vs {2}", value, param[value], param2[value]); Params.Rows.Add(); Params.Rows[Params.RowCount - 1].Cells[Command.Index].Value = value; - Params.Rows[Params.RowCount - 1].Cells[Value.Index].Value = ((float)param[value]).ToString("0.###"); + Params.Rows[Params.RowCount - 1].Cells[Value.Index].Value = param[value].ToString(); - Params.Rows[Params.RowCount - 1].Cells[newvalue.Index].Value = ((float)param2[value]).ToString("0.###"); + Params.Rows[Params.RowCount - 1].Cells[newvalue.Index].Value = param2[value].ToString(); Params.Rows[Params.RowCount - 1].Cells[Use.Index].Value = true; } } - catch { if (Params.RowCount > 1) { Params.Rows.RemoveAt(Params.RowCount - 1); } } + catch { };//if (Params.RowCount > 1) { Params.Rows.RemoveAt(Params.RowCount - 1); } } } Params.Sort(Params.Columns[0], ListSortDirection.Ascending); @@ -65,5 +66,13 @@ namespace ArdupilotMega } this.Close(); } + + private void CHK_toggleall_CheckedChanged(object sender, EventArgs e) + { + foreach (DataGridViewRow row in Params.Rows) + { + row.Cells[Use.Index].Value = CHK_toggleall.Checked; + } + } } }