diff --git a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj index f5e006c63c7e9ce3780e8d5ab84df58fc37b5a5b..29064ddc3822901901747567bc7d9bc1f91ac5ec 100644 --- a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj +++ b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj @@ -231,6 +231,12 @@ <Compile Include="Attributes\DisplayTextAttribute.cs" /> <Compile Include="Attributes\PrivateAttribute.cs" /> <Compile Include="CodeGen.cs" /> + <Compile Include="Controls\HSI.cs"> + <SubType>UserControl</SubType> + </Compile> + <Compile Include="Controls\HSI.Designer.cs"> + <DependentUpon>HSI.cs</DependentUpon> + </Compile> <Compile Include="Controls\IDynamicParameterControl.cs" /> <Compile Include="Controls\OpenGLtest.cs"> <SubType>UserControl</SubType> @@ -596,6 +602,9 @@ <EmbeddedResource Include="Controls\ConfigPanel.resx"> <DependentUpon>ConfigPanel.cs</DependentUpon> </EmbeddedResource> + <EmbeddedResource Include="Controls\HSI.resx"> + <DependentUpon>HSI.cs</DependentUpon> + </EmbeddedResource> <EmbeddedResource Include="Controls\ProgressReporterDialogue.resx"> <DependentUpon>ProgressReporterDialogue.cs</DependentUpon> </EmbeddedResource> diff --git a/Tools/ArdupilotMegaPlanner/Controls/HSI.Designer.cs b/Tools/ArdupilotMegaPlanner/Controls/HSI.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..e3e232428b19ebed5fde8a56e3f55dde376bf7a0 --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Controls/HSI.Designer.cs @@ -0,0 +1,47 @@ +namespace ArdupilotMega.Controls +{ + partial class HSI + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.SuspendLayout(); + // + // HSI + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackgroundImage = global::ArdupilotMega.Properties.Resources.Gaugebg; + this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.DoubleBuffered = true; + this.Name = "HSI"; + this.ResumeLayout(false); + + } + + #endregion + } +} diff --git a/Tools/ArdupilotMegaPlanner/Controls/HSI.cs b/Tools/ArdupilotMegaPlanner/Controls/HSI.cs new file mode 100644 index 0000000000000000000000000000000000000000..6f105a6c1326bcfdf874eec8e6f9d52e777d93c7 --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Controls/HSI.cs @@ -0,0 +1,160 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace ArdupilotMega.Controls +{ + public partial class HSI : UserControl + { + Bitmap _headingimage; + bool drawnheading = false; + + int _heading = 0; + int _navbearing = 0; + + [System.ComponentModel.Browsable(true)] + public int Heading + { + get { return _heading; } + set { _heading = value; this.Invalidate(); } + } + + [System.ComponentModel.Browsable(true)] + public int NavHeading + { + get { return _navbearing; } + set { _navbearing = value; } + } + + public HSI() + { + InitializeComponent(); + + _headingimage = new Bitmap(this.Width, this.Height); + } + + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + + int _radiusinside = (int)(Width / 3.6f); + int _radiusoutside = (int)(Width / 2.2f); + + // drawnheading = false; + + if (drawnheading == false || this.DesignMode) + { + _headingimage = new Bitmap(Width, Height); + + Graphics g = Graphics.FromImage(_headingimage); + + g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; + g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bicubic; + g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; + //Graphics g = e.Graphics; + + g.TranslateTransform(this.Width/2,this.Height /2); + + int font = this.Width / 14; + + for (int a = 0; a <= 360; a += 5) + { + if (a == 0) + { + g.DrawString("N".PadLeft(2), new Font(FontFamily.GenericSansSerif, font), Brushes.White, new PointF(-font, -_radiusoutside)); + + g.DrawLine(Pens.White, 0, _radiusinside, 0, _radiusinside + 11); + } + else if (a == 90) + { + g.DrawString("E".PadLeft(2), new Font(FontFamily.GenericSansSerif, font), Brushes.White, new PointF(-font, -_radiusoutside)); + + g.DrawLine(Pens.White, 0, _radiusinside, 0, _radiusinside + 11); + } + else if (a == 180) + { + g.DrawString("S".PadLeft(2), new Font(FontFamily.GenericSansSerif, font), Brushes.White, new PointF(-font, -_radiusoutside)); + + g.DrawLine(Pens.White, 0, _radiusinside, 0, _radiusinside + 11); + } + else if (a == 270) + { + g.DrawString("W".PadLeft(2), new Font(FontFamily.GenericSansSerif, font), Brushes.White, new PointF(-font, -_radiusoutside)); + + g.DrawLine(Pens.White, 0, _radiusinside, 0, _radiusinside + 11); + } + else if (a == 360) + { + // ignore it, as we process it at 0 + } + else if ((a % 30) == 0) // number labeled + { + g.DrawString((a / 10).ToString("0").PadLeft(2), new Font(FontFamily.GenericSansSerif, font), Brushes.White, new PointF(-font, -_radiusoutside)); + + g.DrawLine(Pens.White, 0, _radiusinside, 0, _radiusinside + 11); + } + else if (a % 10 == 0) // larger line + { + g.DrawLine(Pens.White, 0, _radiusinside, 0, _radiusinside + 7); + } + else if (a % 5 == 0) // small line + { + g.DrawLine(Pens.White, 0, _radiusinside, 0, _radiusinside + 4); + } + + g.RotateTransform(5); + } + + g.ResetTransform(); + + drawnheading = true; + } + + e.Graphics.TranslateTransform(Width / 2, Height / 2); + e.Graphics.RotateTransform(-Heading); + + e.Graphics.DrawImage(_headingimage, new Rectangle(-Width / 2, - Height/2,Width,Height)); + + e.Graphics.RotateTransform(Heading); + + Pen or = new Pen(Color.DarkOrange,2); + // body + e.Graphics.DrawLine(or, 0, 30, 0, -10); + // wing + e.Graphics.DrawLine(or, -30, 0, 30, 0); + //tail + e.Graphics.DrawLine(or, -10, 25, 10, 25); + + e.Graphics.DrawLine(new Pen(Color.White,2),0,-_radiusoutside,0,-_radiusinside); + + e.Graphics.RotateTransform(NavHeading - Heading); + + Point[] headbug = new Point[7]; + headbug[0] = new Point(-5, -_radiusoutside + 0); + headbug[1] = new Point(-5, -_radiusoutside + 4); + headbug[2] = new Point(-3, -_radiusoutside + 4); + headbug[3] = new Point(0, -_radiusoutside + 8); + headbug[4] = new Point(3, -_radiusoutside + 4); + headbug[5] = new Point(5, -_radiusoutside + 4); + headbug[6] = new Point(5, -_radiusoutside + 0); + + e.Graphics.DrawLines(or, headbug); + + // this.Invalidate(); + } + + protected override void OnResize(EventArgs e) + { + Width = Height; + base.OnResize(e); + this.Invalidate(); + drawnheading = false; + } + + } +} diff --git a/Tools/ArdupilotMegaPlanner/Controls/HSI.resx b/Tools/ArdupilotMegaPlanner/Controls/HSI.resx new file mode 100644 index 0000000000000000000000000000000000000000..7080a7d118e8cd7ec668e9bb0d8e90767e0c7a3c --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Controls/HSI.resx @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/Controls/HUD.cs b/Tools/ArdupilotMegaPlanner/Controls/HUD.cs index 654b647889a4661794e95fdfd0817867603712cb..da4faef1e6b59fefed9952db680e5b3484abff85 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/HUD.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/HUD.cs @@ -340,9 +340,12 @@ namespace ArdupilotMega.Controls GL.Color4(penn.Color); GL.Begin(BeginMode.LineStrip); - start -= 90; + + start = 360 - start; + start -= 30; + float x = 0, y = 0; - for (int i = (int)start; i <= start + degrees; i++) + for (float i = start; i <= start + degrees; i++) { x = (float)Math.Sin(i * deg2rad) * rect.Width / 2; y = (float)Math.Cos(i * deg2rad) * rect.Height / 2; @@ -813,7 +816,7 @@ namespace ArdupilotMega.Controls for (int a = -90; a <= 90; a += 5) { // limit to 40 degrees - if (a >= _pitch - 34 && a <= _pitch + 25) + if (a >= _pitch - 29 && a <= _pitch + 20) { if (a % 10 == 0) { @@ -841,7 +844,7 @@ namespace ArdupilotMega.Controls graphicsObject.TranslateTransform(this.Width / 2, this.Height / 2 + this.Height / 14); - graphicsObject.RotateTransform(-_roll); + // graphicsObject.RotateTransform(_roll); Point[] pointlist = new Point[3]; @@ -862,17 +865,25 @@ namespace ArdupilotMega.Controls redPen.Width = 2; - for (int a = -45; a <= 45; a += 15) + int[] array = new int[] { -60,-45, -30,-20,-10,0,10,20,30,45,60 }; + + foreach (int a in array) { graphicsObject.ResetTransform(); graphicsObject.TranslateTransform(this.Width / 2, this.Height / 2 + this.Height / 14); - graphicsObject.RotateTransform(a); + graphicsObject.RotateTransform(a - _roll); drawstring(graphicsObject, Math.Abs(a).ToString("##"), font, fontsize, whiteBrush, 0 - 6 - fontoffset, -lengthlong * 2 - extra); graphicsObject.DrawLine(whitePen, 0, -halfheight, 0, -halfheight - 10); } graphicsObject.ResetTransform(); + // draw roll ind + + Rectangle arcrect = new Rectangle(this.Width / 2 - this.Height / 2, this.Height / 14, this.Height, this.Height); + + graphicsObject.DrawArc(whitePen, arcrect, 180 + 30 + -_roll, 120); + //draw centre / current att Rectangle centercircle = new Rectangle(halfwidth - halfwidth / 2, halfheight - halfwidth / 2, halfwidth, halfwidth); @@ -888,12 +899,6 @@ namespace ArdupilotMega.Controls graphicsObject.DrawLine(redtemp, halfwidth-1, halfheight, centercircle.Right - halfwidth / 3, halfheight + halfheight / 10); graphicsObject.DrawLine(redtemp, halfwidth+1, halfheight, centercircle.Left + halfwidth / 3, halfheight + halfheight / 10); - // draw roll ind - - Rectangle arcrect = new Rectangle(this.Width / 2 - this.Height / 2, this.Height / 14, this.Height, this.Height); - - graphicsObject.DrawArc(whitePen, arcrect, 180 + 45, 90); - //draw heading ind graphicsObject.ResetClip(); @@ -912,8 +917,8 @@ namespace ArdupilotMega.Controls //bottom line graphicsObject.DrawLine(whitePen, headbg.Left + 5, headbg.Bottom - 5, headbg.Width - 5, headbg.Bottom - 5); - float space = (headbg.Width - 10) / 60.0f; - int start = (int)Math.Round((_heading - 30),1); + float space = (headbg.Width - 10) / 120.0f; + int start = (int)Math.Round((_heading - 60),1); // draw for outside the 60 deg if (_targetheading < start) @@ -921,13 +926,13 @@ namespace ArdupilotMega.Controls greenPen.Width = 6; graphicsObject.DrawLine(greenPen, headbg.Left + 5 + space * 0, headbg.Bottom, headbg.Left + 5 + space * (0), headbg.Top); } - if (_targetheading > _heading + 30) + if (_targetheading > _heading + 60) { greenPen.Width = 6; graphicsObject.DrawLine(greenPen, headbg.Left + 5 + space * 60, headbg.Bottom, headbg.Left + 5 + space * (60), headbg.Top); } - for (int a = start; a <= _heading + 30; a += 1) + for (int a = start; a <= _heading + 60; a += 1) { // target heading if (((int)(a + 360) % 360) == (int)_targetheading) @@ -943,7 +948,7 @@ namespace ArdupilotMega.Controls blackPen.Width = 2; } - if ((int)a % 5 == 0) + if ((int)a % 15 == 0) { //Console.WriteLine(a + " " + Math.Round(a, 1, MidpointRounding.AwayFromZero)); //Console.WriteLine(space +" " + a +" "+ (headbg.Left + 5 + space * (a - start))); @@ -973,8 +978,20 @@ namespace ArdupilotMega.Controls drawstring(graphicsObject, (disp % 360).ToString().PadLeft(3), font, fontsize, whiteBrush, headbg.Left - 5 + space * (a - start) - fontoffset, headbg.Bottom - 24 - (int)(fontoffset * 1.7)); } } + else if ((int)a % 5 == 0) + { + graphicsObject.DrawLine(whitePen, headbg.Left + 5 + space * (a - start), headbg.Bottom - 5, headbg.Left + 5 + space * (a - start), headbg.Bottom - 10); + } } + RectangleF rect = new RectangleF(headbg.Width / 2 - fontoffset - fontoffset, 0, fontoffset * 4, (int)(fontoffset * 1.7) + 24); + + DrawRectangle(whitePen, rect); + + FillRectangle(Brushes.Black, rect); + + drawstring(graphicsObject, (heading % 360).ToString("0").PadLeft(3), font, fontsize, whiteBrush, headbg.Width / 2 - fontoffset - fontoffset, headbg.Bottom - 24 - (int)(fontoffset * 1.7)); + // Console.WriteLine("HUD 0 " + (DateTime.Now - starttime).TotalMilliseconds + " " + DateTime.Now.Millisecond); // xtrack error diff --git a/Tools/ArdupilotMegaPlanner/CurrentState.cs b/Tools/ArdupilotMegaPlanner/CurrentState.cs index f7638fe8603e80bcc6c2b68fe5e943327d03458c..95c47e3881490f8ce827f4a989407bd1e6f67016 100644 --- a/Tools/ArdupilotMegaPlanner/CurrentState.cs +++ b/Tools/ArdupilotMegaPlanner/CurrentState.cs @@ -883,7 +883,7 @@ namespace ArdupilotMega //climbrate = vfr.climb; - if ((DateTime.Now - lastalt).TotalSeconds >= 0.1 && oldalt != alt) + if ((DateTime.Now - lastalt).TotalSeconds >= 0.2 && oldalt != alt) { climbrate = (alt - oldalt) / (float)(DateTime.Now - lastalt).TotalSeconds; verticalspeed = (alt - oldalt) / (float)(DateTime.Now - lastalt).TotalSeconds; diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFriendlyParams.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFriendlyParams.cs index 360d4899be3eefc861de86208268028398c367be..d44d880a70dc65db5cd49531d8c7e39e2591c801 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFriendlyParams.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFriendlyParams.cs @@ -245,95 +245,99 @@ namespace ArdupilotMega.GCSViews.ConfigurationView { if(!String.IsNullOrEmpty(x.Key)) { - bool controlAdded = false; - - string value = ((float)MainV2.comPort.param[x.Key]).ToString("0.###"); - string description = _parameterMetaDataRepository.GetParameterMetaData(x.Key, ParameterMetaDataConstants.Description); - string displayName = x.Value; - string units = _parameterMetaDataRepository.GetParameterMetaData(x.Key, ParameterMetaDataConstants.Units); - - // If this is a range - string rangeRaw = _parameterMetaDataRepository.GetParameterMetaData(x.Key, ParameterMetaDataConstants.Range); - string incrementRaw = _parameterMetaDataRepository.GetParameterMetaData(x.Key, ParameterMetaDataConstants.Increment); - if (!String.IsNullOrEmpty(rangeRaw) && !String.IsNullOrEmpty(incrementRaw)) - { - float increment, intValue; - float.TryParse(incrementRaw, out increment); - float.TryParse(value, out intValue); - - string[] rangeParts = rangeRaw.Split(new[] { ' ' }); - if (rangeParts.Count() == 2 && increment > 0) - { - float lowerRange; - float.TryParse(rangeParts[0], out lowerRange); - float upperRange; - float.TryParse(rangeParts[1], out upperRange); - - int scaler = (int)float.Parse((1 / increment).ToString(CultureInfo.InvariantCulture)); - int scaledLowerRange = 0, scaledUpperRange = 0; - int scaledIncrement = (int)increment; - if(scaler > 0) - { - scaledLowerRange = (int)(lowerRange * scaler); - scaledUpperRange = (int)(upperRange * scaler); - scaledIncrement = (int)float.Parse((increment * scaler).ToString(CultureInfo.InvariantCulture)); - intValue *= scaler; - } - - var rangeControl = new RangeControl(); - rangeControl.Name = x.Key; - rangeControl.Scaler = scaler; - rangeControl.DescriptionText = FitDescriptionText(units, description); - rangeControl.LabelText = displayName; - rangeControl.TrackBarControl.Minimum = scaledLowerRange; - rangeControl.TrackBarControl.Maximum = scaledUpperRange; - rangeControl.TrackBarControl.TickFrequency = scaledIncrement; - rangeControl.TrackBarControl.Value = (int)intValue; - - rangeControl.NumericUpDownControl.Increment = (decimal)increment; - rangeControl.NumericUpDownControl.DecimalPlaces = scaler.ToString(CultureInfo.InvariantCulture).Length - 1; - rangeControl.NumericUpDownControl.Minimum = (decimal) lowerRange; - rangeControl.NumericUpDownControl.Maximum = (decimal)upperRange; - rangeControl.NumericUpDownControl.Value = (decimal)((float)MainV2.comPort.param[x.Key]); - - rangeControl.AttachEvents(); - - tableLayoutPanel1.Controls.Add(rangeControl); - - controlAdded = true; - } - } - - if (!controlAdded) - { - // If this is a subset of values - string availableValuesRaw = _parameterMetaDataRepository.GetParameterMetaData(x.Key, ParameterMetaDataConstants.Values); - if (!String.IsNullOrEmpty(availableValuesRaw)) - { - string[] availableValues = availableValuesRaw.Split(new[] { ',' }); - if (availableValues.Any()) - { - var valueControl = new ValuesControl(); - valueControl.Name = x.Key; - valueControl.DescriptionText = FitDescriptionText(units, description); - valueControl.LabelText = displayName; - - var splitValues = new List<KeyValuePair<string, string>>(); - // Add the values to the ddl - availableValues.ForEach(val => + try + { + bool controlAdded = false; + + string value = ((float)MainV2.comPort.param[x.Key]).ToString("0.###"); + string description = _parameterMetaDataRepository.GetParameterMetaData(x.Key, ParameterMetaDataConstants.Description); + string displayName = x.Value; + string units = _parameterMetaDataRepository.GetParameterMetaData(x.Key, ParameterMetaDataConstants.Units); + + // If this is a range + string rangeRaw = _parameterMetaDataRepository.GetParameterMetaData(x.Key, ParameterMetaDataConstants.Range); + string incrementRaw = _parameterMetaDataRepository.GetParameterMetaData(x.Key, ParameterMetaDataConstants.Increment); + if (!String.IsNullOrEmpty(rangeRaw) && !String.IsNullOrEmpty(incrementRaw)) + { + float increment, intValue; + float.TryParse(incrementRaw, out increment); + float.TryParse(value, out intValue); + + string[] rangeParts = rangeRaw.Split(new[] { ' ' }); + if (rangeParts.Count() == 2 && increment > 0) { - string[] valParts = val.Split(new[]{ ':' }); - splitValues.Add(new KeyValuePair<string, string>(valParts[0], (valParts.Length > 1) ? valParts[1] : valParts[0])); - }); - valueControl.ComboBoxControl.DisplayMember = "Value"; - valueControl.ComboBoxControl.ValueMember = "Key"; - valueControl.ComboBoxControl.DataSource = splitValues; - valueControl.ComboBoxControl.SelectedValue = value; - - tableLayoutPanel1.Controls.Add(valueControl); - } - } - } + float lowerRange; + float.TryParse(rangeParts[0], out lowerRange); + float upperRange; + float.TryParse(rangeParts[1], out upperRange); + + int scaler = (int)float.Parse((1 / increment).ToString(CultureInfo.InvariantCulture)); + int scaledLowerRange = 0, scaledUpperRange = 0; + int scaledIncrement = (int)increment; + if (scaler > 0) + { + scaledLowerRange = (int)(lowerRange * scaler); + scaledUpperRange = (int)(upperRange * scaler); + scaledIncrement = (int)float.Parse((increment * scaler).ToString(CultureInfo.InvariantCulture)); + intValue *= scaler; + } + + var rangeControl = new RangeControl(); + rangeControl.Name = x.Key; + rangeControl.Scaler = scaler; + rangeControl.DescriptionText = FitDescriptionText(units, description); + rangeControl.LabelText = displayName; + rangeControl.TrackBarControl.Minimum = scaledLowerRange; + rangeControl.TrackBarControl.Maximum = scaledUpperRange; + rangeControl.TrackBarControl.TickFrequency = scaledIncrement; + rangeControl.TrackBarControl.Value = (int)intValue; + + rangeControl.NumericUpDownControl.Increment = (decimal)increment; + rangeControl.NumericUpDownControl.DecimalPlaces = scaler.ToString(CultureInfo.InvariantCulture).Length - 1; + rangeControl.NumericUpDownControl.Minimum = (decimal)lowerRange; + rangeControl.NumericUpDownControl.Maximum = (decimal)upperRange; + rangeControl.NumericUpDownControl.Value = (decimal)((float)MainV2.comPort.param[x.Key]); + + rangeControl.AttachEvents(); + + tableLayoutPanel1.Controls.Add(rangeControl); + + controlAdded = true; + } + } + + if (!controlAdded) + { + // If this is a subset of values + string availableValuesRaw = _parameterMetaDataRepository.GetParameterMetaData(x.Key, ParameterMetaDataConstants.Values); + if (!String.IsNullOrEmpty(availableValuesRaw)) + { + string[] availableValues = availableValuesRaw.Split(new[] { ',' }); + if (availableValues.Any()) + { + var valueControl = new ValuesControl(); + valueControl.Name = x.Key; + valueControl.DescriptionText = FitDescriptionText(units, description); + valueControl.LabelText = displayName; + + var splitValues = new List<KeyValuePair<string, string>>(); + // Add the values to the ddl + availableValues.ForEach(val => + { + string[] valParts = val.Split(new[] { ':' }); + splitValues.Add(new KeyValuePair<string, string>(valParts[0], (valParts.Length > 1) ? valParts[1] : valParts[0])); + }); + valueControl.ComboBoxControl.DisplayMember = "Value"; + valueControl.ComboBoxControl.ValueMember = "Key"; + valueControl.ComboBoxControl.DataSource = splitValues; + valueControl.ComboBoxControl.SelectedValue = value; + + tableLayoutPanel1.Controls.Add(valueControl); + } + } + } + } // if there is an error simply dont show it, ie bad pde file, bad scale etc + catch (Exception ex) { log.Error(ex); } } }); } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs index 87435b07aac85a2813363336a4c4802e172f89f3..8e1a73b5a18ea82dc5f81138f9aabcd8ab989468 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs @@ -39,7 +39,7 @@ this.BUTactiondo = new ArdupilotMega.Controls.MyButton(); this.tabGauges = new System.Windows.Forms.TabPage(); this.Gvspeed = new AGaugeApp.AGauge(); - this.Gheading = new AGaugeApp.AGauge(); + this.Gheading = new ArdupilotMega.Controls.HSI(); this.Galt = new AGaugeApp.AGauge(); this.Gspeed = new AGaugeApp.AGauge(); this.tabStatus = new System.Windows.Forms.TabPage(); @@ -545,145 +545,11 @@ this.Gheading.BackColor = System.Drawing.Color.Transparent; this.Gheading.BackgroundImage = global::ArdupilotMega.Properties.Resources.Gaugebg; resources.ApplyResources(this.Gheading, "Gheading"); - this.Gheading.BaseArcColor = System.Drawing.Color.Transparent; - this.Gheading.BaseArcRadius = 60; - this.Gheading.BaseArcStart = 270; - this.Gheading.BaseArcSweep = 360; - this.Gheading.BaseArcWidth = 2; - this.Gheading.basesize = new System.Drawing.Size(150, 150); - this.Gheading.Cap_Idx = ((byte)(0)); - this.Gheading.CapColor = System.Drawing.Color.White; - this.Gheading.CapColors = new System.Drawing.Color[] { - System.Drawing.Color.White, - System.Drawing.Color.Black, - System.Drawing.Color.Black, - System.Drawing.Color.Black, - System.Drawing.Color.Black}; - this.Gheading.CapPosition = new System.Drawing.Point(55, 85); - this.Gheading.CapsPosition = new System.Drawing.Point[] { - new System.Drawing.Point(55, 85), - new System.Drawing.Point(40, 67), - new System.Drawing.Point(10, 10), - new System.Drawing.Point(10, 10), - new System.Drawing.Point(10, 10)}; - this.Gheading.CapsText = new string[] { - "Heading", - "", - "", - "", - ""}; - this.Gheading.CapText = "Heading"; - this.Gheading.Center = new System.Drawing.Point(75, 75); - this.Gheading.DataBindings.Add(new System.Windows.Forms.Binding("Value0", this.bindingSource1, "yaw", true)); - this.Gheading.DataBindings.Add(new System.Windows.Forms.Binding("Value1", this.bindingSource1, "nav_bearing", true)); - this.Gheading.MaxValue = 359F; - this.Gheading.MinValue = 0F; + this.Gheading.DataBindings.Add(new System.Windows.Forms.Binding("Heading", this.bindingSource1, "yaw", true)); + this.Gheading.DataBindings.Add(new System.Windows.Forms.Binding("NavHeading", this.bindingSource1, "nav_bearing", true)); + this.Gheading.Heading = 0; this.Gheading.Name = "Gheading"; - this.Gheading.Need_Idx = ((byte)(3)); - this.Gheading.NeedleColor1 = AGaugeApp.AGauge.NeedleColorEnum.Gray; - this.Gheading.NeedleColor2 = System.Drawing.Color.White; - this.Gheading.NeedleEnabled = false; - this.Gheading.NeedleRadius = 80; - this.Gheading.NeedlesColor1 = new AGaugeApp.AGauge.NeedleColorEnum[] { - AGaugeApp.AGauge.NeedleColorEnum.Gray, - AGaugeApp.AGauge.NeedleColorEnum.Red, - AGaugeApp.AGauge.NeedleColorEnum.Gray, - AGaugeApp.AGauge.NeedleColorEnum.Gray}; - this.Gheading.NeedlesColor2 = new System.Drawing.Color[] { - System.Drawing.Color.White, - System.Drawing.Color.White, - System.Drawing.Color.White, - System.Drawing.Color.White}; - this.Gheading.NeedlesEnabled = new bool[] { - true, - true, - false, - false}; - this.Gheading.NeedlesRadius = new int[] { - 60, - 60, - 80, - 80}; - this.Gheading.NeedlesType = new int[] { - 0, - 0, - 0, - 0}; - this.Gheading.NeedlesWidth = new int[] { - 2, - 2, - 2, - 2}; - this.Gheading.NeedleType = 0; - this.Gheading.NeedleWidth = 2; - this.Gheading.Range_Idx = ((byte)(0)); - this.Gheading.RangeColor = System.Drawing.Color.LightGreen; - this.Gheading.RangeEnabled = false; - this.Gheading.RangeEndValue = 360F; - this.Gheading.RangeInnerRadius = 1; - this.Gheading.RangeOuterRadius = 60; - this.Gheading.RangesColor = new System.Drawing.Color[] { - System.Drawing.Color.LightGreen, - System.Drawing.Color.Red, - System.Drawing.Color.Orange, - System.Drawing.SystemColors.Control, - System.Drawing.SystemColors.Control}; - this.Gheading.RangesEnabled = new bool[] { - false, - false, - false, - false, - false}; - this.Gheading.RangesEndValue = new float[] { - 360F, - 200F, - 150F, - 0F, - 0F}; - this.Gheading.RangesInnerRadius = new int[] { - 1, - 1, - 1, - 70, - 70}; - this.Gheading.RangesOuterRadius = new int[] { - 60, - 60, - 60, - 80, - 80}; - this.Gheading.RangesStartValue = new float[] { - 0F, - 150F, - 75F, - 0F, - 0F}; - this.Gheading.RangeStartValue = 0F; - this.Gheading.ScaleLinesInterColor = System.Drawing.Color.White; - this.Gheading.ScaleLinesInterInnerRadius = 52; - this.Gheading.ScaleLinesInterOuterRadius = 60; - this.Gheading.ScaleLinesInterWidth = 1; - this.Gheading.ScaleLinesMajorColor = System.Drawing.Color.White; - this.Gheading.ScaleLinesMajorInnerRadius = 50; - this.Gheading.ScaleLinesMajorOuterRadius = 60; - this.Gheading.ScaleLinesMajorStepValue = 45F; - this.Gheading.ScaleLinesMajorWidth = 2; - this.Gheading.ScaleLinesMinorColor = System.Drawing.Color.White; - this.Gheading.ScaleLinesMinorInnerRadius = 55; - this.Gheading.ScaleLinesMinorNumOf = 9; - this.Gheading.ScaleLinesMinorOuterRadius = 60; - this.Gheading.ScaleLinesMinorWidth = 1; - this.Gheading.ScaleNumbersColor = System.Drawing.Color.White; - this.Gheading.ScaleNumbersFormat = null; - this.Gheading.ScaleNumbersRadius = 42; - this.Gheading.ScaleNumbersRotation = 45; - this.Gheading.ScaleNumbersStartScaleLine = 1; - this.Gheading.ScaleNumbersStepScaleLines = 1; - this.Gheading.Value = 0F; - this.Gheading.Value0 = 0F; - this.Gheading.Value1 = 0F; - this.Gheading.Value2 = 0F; - this.Gheading.Value3 = 0F; + this.Gheading.NavHeading = 0; // // Galt // @@ -1329,7 +1195,6 @@ private System.Windows.Forms.TrackBar tracklog; private ArdupilotMega.Controls.MyButton BUT_playlog; private ArdupilotMega.Controls.MyButton BUT_loadtelem; - private AGaugeApp.AGauge Gheading; private AGaugeApp.AGauge Galt; private AGaugeApp.AGauge Gspeed; private AGaugeApp.AGauge Gvspeed; @@ -1370,5 +1235,6 @@ private ArdupilotMega.Controls.MyButton BUT_script; private ArdupilotMega.Controls.MyLabel lbl_hdop; private ArdupilotMega.Controls.MyLabel lbl_sats; + private Controls.HSI Gheading; } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx index d4124399bd04f8ef4671696c1f7f8e6e6367e139..8885edf961d59363770c65ff479a6565ce5b8881 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx @@ -134,7 +134,7 @@ <value>Point Camera Here</value> </data> <data name="contextMenuStrip1.Size" type="System.Drawing.Size, System.Drawing"> - <value>175, 70</value> + <value>175, 48</value> </data> <data name=">>contextMenuStrip1.Name" xml:space="preserve"> <value>contextMenuStrip1</value> @@ -208,7 +208,7 @@ <value>hud1</value> </data> <data name=">>hud1.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.HUD, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.HUD, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>hud1.Parent" xml:space="preserve"> <value>SubMainLeft.Panel1</value> @@ -247,7 +247,7 @@ <value>BUT_script</value> </data> <data name=">>BUT_script.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_script.Parent" xml:space="preserve"> <value>tabActions</value> @@ -280,7 +280,7 @@ <value>BUT_joystick</value> </data> <data name=">>BUT_joystick.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_joystick.Parent" xml:space="preserve"> <value>tabActions</value> @@ -310,7 +310,7 @@ <value>BUT_quickmanual</value> </data> <data name=">>BUT_quickmanual.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_quickmanual.Parent" xml:space="preserve"> <value>tabActions</value> @@ -340,7 +340,7 @@ <value>BUT_quickrtl</value> </data> <data name=">>BUT_quickrtl.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_quickrtl.Parent" xml:space="preserve"> <value>tabActions</value> @@ -370,7 +370,7 @@ <value>BUT_quickauto</value> </data> <data name=">>BUT_quickauto.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_quickauto.Parent" xml:space="preserve"> <value>tabActions</value> @@ -424,7 +424,7 @@ <value>BUT_setwp</value> </data> <data name=">>BUT_setwp.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_setwp.Parent" xml:space="preserve"> <value>tabActions</value> @@ -475,7 +475,7 @@ <value>BUT_setmode</value> </data> <data name=">>BUT_setmode.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_setmode.Parent" xml:space="preserve"> <value>tabActions</value> @@ -505,7 +505,7 @@ <value>BUT_clear_track</value> </data> <data name=">>BUT_clear_track.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_clear_track.Parent" xml:space="preserve"> <value>tabActions</value> @@ -556,7 +556,7 @@ <value>BUT_Homealt</value> </data> <data name=">>BUT_Homealt.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_Homealt.Parent" xml:space="preserve"> <value>tabActions</value> @@ -586,7 +586,7 @@ <value>BUT_RAWSensor</value> </data> <data name=">>BUT_RAWSensor.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_RAWSensor.Parent" xml:space="preserve"> <value>tabActions</value> @@ -616,7 +616,7 @@ <value>BUTrestartmission</value> </data> <data name=">>BUTrestartmission.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUTrestartmission.Parent" xml:space="preserve"> <value>tabActions</value> @@ -646,7 +646,7 @@ <value>BUTactiondo</value> </data> <data name=">>BUTactiondo.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUTactiondo.Parent" xml:space="preserve"> <value>tabActions</value> @@ -700,7 +700,7 @@ <value>Gvspeed</value> </data> <data name=">>Gvspeed.Type" xml:space="preserve"> - <value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>Gvspeed.Parent" xml:space="preserve"> <value>tabGauges</value> @@ -730,7 +730,7 @@ <value>Gheading</value> </data> <data name=">>Gheading.Type" xml:space="preserve"> - <value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.HSI, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>Gheading.Parent" xml:space="preserve"> <value>tabGauges</value> @@ -760,7 +760,7 @@ <value>Galt</value> </data> <data name=">>Galt.Type" xml:space="preserve"> - <value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>Galt.Parent" xml:space="preserve"> <value>tabGauges</value> @@ -793,7 +793,7 @@ <value>Gspeed</value> </data> <data name=">>Gspeed.Type" xml:space="preserve"> - <value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>Gspeed.Parent" xml:space="preserve"> <value>tabGauges</value> @@ -874,7 +874,7 @@ <value>lbl_logpercent</value> </data> <data name=">>lbl_logpercent.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>lbl_logpercent.Parent" xml:space="preserve"> <value>tabTLogs</value> @@ -925,7 +925,7 @@ <value>BUT_log2kml</value> </data> <data name=">>BUT_log2kml.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_log2kml.Parent" xml:space="preserve"> <value>tabTLogs</value> @@ -976,7 +976,7 @@ <value>BUT_playlog</value> </data> <data name=">>BUT_playlog.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_playlog.Parent" xml:space="preserve"> <value>tabTLogs</value> @@ -1003,7 +1003,7 @@ <value>BUT_loadtelem</value> </data> <data name=">>BUT_loadtelem.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_loadtelem.Parent" xml:space="preserve"> <value>tabTLogs</value> @@ -1192,7 +1192,7 @@ <value>lbl_hdop</value> </data> <data name=">>lbl_hdop.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>lbl_hdop.Parent" xml:space="preserve"> <value>splitContainer1.Panel2</value> @@ -1225,7 +1225,7 @@ <value>lbl_sats</value> </data> <data name=">>lbl_sats.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>lbl_sats.Parent" xml:space="preserve"> <value>splitContainer1.Panel2</value> @@ -1255,7 +1255,7 @@ <value>lbl_winddir</value> </data> <data name=">>lbl_winddir.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>lbl_winddir.Parent" xml:space="preserve"> <value>splitContainer1.Panel2</value> @@ -1285,7 +1285,7 @@ <value>lbl_windvel</value> </data> <data name=">>lbl_windvel.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>lbl_windvel.Parent" xml:space="preserve"> <value>splitContainer1.Panel2</value> @@ -1457,7 +1457,7 @@ <value>gMapControl1</value> </data> <data name=">>gMapControl1.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.myGMAP, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.myGMAP, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>gMapControl1.Parent" xml:space="preserve"> <value>splitContainer1.Panel2</value> @@ -1520,7 +1520,7 @@ <value>TXT_lat</value> </data> <data name=">>TXT_lat.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>TXT_lat.Parent" xml:space="preserve"> <value>panel1</value> @@ -1577,7 +1577,7 @@ <value>label1</value> </data> <data name=">>label1.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>label1.Parent" xml:space="preserve"> <value>panel1</value> @@ -1607,7 +1607,7 @@ <value>TXT_long</value> </data> <data name=">>TXT_long.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>TXT_long.Parent" xml:space="preserve"> <value>panel1</value> @@ -1637,7 +1637,7 @@ <value>TXT_alt</value> </data> <data name=">>TXT_alt.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>TXT_alt.Parent" xml:space="preserve"> <value>panel1</value> @@ -1838,7 +1838,7 @@ <value>label6</value> </data> <data name=">>label6.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>label6.Parent" xml:space="preserve"> <value>$this</value> @@ -1916,6 +1916,6 @@ <value>FlightData</value> </data> <data name=">>$this.Type" xml:space="preserve"> - <value>System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value> + <value>System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner, Version=1.1.4505.22486, Culture=neutral, PublicKeyToken=null</value> </data> </root> \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/Msi/wix.pdb b/Tools/ArdupilotMegaPlanner/Msi/wix.pdb index 6b13b52e52ba133ebcb30c31fc1c1e8175a18bd4..f4ce1358c9560f2ff52014713bc05527a56d0f43 100644 Binary files a/Tools/ArdupilotMegaPlanner/Msi/wix.pdb and b/Tools/ArdupilotMegaPlanner/Msi/wix.pdb differ diff --git a/Tools/ArdupilotMegaPlanner/Program.cs b/Tools/ArdupilotMegaPlanner/Program.cs index 851d5ab5cabc9b87cd9be85c26bc2abceb1894b4..65f75040f1a4b84d0584e80bfe2626afb5a6d80f 100644 --- a/Tools/ArdupilotMegaPlanner/Program.cs +++ b/Tools/ArdupilotMegaPlanner/Program.cs @@ -46,7 +46,7 @@ namespace ArdupilotMega if (System.Diagnostics.Debugger.IsAttached) { // testing - Utilities.ParameterMetaDataParser.GetParameterInformation(); + // Utilities.ParameterMetaDataParser.GetParameterInformation(); } try diff --git a/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs b/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs index 790eaa56ac22ac6e4721656fef29e32e3ffbd925..7f5cef6217b80bbec1922155b377da5620749a16 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.1.*")] -[assembly: AssemblyFileVersion("1.1.77")] +[assembly: AssemblyFileVersion("1.1.78")] [assembly: NeutralResourcesLanguageAttribute("")] diff --git a/Tools/ArdupilotMegaPlanner/Utilities/ParameterMetaDataParser.cs b/Tools/ArdupilotMegaPlanner/Utilities/ParameterMetaDataParser.cs index 2bf2cc34444fcce969876bf762e94e8711fbca25..ecd96c05a5f44ee7f34d3dcb1fc3ec31fdc8e943 100644 --- a/Tools/ArdupilotMegaPlanner/Utilities/ParameterMetaDataParser.cs +++ b/Tools/ArdupilotMegaPlanner/Utilities/ParameterMetaDataParser.cs @@ -181,9 +181,9 @@ namespace ArdupilotMega.Utilities { // This is the end index for a substring to search for parameter attributes // If we are on the last index in our collection, we will search to the end of the file - var stopIdx = (i == indicies.Count - 1) ? fileContents.Length : indicies[i + 1]; + var stopIdx = (i == indicies.Count - 1) ? fileContents.Length : indicies[i + 1] + 1; - string subStringToSearch = fileContents.Substring(indicies[i], (stopIdx - indicies[i])); + string subStringToSearch = fileContents.Substring(indicies[i], (stopIdx - indicies[i])); if(!String.IsNullOrEmpty(subStringToSearch)) { var metaIndicies = new List<int>(); @@ -246,13 +246,13 @@ namespace ArdupilotMega.Utilities private static void GetIndexOfMarkers(ref List<int> indicies, string inspectThis, string delimeter, int prevIdx) { // Find the index of the start of a parameter comment - int idx = inspectThis.IndexOf(delimeter, StringComparison.InvariantCultureIgnoreCase); + int idx = inspectThis.IndexOf(delimeter, prevIdx, StringComparison.InvariantCultureIgnoreCase); // If we can't find one we stop here if(idx != -1) { // Add the index we found - indicies.Add(idx + prevIdx); + indicies.Add(idx); // Move the index after the parameter delimeter int newIdx = idx + delimeter.Length; @@ -261,7 +261,7 @@ namespace ArdupilotMega.Utilities if(newIdx < inspectThis.Length) { // Recursively search for the next index - GetIndexOfMarkers(ref indicies, inspectThis.Substring(newIdx, (inspectThis.Length - newIdx)), delimeter, idx + prevIdx); + GetIndexOfMarkers(ref indicies, inspectThis, delimeter, newIdx); } } } diff --git a/Tools/ArdupilotMegaPlanner/app.config b/Tools/ArdupilotMegaPlanner/app.config index 8fb4a251184afe437f6ac4fd6d14e96376c20628..a1956f3ab1c6aa73ed58978bff91bbc30ad8cd03 100644 --- a/Tools/ArdupilotMegaPlanner/app.config +++ b/Tools/ArdupilotMegaPlanner/app.config @@ -7,7 +7,7 @@ <supportedRuntime version="v2.0.50727"/></startup> <appSettings> <add key="UpdateLocation" - value="http://ardupilot-mega.googlecode.com/git/Tools/ArdupilotMegaPlanner/bin/Release/"/> + value="http://meee146-planner.googlecode.com/git/Tools/ArdupilotMegaPlanner/bin/Release/"/> <add key="ParameterLocations" value="http://ardupilot-mega.googlecode.com/git/ArduCopter/Parameters.pde;http://ardupilot-mega.googlecode.com/git/ArduPlane/Parameters.pde"/> <add key="ParameterMetaDataXMLFileName" diff --git a/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.exe.config b/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.exe.config index 8fb4a251184afe437f6ac4fd6d14e96376c20628..a1956f3ab1c6aa73ed58978bff91bbc30ad8cd03 100644 --- a/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.exe.config +++ b/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.exe.config @@ -7,7 +7,7 @@ <supportedRuntime version="v2.0.50727"/></startup> <appSettings> <add key="UpdateLocation" - value="http://ardupilot-mega.googlecode.com/git/Tools/ArdupilotMegaPlanner/bin/Release/"/> + value="http://meee146-planner.googlecode.com/git/Tools/ArdupilotMegaPlanner/bin/Release/"/> <add key="ParameterLocations" value="http://ardupilot-mega.googlecode.com/git/ArduCopter/Parameters.pde;http://ardupilot-mega.googlecode.com/git/ArduPlane/Parameters.pde"/> <add key="ParameterMetaDataXMLFileName" diff --git a/Tools/ArdupilotMegaPlanner/bin/Release/version.txt b/Tools/ArdupilotMegaPlanner/bin/Release/version.txt index 4c3db27651881d0326d6ec9b485f8433253c6418..6162c5a63cb184c7d1c06f12d476801be5137026 100644 --- a/Tools/ArdupilotMegaPlanner/bin/Release/version.txt +++ b/Tools/ArdupilotMegaPlanner/bin/Release/version.txt @@ -1 +1 @@ -1.1.4503.36159 \ No newline at end of file +1.1.4506.13406 \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/temp.Designer.cs b/Tools/ArdupilotMegaPlanner/temp.Designer.cs index f8c0a60ed413a0ef1b94970635ed9a1446685ee9..2db99918b49f4520b9f82db0a501e49f90a47fbb 100644 --- a/Tools/ArdupilotMegaPlanner/temp.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/temp.Designer.cs @@ -48,7 +48,6 @@ this.BUT_flashdl = new ArdupilotMega.Controls.MyButton(); this.BUT_wipeeeprom = new ArdupilotMega.Controls.MyButton(); this.button1 = new ArdupilotMega.Controls.MyButton(); - this.test1 = new ArdupilotMega.Controls.OpenGLtest(); this.SuspendLayout(); // // label1 @@ -245,24 +244,11 @@ this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // - // test1 - // - this.test1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.test1.BackColor = System.Drawing.Color.Black; - this.test1.Location = new System.Drawing.Point(571, 118); - this.test1.Name = "test1"; - this.test1.Size = new System.Drawing.Size(150, 150); - this.test1.TabIndex = 20; - this.test1.VSync = false; - // // temp // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(731, 281); - this.Controls.Add(this.test1); this.Controls.Add(this.BUT_magcalib); this.Controls.Add(this.BUT_ant_track); this.Controls.Add(this.BUT_follow_me); @@ -313,8 +299,5 @@ private ArdupilotMega.Controls.MyButton BUT_follow_me; private ArdupilotMega.Controls.MyButton BUT_ant_track; private ArdupilotMega.Controls.MyButton BUT_magcalib; - private Controls.OpenGLtest test1; - //private SharpVectors.Renderers.Forms.SvgPictureBox svgPictureBox1; - } } \ No newline at end of file