APM Planner 1.1.49

mode TUNE_ param scale
add mavlink tlog graphing
mod tracker options
This commit is contained in:
Michael Oborne 2012-03-06 18:27:43 +08:00
parent 46d7da4d14
commit 7f47640b92
25 changed files with 1483 additions and 2298 deletions

View File

@ -84,7 +84,7 @@
this.CMB_baudrate.Location = new System.Drawing.Point(337, 9);
this.CMB_baudrate.Name = "CMB_baudrate";
this.CMB_baudrate.Size = new System.Drawing.Size(121, 21);
this.CMB_baudrate.TabIndex = 5;
this.CMB_baudrate.TabIndex = 2;
//
// CMB_serialport
//
@ -93,14 +93,14 @@
this.CMB_serialport.Location = new System.Drawing.Point(210, 10);
this.CMB_serialport.Name = "CMB_serialport";
this.CMB_serialport.Size = new System.Drawing.Size(121, 21);
this.CMB_serialport.TabIndex = 3;
this.CMB_serialport.TabIndex = 1;
//
// BUT_connect
//
this.BUT_connect.Location = new System.Drawing.Point(476, 9);
this.BUT_connect.Name = "BUT_connect";
this.BUT_connect.Size = new System.Drawing.Size(75, 23);
this.BUT_connect.TabIndex = 4;
this.BUT_connect.TabIndex = 3;
this.BUT_connect.Text = "Connect";
this.BUT_connect.UseVisualStyleBackColor = true;
this.BUT_connect.Click += new System.EventHandler(this.BUT_connect_Click);
@ -108,11 +108,12 @@
// TRK_pantrim
//
this.TRK_pantrim.Location = new System.Drawing.Point(153, 65);
this.TRK_pantrim.Maximum = 180;
this.TRK_pantrim.Minimum = -180;
this.TRK_pantrim.Maximum = 90;
this.TRK_pantrim.Minimum = -90;
this.TRK_pantrim.Name = "TRK_pantrim";
this.TRK_pantrim.Size = new System.Drawing.Size(375, 45);
this.TRK_pantrim.TabIndex = 6;
this.TRK_pantrim.TabIndex = 5;
this.TRK_pantrim.TickFrequency = 5;
this.TRK_pantrim.Scroll += new System.EventHandler(this.TRK_pantrim_Scroll);
//
// TXT_panrange
@ -120,17 +121,18 @@
this.TXT_panrange.Location = new System.Drawing.Point(83, 65);
this.TXT_panrange.Name = "TXT_panrange";
this.TXT_panrange.Size = new System.Drawing.Size(64, 20);
this.TXT_panrange.TabIndex = 7;
this.TXT_panrange.TabIndex = 4;
this.TXT_panrange.Text = "180";
this.TXT_panrange.TextChanged += new System.EventHandler(this.TXT_panrange_TextChanged);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(331, 49);
this.label3.Location = new System.Drawing.Point(326, 49);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(38, 13);
this.label3.Size = new System.Drawing.Size(27, 13);
this.label3.TabIndex = 10;
this.label3.Text = "Center";
this.label3.Text = "Trim";
//
// label4
//
@ -153,29 +155,30 @@
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(331, 125);
this.label6.Location = new System.Drawing.Point(326, 125);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(38, 13);
this.label6.Size = new System.Drawing.Size(27, 13);
this.label6.TabIndex = 16;
this.label6.Text = "Center";
this.label6.Text = "Trim";
//
// TXT_tiltrange
//
this.TXT_tiltrange.Location = new System.Drawing.Point(83, 141);
this.TXT_tiltrange.Name = "TXT_tiltrange";
this.TXT_tiltrange.Size = new System.Drawing.Size(64, 20);
this.TXT_tiltrange.TabIndex = 13;
this.TXT_tiltrange.TabIndex = 6;
this.TXT_tiltrange.Text = "90";
this.TXT_tiltrange.TextChanged += new System.EventHandler(this.TXT_tiltrange_TextChanged);
//
// TRK_tilttrim
//
this.TRK_tilttrim.Location = new System.Drawing.Point(153, 141);
this.TRK_tilttrim.Maximum = 90;
this.TRK_tilttrim.Minimum = -90;
this.TRK_tilttrim.Maximum = 45;
this.TRK_tilttrim.Minimum = -45;
this.TRK_tilttrim.Name = "TRK_tilttrim";
this.TRK_tilttrim.Size = new System.Drawing.Size(375, 45);
this.TRK_tilttrim.TabIndex = 12;
this.TRK_tilttrim.Value = 45;
this.TRK_tilttrim.TabIndex = 7;
this.TRK_tilttrim.TickFrequency = 5;
this.TRK_tilttrim.Scroll += new System.EventHandler(this.TRK_tilttrim_Scroll);
//
// label2

View File

@ -111,5 +111,25 @@ namespace ArdupilotMega.Antenna
if (tracker != null)
tracker.TrimTilt = TRK_tilttrim.Value;
}
private void TXT_panrange_TextChanged(object sender, EventArgs e)
{
int range;
int.TryParse(TXT_panrange.Text, out range);
TRK_pantrim.Minimum = range / 2 * -1;
TRK_pantrim.Maximum = range / 2;
}
private void TXT_tiltrange_TextChanged(object sender, EventArgs e)
{
int range;
int.TryParse(TXT_tiltrange.Text, out range);
TRK_tilttrim.Minimum = range / 2 * -1;
TRK_tilttrim.Maximum = range / 2;
}
}
}

View File

@ -120,82 +120,60 @@
<ItemGroup>
<Reference Include="alglibnet2, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Lib\alglibnet2.dll</HintPath>
</Reference>
<Reference Include="BSE.Windows.Forms">
<HintPath>..\..\..\..\..\Desktop\DIYDrones\myquad\greatmaps_e1bb830a18a3\Demo.WindowsForms\bin\Debug\BSE.Windows.Forms.dll</HintPath>
</Reference>
<Reference Include="Core">
<HintPath>..\..\..\..\..\Desktop\DIYDrones\kml-library\KmlTestbed\bin\Release\Core.dll</HintPath>
</Reference>
<Reference Include="DirectShowLib-2005">
<HintPath>..\..\..\..\..\Desktop\DIYDrones\myquad\DirectShowLib-2005.dll</HintPath>
</Reference>
<Reference Include="GMap.NET.Core">
<HintPath>..\..\..\..\..\Desktop\DIYDrones\myquad\greatmaps_e1bb830a18a3\GMap.NET.WindowsForms\bin\Debug\GMap.NET.Core.dll</HintPath>
</Reference>
<Reference Include="GMap.NET.WindowsForms">
<HintPath>..\..\..\..\..\Desktop\DIYDrones\myquad\greatmaps_e1bb830a18a3\GMap.NET.WindowsForms\bin\Debug\GMap.NET.WindowsForms.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>..\..\..\..\..\Desktop\DIYDrones\SrcSamples\bin\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="IronPython, Version=2.7.0.40, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\IronPython 2.7.1\IronPython-2.6.1\IronPython.dll</HintPath>
</Reference>
<Reference Include="IronPython.Modules, Version=2.7.0.40, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\IronPython 2.7.1\IronPython-2.6.1\IronPython.Modules.dll</HintPath>
</Reference>
<Reference Include="KMLib">
<HintPath>..\..\..\..\..\Desktop\DIYDrones\kml-library\KmlTestbed\bin\Release\KMLib.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Lib\log4net.dll</HintPath>
</Reference>
<Reference Include="MetaDataExtractor">
<HintPath>..\..\..\..\..\Desktop\DIYDrones\myquad\MetaDataExtractorCSharp240d\bin\Release\MetaDataExtractor.dll</HintPath>
</Reference>
<Reference Include="Microsoft.DirectX, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2902.0\Microsoft.DirectX.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.DirectX.DirectInput, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2902.0\Microsoft.DirectX.DirectInput.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Dynamic">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\IronPython 2.7.1\IronPython-2.6.1\Microsoft.Dynamic.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Scripting, Version=1.1.0.20, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\IronPython 2.7.1\IronPython-2.6.1\Microsoft.Scripting.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Scripting.Core">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\IronPython 2.7.1\IronPython-2.6.1\Microsoft.Scripting.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Scripting.Debugging">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\IronPython 2.7.1\IronPython-2.6.1\Microsoft.Scripting.Debugging.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Scripting.ExtensionAttribute, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\IronPython 2.7.1\IronPython-2.6.1\Microsoft.Scripting.ExtensionAttribute.dll</HintPath>
</Reference>
<Reference Include="OpenTK, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\Desktop\DIYDrones\virtualglobebook-OpenGlobe-ddf1d7e\ThirdParty\OpenTKGL4\Binaries\OpenTK\Release\OpenTK.dll</HintPath>
</Reference>
<Reference Include="OpenTK.GLControl, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\Desktop\DIYDrones\opentk\trunk\Binaries\OpenTK\Release\OpenTK.GLControl.dll</HintPath>
</Reference>
<Reference Include="SharpKml, Version=1.1.0.0, Culture=neutral, PublicKeyToken=e608cd7d975805ad, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\Desktop\DIYDrones\myquad\sharpkml\SharpKml\bin\Release\SharpKml.dll</HintPath>
</Reference>
<Reference Include="System">
<Private>False</Private>
@ -207,7 +185,6 @@
<Private>False</Private>
</Reference>
<Reference Include="System.Data.SQLite">
<HintPath>..\..\..\..\..\Desktop\DIYDrones\myquad\greatmaps_e1bb830a18a3\Demo.WindowsForms\bin\Debug\x86\System.Data.SQLite.DLL</HintPath>
</Reference>
<Reference Include="System.Drawing">
<Private>False</Private>
@ -229,7 +206,6 @@
</Reference>
<Reference Include="ZedGraph, Version=5.1.2.878, Culture=neutral, PublicKeyToken=02a83cbd123fcd60, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\ArdupilotSim\ArdupilotSim\bin\Release\ZedGraph.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@ -241,6 +217,7 @@
<Compile Include="Antenna\Tracker.Designer.cs">
<DependentUpon>Tracker.cs</DependentUpon>
</Compile>
<Compile Include="CodeGen.cs" />
<Compile Include="Controls\MessageBox.cs" />
<Compile Include="Controls\ProgressReporterDialogue.cs">
<SubType>Form</SubType>

View File

@ -11,6 +11,6 @@
<UpdateUrlHistory />
</PropertyGroup>
<PropertyGroup>
<ReferencePath>C:\Users\hog\Desktop\DIYDrones\myquad\greatmaps_e1bb830a18a3\Demo.WindowsForms\bin\Debug\;C:\Users\hog\Desktop\DIYDrones\myquad\sharpkml\SharpKml\bin\Release\;C:\Users\hog\Desktop\DIYDrones\myquad\MetaDataExtractorCSharp240d\bin\Release\;C:\Users\hog\Documents\Visual Studio 2010\Projects\ArdupilotMega\ArdupilotMega\Lib\</ReferencePath>
<ReferencePath>C:\Users\hog\Documents\Visual Studio 2010\Projects\ArdupilotMega\ArdupilotMega\Lib\;C:\Users\hog\Desktop\DIYDrones\myquad\greatmaps_e1bb830a18a3\Demo.WindowsForms\bin\Debug\;C:\Users\hog\Desktop\DIYDrones\myquad\sharpkml\SharpKml\bin\Release\;C:\Users\hog\Desktop\DIYDrones\myquad\MetaDataExtractorCSharp240d\bin\Release\</ReferencePath>
</PropertyGroup>
</Project>

View File

@ -157,7 +157,7 @@ namespace WebCamService
Start();
// Start waiting
if ( ! m_PictureReady.WaitOne(5000, false) )
if ( ! m_PictureReady.WaitOne(2000, false) )
{
throw new Exception("Timeout waiting to get picture");
}

View File

@ -0,0 +1,339 @@
using System;
using System.Text;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.CodeDom;
using Microsoft.CSharp;
using System.CodeDom.Compiler;
using System.Reflection;
using System.IO;
using System.Text.RegularExpressions;
namespace ArdupilotMega
{
static class CodeGen
{
public static string runCode(string code)
{
string answer = "";
GetMathMemberNames();
// change evaluation string to pick up Math class members
string expression = RefineEvaluationString(code);
// build the class using codedom
BuildClass(expression);
// compile the class into an in-memory assembly.
// if it doesn't compile, show errors in the window
CompilerResults results = CompileAssembly();
Console.WriteLine("...........................\r\n");
Console.WriteLine(_source.ToString());
// if the code compiled okay,
// run the code using the new assembly (which is inside the results)
if (results != null && results.CompiledAssembly != null)
{
// run the evaluation function
answer = RunCode(results);
}
else
{
}
return answer;
}
static ICodeCompiler CreateCompiler()
{
//Create an instance of the C# compiler
CodeDomProvider codeProvider = null;
codeProvider = new CSharpCodeProvider();
ICodeCompiler compiler = codeProvider.CreateCompiler();
return compiler;
}
/// <summary>
/// Creawte parameters for compiling
/// </summary>
/// <returns></returns>
static CompilerParameters CreateCompilerParameters()
{
//add compiler parameters and assembly references
CompilerParameters compilerParams = new CompilerParameters();
compilerParams.CompilerOptions = "/target:library /optimize";
compilerParams.GenerateExecutable = false;
compilerParams.GenerateInMemory = true;
compilerParams.IncludeDebugInformation = false;
compilerParams.ReferencedAssemblies.Add("mscorlib.dll");
compilerParams.ReferencedAssemblies.Add("System.dll");
compilerParams.ReferencedAssemblies.Add("System.Windows.Forms.dll");
//add any aditional references needed
// foreach (string refAssembly in code.References)
// compilerParams.ReferencedAssemblies.Add(refAssembly);
return compilerParams;
}
/// <summary>
/// Compiles the code from the code string
/// </summary>
/// <param name="compiler"></param>
/// <param name="parms"></param>
/// <param name="source"></param>
/// <returns></returns>
static private CompilerResults CompileCode(ICodeCompiler compiler, CompilerParameters parms, string source)
{
//actually compile the code
CompilerResults results = compiler.CompileAssemblyFromSource(
parms, source);
//Do we have any compiler errors?
if (results.Errors.Count > 0)
{
foreach (CompilerError error in results.Errors)
Console.WriteLine("Compile Error:" + error.ErrorText);
return null;
}
return results;
}
/// <summary>
/// Need to change eval string to use .NET Math library
/// </summary>
/// <param name="eval">evaluation expression</param>
/// <returns></returns>
static string RefineEvaluationString(string eval)
{
// look for regular expressions with only letters
Regex regularExpression = new Regex("[a-zA-Z_]+");
// track all functions and constants in the evaluation expression we already replaced
ArrayList replacelist = new ArrayList();
// find all alpha words inside the evaluation function that are possible functions
MatchCollection matches = regularExpression.Matches(eval);
foreach (Match m in matches)
{
// if the word is found in the math member map, add a Math prefix to it
bool isContainedInMathLibrary = _mathMembersMap[m.Value.ToUpper()] != null;
if (replacelist.Contains(m.Value) == false && isContainedInMathLibrary)
{
eval = eval.Replace(m.Value, "Math." + _mathMembersMap[m.Value.ToUpper()]);
}
// we matched it already, so don't allow us to replace it again
replacelist.Add(m.Value);
}
// return the modified evaluation string
return eval;
}
/// <summary>
/// Compiles the c# into an assembly if there are no syntax errors
/// </summary>
/// <returns></returns>
static private CompilerResults CompileAssembly()
{
// create a compiler
ICodeCompiler compiler = CreateCompiler();
// get all the compiler parameters
CompilerParameters parms = CreateCompilerParameters();
// compile the code into an assembly
CompilerResults results = CompileCode(compiler, parms, _source.ToString());
return results;
}
static ArrayList _mathMembers = new ArrayList();
static Hashtable _mathMembersMap = new Hashtable();
static void GetMathMemberNames()
{
// get a reflected assembly of the System assembly
Assembly systemAssembly = Assembly.GetAssembly(typeof(System.Math));
try
{
//cant call the entry method if the assembly is null
if (systemAssembly != null)
{
//Use reflection to get a reference to the Math class
Module[] modules = systemAssembly.GetModules(false);
Type[] types = modules[0].GetTypes();
//loop through each class that was defined and look for the first occurrance of the Math class
foreach (Type type in types)
{
if (type.Name == "Math")
{
// get all of the members of the math class and map them to the same member
// name in uppercase
MemberInfo[] mis = type.GetMembers();
foreach (MemberInfo mi in mis)
{
_mathMembers.Add(mi.Name);
_mathMembersMap[mi.Name.ToUpper()] = mi.Name;
}
}
//if the entry point method does return in Int32, then capture it and return it
}
//if it got here, then there was no entry point method defined. Tell user about it
}
}
catch (Exception ex)
{
Console.WriteLine("Error: An exception occurred while executing the script", ex);
}
}
/// <summary>
/// Runs the Calculate method in our on-the-fly assembly
/// </summary>
/// <param name="results"></param>
static private string RunCode(CompilerResults results)
{
Assembly executingAssembly = results.CompiledAssembly;
try
{
//cant call the entry method if the assembly is null
if (executingAssembly != null)
{
object assemblyInstance = executingAssembly.CreateInstance("ExpressionEvaluator.Calculator");
//Use reflection to call the static Main function
Module[] modules = executingAssembly.GetModules(false);
Type[] types = modules[0].GetTypes();
//loop through each class that was defined and look for the first occurrance of the entry point method
foreach (Type type in types)
{
MethodInfo[] mis = type.GetMethods();
foreach (MethodInfo mi in mis)
{
if (mi.Name == "Calculate")
{
object result = mi.Invoke(assemblyInstance, null);
return result.ToString();
}
}
}
}
}
catch (Exception ex)
{
Console.WriteLine("Error: An exception occurred while executing the script", ex);
}
return "";
}
static CodeMemberField FieldVariable(string fieldName, string typeName, MemberAttributes accessLevel)
{
CodeMemberField field = new CodeMemberField(typeName, fieldName);
field.Attributes = accessLevel;
return field;
}
static CodeMemberField FieldVariable(string fieldName, Type type, MemberAttributes accessLevel)
{
CodeMemberField field = new CodeMemberField(type, fieldName);
field.Attributes = accessLevel;
return field;
}
/// <summary>
/// Very simplistic getter/setter properties
/// </summary>
/// <param name="propName"></param>
/// <param name="internalName"></param>
/// <param name="type"></param>
/// <returns></returns>
static CodeMemberProperty MakeProperty(string propertyName, string internalName, Type type)
{
CodeMemberProperty myProperty = new CodeMemberProperty();
myProperty.Name = propertyName;
myProperty.Comments.Add(new CodeCommentStatement(String.Format("The {0} property is the returned result", propertyName)));
myProperty.Attributes = MemberAttributes.Public;
myProperty.Type = new CodeTypeReference(type);
myProperty.HasGet = true;
myProperty.GetStatements.Add(
new CodeMethodReturnStatement(
new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), internalName)));
myProperty.HasSet = true;
myProperty.SetStatements.Add(
new CodeAssignStatement(
new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), internalName),
new CodePropertySetValueReferenceExpression()));
return myProperty;
}
static StringBuilder _source = new StringBuilder();
/// <summary>
/// Main driving routine for building a class
/// </summary>
static void BuildClass(string expression)
{
// need a string to put the code into
_source = new StringBuilder();
StringWriter sw = new StringWriter(_source);
//Declare your provider and generator
CSharpCodeProvider codeProvider = new CSharpCodeProvider();
ICodeGenerator generator = codeProvider.CreateGenerator(sw);
CodeGeneratorOptions codeOpts = new CodeGeneratorOptions();
CodeNamespace myNamespace = new CodeNamespace("ExpressionEvaluator");
myNamespace.Imports.Add(new CodeNamespaceImport("System"));
myNamespace.Imports.Add(new CodeNamespaceImport("System.Windows.Forms"));
//Build the class declaration and member variables
CodeTypeDeclaration classDeclaration = new CodeTypeDeclaration();
classDeclaration.IsClass = true;
classDeclaration.Name = "Calculator";
classDeclaration.Attributes = MemberAttributes.Public;
classDeclaration.Members.Add(FieldVariable("answer", typeof(string), MemberAttributes.Private));
//default constructor
CodeConstructor defaultConstructor = new CodeConstructor();
defaultConstructor.Attributes = MemberAttributes.Public;
defaultConstructor.Comments.Add(new CodeCommentStatement("Default Constructor for class", true));
defaultConstructor.Statements.Add(new CodeSnippetStatement("//TODO: implement default constructor"));
classDeclaration.Members.Add(defaultConstructor);
//property
classDeclaration.Members.Add(MakeProperty("Answer", "answer", typeof(string)));
//Our Calculate Method
CodeMemberMethod myMethod = new CodeMemberMethod();
myMethod.Name = "Calculate";
myMethod.ReturnType = new CodeTypeReference(typeof(string));
myMethod.Comments.Add(new CodeCommentStatement("Calculate an expression", true));
myMethod.Attributes = MemberAttributes.Public;
myMethod.Statements.Add(new CodeAssignStatement(new CodeSnippetExpression("Object obj"), new CodeSnippetExpression(expression)));
myMethod.Statements.Add(new CodeAssignStatement(new CodeSnippetExpression("Answer"), new CodeSnippetExpression("obj.ToString()")));
myMethod.Statements.Add(
new CodeMethodReturnStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "Answer")));
classDeclaration.Members.Add(myMethod);
//write code
myNamespace.Types.Add(classDeclaration);
generator.GenerateCodeFromNamespace(myNamespace, sw, codeOpts);
sw.Flush();
sw.Close();
}
}
}

View File

@ -7,6 +7,7 @@ using ArdupilotMega;
namespace System.Windows.Forms
{
#pragma warning disable 414, 3021
public static class MessageBox
{
const int FORM_Y_MARGIN = 10;
@ -94,7 +95,12 @@ namespace System.Windows.Forms
AddButtonsToForm(msgBoxFrm, buttons);
ThemeManager.ApplyThemeTo(msgBoxFrm);
// display even if theme fails
try
{
ThemeManager.ApplyThemeTo(msgBoxFrm);
}
catch { }
if (System.Windows.Forms.Application.OpenForms.Count > 0)
{

View File

@ -19,6 +19,14 @@ namespace ArdupilotMega
bool inOnPaint = false;
public Color BGGradTop = Color.FromArgb(0x94, 0xc1, 0x1f);
public Color BGGradBot = Color.FromArgb(0xcd, 0xe2, 0x96);
public new Color ForeColor = Color.FromArgb(0x40, 0x57, 0x04);
public Color Outline = Color.FromArgb(0x79, 0x94, 0x29);
protected override void OnPaint(PaintEventArgs pevent)
{
//base.OnPaint(pevent);
@ -36,9 +44,9 @@ namespace ArdupilotMega
Rectangle outside = new Rectangle(0, 0, this.Width, this.Height);
LinearGradientBrush linear = new LinearGradientBrush(outside, Color.FromArgb(0x94, 0xc1, 0x1f), Color.FromArgb(0xcd, 0xe2, 0x96), LinearGradientMode.Vertical);
LinearGradientBrush linear = new LinearGradientBrush(outside, BGGradTop, BGGradBot, LinearGradientMode.Vertical);
Pen mypen = new Pen(Color.FromArgb(0x79, 0x94, 0x29), 2);
Pen mypen = new Pen(Outline, 2);
/*
gr.FillRectangle(new SolidBrush(Color.FromArgb(0x26, 0x27, 0x28)), outside);
@ -71,7 +79,7 @@ namespace ArdupilotMega
gr.DrawRectangle(mypen, outside);
SolidBrush mybrush = new SolidBrush(Color.FromArgb(0x40, 0x57, 0x04));
SolidBrush mybrush = new SolidBrush(ForeColor);
if (mouseover)
{

View File

@ -1427,6 +1427,12 @@ namespace ArdupilotMega.GCSViews
quickadd = true;
Commands.Rows.Clear();
if (cmds.Count == 0)
{
quickadd = false;
return;
}
int i = -1;
foreach (Locationwp temp in cmds)
{

View File

@ -439,9 +439,6 @@ namespace ArdupilotMega.GCSViews
}
}
}
}
FGNetFDM lastfdmdata = new FGNetFDM();

View File

@ -734,6 +734,17 @@ namespace ArdupilotMega
value *= 100.0f;
}
}
else if (paramname.ToUpper().StartsWith("TUNE_"))
{
if (fromapm)
{
value /= 1000.0f;
}
else
{
value *= 1000.0f;
}
}
}
/// <summary>
@ -1440,7 +1451,18 @@ namespace ArdupilotMega
public object DebugPacket(byte[] datin)
{
string text = "";
return DebugPacket(datin, ref text);
return DebugPacket(datin, ref text,true);
}
public object DebugPacket(byte[] datin, bool PrintToConsole)
{
string text = "";
return DebugPacket(datin, ref text, PrintToConsole);
}
public object DebugPacket(byte[] datin, ref string text)
{
return DebugPacket(datin, ref text, true);
}
/// <summary>
@ -1448,7 +1470,7 @@ namespace ArdupilotMega
/// </summary>
/// <param name="datin">packet byte array</param>
/// <returns>struct of data</returns>
public object DebugPacket(byte[] datin, ref string text)
public object DebugPacket(byte[] datin, ref string text, bool PrintToConsole)
{
string textoutput;
try
@ -1470,34 +1492,46 @@ namespace ArdupilotMega
Type test = data.GetType();
textoutput = textoutput + test.Name + " ";
foreach (var field in test.GetFields())
if (PrintToConsole)
{
// field.Name has the field's name.
object fieldValue = field.GetValue(data); // Get value
textoutput = textoutput + test.Name + " ";
if (field.FieldType.IsArray)
foreach (var field in test.GetFields())
{
textoutput = textoutput + field.Name + "=";
byte[] crap = (byte[])fieldValue;
foreach (byte fiel in crap)
// field.Name has the field's name.
object fieldValue = field.GetValue(data); // Get value
if (field.FieldType.IsArray)
{
textoutput = textoutput + fiel + ",";
textoutput = textoutput + field.Name + "=";
byte[] crap = (byte[])fieldValue;
foreach (byte fiel in crap)
{
if (fiel == 0)
{
break;
}
else
{
textoutput = textoutput + (char)fiel;
}
}
textoutput = textoutput + " ";
}
else
{
textoutput = textoutput + field.Name + "=" + fieldValue.ToString() + " ";
}
textoutput = textoutput + " ";
}
else
{
textoutput = textoutput + field.Name + "=" + fieldValue.ToString() + " ";
}
}
textoutput = textoutput + " Len:" + datin.Length + "\r\n";
Console.Write(textoutput);
textoutput = textoutput + " Len:" + datin.Length + "\r\n";
if (PrintToConsole)
Console.Write(textoutput);
if (text != null)
text = textoutput;
if (text != null)
text = textoutput;
}
return data;
}

View File

@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
namespace ArdupilotMega
{
#if !MAVLINK10
#if !MAVLINK10
partial class MAVLink
{
public byte[] MAVLINK_MESSAGE_LENGTHS = new byte[] {3, 4, 8, 14, 8, 28, 3, 32, 0, 2, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 19, 2, 23, 21, 0, 37, 26, 101, 26, 16, 32, 32, 37, 32, 11, 17, 17, 16, 18, 36, 4, 4, 2, 2, 4, 2, 2, 3, 14, 12, 18, 16, 8, 27, 25, 18, 18, 24, 24, 0, 0, 0, 26, 16, 36, 5, 6, 56, 26, 21, 18, 0, 0, 18, 20, 20, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 8, 4, 12, 15, 13, 6, 15, 14, 0, 12, 3, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 14, 14, 51, 5};
public byte[] MAVLINK_MESSAGE_CRCS = new byte[] {72, 39, 190, 92, 191, 217, 104, 119, 0, 219, 60, 186, 10, 0, 0, 0, 0, 0, 0, 0, 89, 159, 162, 121, 0, 149, 222, 110, 179, 136, 66, 126, 185, 147, 112, 252, 162, 215, 229, 128, 9, 106, 101, 213, 4, 229, 21, 214, 215, 14, 206, 50, 157, 126, 108, 213, 95, 5, 127, 0, 0, 0, 57, 126, 130, 119, 193, 191, 236, 158, 143, 0, 0, 104, 123, 131, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 155, 0, 0, 0, 0, 0, 0, 0, 0, 0, 143, 29, 208, 188, 118, 242, 19, 97, 233, 0, 18, 68, 136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 178, 224, 60, 106, 7};
public byte[] MAVLINK_MESSAGE_LENGTHS = new byte[] {3, 4, 8, 14, 8, 28, 3, 32, 0, 2, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 19, 2, 23, 21, 0, 37, 26, 101, 26, 16, 32, 32, 37, 32, 11, 17, 17, 16, 18, 36, 4, 4, 2, 2, 4, 2, 2, 3, 14, 12, 18, 16, 8, 27, 25, 18, 18, 24, 24, 0, 0, 0, 26, 16, 36, 5, 6, 56, 26, 21, 18, 0, 0, 18, 20, 20, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 8, 4, 12, 15, 13, 6, 15, 14, 0, 12, 3, 8, 28, 36, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 14, 14, 51, 5};
public byte[] MAVLINK_MESSAGE_CRCS = new byte[] {72, 39, 190, 92, 191, 217, 104, 119, 0, 219, 60, 186, 10, 0, 0, 0, 0, 0, 0, 0, 89, 159, 162, 121, 0, 149, 222, 110, 179, 136, 66, 126, 185, 147, 112, 252, 162, 215, 229, 128, 9, 106, 101, 213, 4, 229, 21, 214, 215, 14, 206, 50, 157, 126, 108, 213, 95, 5, 127, 0, 0, 0, 57, 126, 130, 119, 193, 191, 236, 158, 143, 0, 0, 104, 123, 131, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 155, 0, 0, 0, 0, 0, 0, 0, 0, 0, 143, 29, 208, 188, 118, 242, 19, 97, 233, 0, 18, 68, 136, 205, 42, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 178, 224, 60, 106, 7};
public enum MAV_MOUNT_MODE
{
MAV_MOUNT_MODE_RETRACT=0, /* Load and keep safe position (Roll,Pitch,Yaw) from EEPROM and stop stabilization | */
@ -78,6 +78,20 @@ namespace ArdupilotMega
};
public const byte MAVLINK_MSG_ID_AP_ADC_LEN = 12;
public const byte MAVLINK_MSG_ID_DCM = 163;
[StructLayout(LayoutKind.Sequential,Pack=1)]
public struct __mavlink_dcm_t
{
public float omegaIx; /// X gyro drift estimate rad/s
public float omegaIy; /// Y gyro drift estimate rad/s
public float omegaIz; /// Z gyro drift estimate rad/s
public float accel_weight; /// average accel_weight
public float renorm_val; /// average renormalisation value
public float error_rp; /// average error_roll_pitch value
public float error_yaw; /// average error_yaw value
};
public const byte MAVLINK_MSG_ID_DCM_LEN = 28;
public const byte MAVLINK_MSG_ID_DIGICAM_CONFIGURE = 154;
[StructLayout(LayoutKind.Sequential,Pack=1)]
public struct __mavlink_digicam_configure_t
@ -166,6 +180,15 @@ namespace ArdupilotMega
};
public const byte MAVLINK_MSG_ID_FENCE_STATUS_LEN = 8;
public const byte MAVLINK_MSG_ID_HWSTATUS = 165;
[StructLayout(LayoutKind.Sequential,Pack=1)]
public struct __mavlink_hwstatus_t
{
public ushort Vcc; /// board voltage (mV)
public byte I2Cerr; /// I2C error count
};
public const byte MAVLINK_MSG_ID_HWSTATUS_LEN = 3;
public const byte MAVLINK_MSG_ID_MEMINFO = 152;
[StructLayout(LayoutKind.Sequential,Pack=1)]
public struct __mavlink_meminfo_t
@ -244,6 +267,22 @@ namespace ArdupilotMega
};
public const byte MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN = 8;
public const byte MAVLINK_MSG_ID_SIMSTATE = 164;
[StructLayout(LayoutKind.Sequential,Pack=1)]
public struct __mavlink_simstate_t
{
public float roll; /// Roll angle (rad)
public float pitch; /// Pitch angle (rad)
public float yaw; /// Yaw angle (rad)
public float xacc; /// X acceleration m/s/s
public float yacc; /// Y acceleration m/s/s
public float zacc; /// Z acceleration m/s/s
public float xgyro; /// Angular speed around X axis rad/s
public float ygyro; /// Angular speed around Y axis rad/s
public float zgyro; /// Angular speed around Z axis rad/s
};
public const byte MAVLINK_MSG_ID_SIMSTATE_LEN = 36;
public enum MAV_DATA_STREAM
{
MAV_DATA_STREAM_ALL=0, /* Enable all data streams | */
@ -1305,9 +1344,9 @@ namespace ArdupilotMega
MAV_FRAME_LOCAL_ENU = 4
};
Type[] mavstructs = new Type[] {typeof( __mavlink_heartbeat_t) ,typeof( __mavlink_boot_t) ,null ,typeof( __mavlink_ping_t) ,null ,typeof( __mavlink_change_operator_control_t) ,typeof( __mavlink_change_operator_control_ack_t) ,typeof( __mavlink_auth_key_t) ,null ,typeof( __mavlink_action_ack_t) ,typeof( __mavlink_action_t) ,typeof( __mavlink_set_mode_t) ,typeof( __mavlink_set_nav_mode_t) ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_param_request_read_t) ,typeof( __mavlink_param_request_list_t) ,typeof( __mavlink_param_value_t) ,typeof( __mavlink_param_set_t) ,null ,typeof( __mavlink_gps_raw_int_t) ,typeof( __mavlink_scaled_imu_t) ,typeof( __mavlink_gps_status_t) ,typeof( __mavlink_raw_imu_t) ,typeof( __mavlink_raw_pressure_t) ,typeof( __mavlink_attitude_t) ,typeof( __mavlink_local_position_t) ,typeof( __mavlink_gps_raw_t) ,typeof( __mavlink_global_position_t) ,typeof( __mavlink_sys_status_t) ,typeof( __mavlink_rc_channels_raw_t) ,typeof( __mavlink_rc_channels_scaled_t) ,typeof( __mavlink_servo_output_raw_t) ,typeof( __mavlink_scaled_pressure_t) ,typeof( __mavlink_waypoint_t) ,typeof( __mavlink_waypoint_request_t) ,typeof( __mavlink_waypoint_set_current_t) ,typeof( __mavlink_waypoint_current_t) ,typeof( __mavlink_waypoint_request_list_t) ,typeof( __mavlink_waypoint_count_t) ,typeof( __mavlink_waypoint_clear_all_t) ,typeof( __mavlink_waypoint_reached_t) ,typeof( __mavlink_waypoint_ack_t) ,typeof( __mavlink_gps_set_global_origin_t) ,typeof( __mavlink_gps_local_origin_set_t) ,typeof( __mavlink_local_position_setpoint_set_t) ,typeof( __mavlink_local_position_setpoint_t) ,typeof( __mavlink_control_status_t) ,typeof( __mavlink_safety_set_allowed_area_t) ,typeof( __mavlink_safety_allowed_area_t) ,typeof( __mavlink_set_roll_pitch_yaw_thrust_t) ,typeof( __mavlink_set_roll_pitch_yaw_speed_thrust_t) ,typeof( __mavlink_roll_pitch_yaw_thrust_setpoint_t) ,typeof( __mavlink_roll_pitch_yaw_speed_thrust_setpoint_t) ,null ,null ,null ,typeof( __mavlink_nav_controller_output_t) ,typeof( __mavlink_position_target_t) ,typeof( __mavlink_state_correction_t) ,typeof( __mavlink_set_altitude_t) ,typeof( __mavlink_request_data_stream_t) ,typeof( __mavlink_hil_state_t) ,typeof( __mavlink_hil_controls_t) ,typeof( __mavlink_manual_control_t) ,typeof( __mavlink_rc_channels_override_t) ,null ,null ,typeof( __mavlink_global_position_int_t) ,typeof( __mavlink_vfr_hud_t) ,typeof( __mavlink_command_t) ,typeof( __mavlink_command_ack_t) ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_optical_flow_t) ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_object_detection_event_t) ,null ,null ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_sensor_offsets_t) ,typeof( __mavlink_set_mag_offsets_t) ,typeof( __mavlink_meminfo_t) ,typeof( __mavlink_ap_adc_t) ,typeof( __mavlink_digicam_configure_t) ,typeof( __mavlink_digicam_control_t) ,typeof( __mavlink_mount_configure_t) ,typeof( __mavlink_mount_control_t) ,typeof( __mavlink_mount_status_t) ,null ,typeof( __mavlink_fence_point_t) ,typeof( __mavlink_fence_fetch_point_t) ,typeof( __mavlink_fence_status_t) ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_debug_vect_t) ,typeof( __mavlink_named_value_float_t) ,typeof( __mavlink_named_value_int_t) ,typeof( __mavlink_statustext_t) ,typeof( __mavlink_debug_t) ,null ,};
Type[] mavstructs = new Type[] {typeof( __mavlink_heartbeat_t) ,typeof( __mavlink_boot_t) ,null ,typeof( __mavlink_ping_t) ,null ,typeof( __mavlink_change_operator_control_t) ,typeof( __mavlink_change_operator_control_ack_t) ,typeof( __mavlink_auth_key_t) ,null ,typeof( __mavlink_action_ack_t) ,typeof( __mavlink_action_t) ,typeof( __mavlink_set_mode_t) ,typeof( __mavlink_set_nav_mode_t) ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_param_request_read_t) ,typeof( __mavlink_param_request_list_t) ,typeof( __mavlink_param_value_t) ,typeof( __mavlink_param_set_t) ,null ,typeof( __mavlink_gps_raw_int_t) ,typeof( __mavlink_scaled_imu_t) ,typeof( __mavlink_gps_status_t) ,typeof( __mavlink_raw_imu_t) ,typeof( __mavlink_raw_pressure_t) ,typeof( __mavlink_attitude_t) ,typeof( __mavlink_local_position_t) ,typeof( __mavlink_gps_raw_t) ,typeof( __mavlink_global_position_t) ,typeof( __mavlink_sys_status_t) ,typeof( __mavlink_rc_channels_raw_t) ,typeof( __mavlink_rc_channels_scaled_t) ,typeof( __mavlink_servo_output_raw_t) ,typeof( __mavlink_scaled_pressure_t) ,typeof( __mavlink_waypoint_t) ,typeof( __mavlink_waypoint_request_t) ,typeof( __mavlink_waypoint_set_current_t) ,typeof( __mavlink_waypoint_current_t) ,typeof( __mavlink_waypoint_request_list_t) ,typeof( __mavlink_waypoint_count_t) ,typeof( __mavlink_waypoint_clear_all_t) ,typeof( __mavlink_waypoint_reached_t) ,typeof( __mavlink_waypoint_ack_t) ,typeof( __mavlink_gps_set_global_origin_t) ,typeof( __mavlink_gps_local_origin_set_t) ,typeof( __mavlink_local_position_setpoint_set_t) ,typeof( __mavlink_local_position_setpoint_t) ,typeof( __mavlink_control_status_t) ,typeof( __mavlink_safety_set_allowed_area_t) ,typeof( __mavlink_safety_allowed_area_t) ,typeof( __mavlink_set_roll_pitch_yaw_thrust_t) ,typeof( __mavlink_set_roll_pitch_yaw_speed_thrust_t) ,typeof( __mavlink_roll_pitch_yaw_thrust_setpoint_t) ,typeof( __mavlink_roll_pitch_yaw_speed_thrust_setpoint_t) ,null ,null ,null ,typeof( __mavlink_nav_controller_output_t) ,typeof( __mavlink_position_target_t) ,typeof( __mavlink_state_correction_t) ,typeof( __mavlink_set_altitude_t) ,typeof( __mavlink_request_data_stream_t) ,typeof( __mavlink_hil_state_t) ,typeof( __mavlink_hil_controls_t) ,typeof( __mavlink_manual_control_t) ,typeof( __mavlink_rc_channels_override_t) ,null ,null ,typeof( __mavlink_global_position_int_t) ,typeof( __mavlink_vfr_hud_t) ,typeof( __mavlink_command_t) ,typeof( __mavlink_command_ack_t) ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_optical_flow_t) ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_object_detection_event_t) ,null ,null ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_sensor_offsets_t) ,typeof( __mavlink_set_mag_offsets_t) ,typeof( __mavlink_meminfo_t) ,typeof( __mavlink_ap_adc_t) ,typeof( __mavlink_digicam_configure_t) ,typeof( __mavlink_digicam_control_t) ,typeof( __mavlink_mount_configure_t) ,typeof( __mavlink_mount_control_t) ,typeof( __mavlink_mount_status_t) ,null ,typeof( __mavlink_fence_point_t) ,typeof( __mavlink_fence_fetch_point_t) ,typeof( __mavlink_fence_status_t) ,typeof( __mavlink_dcm_t) ,typeof( __mavlink_simstate_t) ,typeof( __mavlink_hwstatus_t) ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_debug_vect_t) ,typeof( __mavlink_named_value_float_t) ,typeof( __mavlink_named_value_int_t) ,typeof( __mavlink_statustext_t) ,typeof( __mavlink_debug_t) ,null ,};
}
#endif
#endif
}

View File

@ -205,8 +205,15 @@ namespace ArdupilotMega
if (config["speechenable"] != null)
MainV2.speechenable = bool.Parse(config["speechenable"].ToString());
//int fixme;
/*
MainV2.cs.rateattitude = 50;
MainV2.cs.rateposition = 50;
MainV2.cs.ratestatus = 50;
MainV2.cs.raterc = 50;
MainV2.cs.ratesensors = 50;
*/
try
{
if (config["TXT_homelat"] != null)
@ -329,10 +336,6 @@ namespace ArdupilotMega
temp.Dock = DockStyle.Fill;
//temp.ForeColor = Color.White;
//temp.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
MyView.Controls.Add(temp);
if (MainV2.config["FlightSplitter"] != null)
@ -355,10 +358,6 @@ namespace ArdupilotMega
temp.Dock = DockStyle.Fill;
temp.ForeColor = Color.White;
temp.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
MyView.Controls.Add(temp);
}
@ -390,10 +389,6 @@ namespace ArdupilotMega
temp.Dock = DockStyle.Fill;
temp.ForeColor = Color.White;
temp.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
temp.Size = MyView.Size;
//temp.Parent = MyView;
@ -417,10 +412,6 @@ namespace ArdupilotMega
temp.Dock = DockStyle.Fill;
temp.ForeColor = Color.White;
temp.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
MyView.Controls.Add(temp);
}
@ -438,10 +429,6 @@ namespace ArdupilotMega
temp.Dock = DockStyle.Fill;
temp.ForeColor = Color.White;
temp.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
MyView.Controls.Add(temp);
}
@ -480,10 +467,6 @@ namespace ArdupilotMega
MyView.Controls.Add(temp);
temp.ForeColor = Color.White;
temp.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
}
private void MenuConnect_Click(object sender, EventArgs e)

View File

@ -33,6 +33,7 @@
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.BUT_humanreadable = new ArdupilotMega.MyButton();
this.BUT_graphmavlog = new ArdupilotMega.MyButton();
this.zg1 = new ZedGraph.ZedGraphControl();
this.SuspendLayout();
//
// BUT_redokml
@ -61,10 +62,23 @@
this.BUT_graphmavlog.UseVisualStyleBackColor = true;
this.BUT_graphmavlog.Click += new System.EventHandler(this.BUT_graphmavlog_Click);
//
// zg1
//
resources.ApplyResources(this.zg1, "zg1");
this.zg1.Name = "zg1";
this.zg1.ScrollGrace = 0D;
this.zg1.ScrollMaxX = 0D;
this.zg1.ScrollMaxY = 0D;
this.zg1.ScrollMaxY2 = 0D;
this.zg1.ScrollMinX = 0D;
this.zg1.ScrollMinY = 0D;
this.zg1.ScrollMinY2 = 0D;
//
// MavlinkLog
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.zg1);
this.Controls.Add(this.BUT_graphmavlog);
this.Controls.Add(this.BUT_humanreadable);
this.Controls.Add(this.progressBar1);
@ -81,5 +95,6 @@
private System.Windows.Forms.ProgressBar progressBar1;
private MyButton BUT_humanreadable;
private MyButton BUT_graphmavlog;
private ZedGraph.ZedGraphControl zg1;
}
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
@ -22,14 +23,19 @@ using SharpKml.Dom.GX;
using System.Reflection;
using System.Xml;
using log4net;
using ZedGraph; // Graphs
namespace ArdupilotMega
{
public partial class MavlinkLog : Form
{
private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
List<CurrentState> flightdata = new List<CurrentState>();
List<string> selection = new List<string>();
public MavlinkLog()
{
InitializeComponent();
@ -232,7 +238,7 @@ namespace ArdupilotMega
}
catch { }
Link link = new Link();
SharpKml.Dom.Link link = new SharpKml.Dom.Link();
link.Href = new Uri("block_plane_0.dae", UriKind.Relative);
model.Link = link;
@ -369,7 +375,7 @@ namespace ArdupilotMega
float oldlatlngalt = 0;
DateTime appui = DateTime.Now;
int appui = 0;
while (mine.logplaybackfile.BaseStream.Position < mine.logplaybackfile.BaseStream.Length)
{
@ -384,11 +390,11 @@ namespace ArdupilotMega
cs.UpdateCurrentSettings(null, true, mine);
if (appui != DateTime.Now)
if (appui != DateTime.Now.Second)
{
// cant do entire app as mixes with flightdata timer
this.Refresh();
appui = DateTime.Now;
appui = DateTime.Now.Second;
}
try
@ -514,11 +520,19 @@ namespace ArdupilotMega
private void BUT_graphmavlog_Click(object sender, EventArgs e)
{
//http://devreminder.wordpress.com/net/net-framework-fundamentals/c-dynamic-math-expression-evaluation/
//http://www.c-sharpcorner.com/UploadFile/mgold/CodeDomCalculator08082005003253AM/CodeDomCalculator.aspx
//string mathExpression = "(1+1)*3";
//Console.WriteLine(String.Format("{0}={1}",mathExpression, Evaluate(mathExpression)));
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "*.tlog|*.tlog";
openFileDialog1.FilterIndex = 2;
openFileDialog1.RestoreDirectory = true;
openFileDialog1.Multiselect = true;
openFileDialog1.Multiselect = false;
try
{
openFileDialog1.InitialDirectory = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs" + Path.DirectorySeparatorChar;
@ -527,73 +541,289 @@ namespace ArdupilotMega
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
foreach (string logfile in openFileDialog1.FileNames)
List<string> fields = GetLogFileValidFields(openFileDialog1.FileName);
zg1.GraphPane.CurveList.Clear();
GetLogFileData(zg1, openFileDialog1.FileName, fields);
try
{
// fix new line types
ThemeManager.ApplyThemeTo(this);
MAVLink mine = new MAVLink();
mine.logplaybackfile = new BinaryReader(File.Open(logfile, FileMode.Open, FileAccess.Read, FileShare.Read));
mine.logreadmode = true;
mine.packets.Initialize(); // clear
CurrentState cs = new CurrentState();
float oldlatlngalt = 0;
DateTime appui = DateTime.Now;
while (mine.logplaybackfile.BaseStream.Position < mine.logplaybackfile.BaseStream.Length)
{
// bar moves to 50 % in this step
progressBar1.Value = (int)((float)mine.logplaybackfile.BaseStream.Position / (float)mine.logplaybackfile.BaseStream.Length * 100.0f / 2.0f);
progressBar1.Invalidate();
progressBar1.Refresh();
byte[] packet = mine.readPacket();
cs.datetime = mine.lastlogread;
cs.UpdateCurrentSettings(null, true, mine);
if (appui != DateTime.Now)
{
// cant do entire app as mixes with flightdata timer
this.Refresh();
appui = DateTime.Now;
}
try
{
if (MainV2.talk != null)
MainV2.talk.SpeakAsyncCancelAll();
}
catch { } // ignore because of this Exception System.PlatformNotSupportedException: No voice installed on the system or none available with the current security setting.
if ((float)(cs.lat + cs.lng) != oldlatlngalt
&& cs.lat != 0 && cs.lng != 0)
{
Console.WriteLine(cs.lat + " " + cs.lng + " " + cs.alt + " lah " + (float)(cs.lat + cs.lng) + "!=" + oldlatlngalt);
CurrentState cs2 = (CurrentState)cs.Clone();
flightdata.Add(cs2);
oldlatlngalt = (cs.lat + cs.lng);
}
}
mine.logreadmode = false;
mine.logplaybackfile.Close();
mine.logplaybackfile = null;
Application.DoEvents();
//writeKML(logfile + ".kml");
progressBar1.Value = 100;
zg1.Invalidate();
zg1.AxisChange();
}
catch { }
}
}
static int[] ColourValues = new int[] {
0xFF0000,0x00FF00,0x0000FF,0xFFFF00,0xFF00FF,0x00FFFF,0x000000,
0x800000,0x008000,0x000080,0x808000,0x800080,0x008080,0x808080,
0xC00000,0x00C000,0x0000C0,0xC0C000,0xC000C0,0x00C0C0,0xC0C0C0,
0x400000,0x004000,0x000040,0x404000,0x400040,0x004040,0x404040,
0x200000,0x002000,0x000020,0x202000,0x200020,0x002020,0x202020,
0x600000,0x006000,0x000060,0x606000,0x600060,0x006060,0x606060,
0xA00000,0x00A000,0x0000A0,0xA0A000,0xA000A0,0x00A0A0,0xA0A0A0,
0xE00000,0x00E000,0x0000E0,0xE0E000,0xE000E0,0x00E0E0,0xE0E0E0,
};
private void GetLogFileData(ZedGraphControl zg1, string logfile, List<string> lookforfields)
{
if (zg1 == null)
return;
if (lookforfields != null && lookforfields.Count == 0)
return;
PointPairList[] lists = new PointPairList[lookforfields.Count];
Random rand = new Random();
int step = 0;
// setup display and arrays
for (int a = 0; a < lookforfields.Count; a++)
{
lists[a] = new PointPairList();
LineItem myCurve;
int colorvalue = ColourValues[step % ColourValues.Length];
step++;
myCurve = zg1.GraphPane.AddCurve(lookforfields[a].Replace("__mavlink_", ""), lists[a], Color.FromArgb(unchecked( colorvalue + (int)0xff000000)), SymbolType.None);
}
{
MAVLink MavlinkInterface = new MAVLink();
MavlinkInterface.logplaybackfile = new BinaryReader(File.Open(logfile, FileMode.Open, FileAccess.Read, FileShare.Read));
MavlinkInterface.logreadmode = true;
MavlinkInterface.packets.Initialize(); // clear
int appui = 0;
// to get first packet time
MavlinkInterface.readPacket();
DateTime startlogtime = MavlinkInterface.lastlogread;
while (MavlinkInterface.logplaybackfile.BaseStream.Position < MavlinkInterface.logplaybackfile.BaseStream.Length)
{
progressBar1.Value = (int)((float)MavlinkInterface.logplaybackfile.BaseStream.Position / (float)MavlinkInterface.logplaybackfile.BaseStream.Length * 100.0f);
progressBar1.Refresh();
byte[] packet = MavlinkInterface.readPacket();
object data = MavlinkInterface.DebugPacket(packet, false);
Type test = data.GetType();
foreach (var field in test.GetFields())
{
// field.Name has the field's name.
object fieldValue = field.GetValue(data); // Get value
if (field.FieldType.IsArray)
{
}
else
{
string currentitem = field.Name + " " + field.DeclaringType.Name;
int a = 0;
foreach (var lookforfield in lookforfields)
{
if (currentitem == lookforfield)
{
object value = field.GetValue(data);
// seconds scale
double time = (MavlinkInterface.lastlogread - startlogtime).TotalMilliseconds / 1000.0;
if (value.GetType() == typeof(Single))
{
lists[a].Add(time, (Single)field.GetValue(data));
}
else if (value.GetType() == typeof(short))
{
lists[a].Add(time, (short)field.GetValue(data));
}
else if (value.GetType() == typeof(ushort))
{
lists[a].Add(time, (ushort)field.GetValue(data));
}
else if (value.GetType() == typeof(byte))
{
lists[a].Add(time, (byte)field.GetValue(data));
}
else if (value.GetType() == typeof(Int32))
{
lists[a].Add(time, (Int32)field.GetValue(data));
}
}
a++;
}
}
}
if (appui != DateTime.Now.Second)
{
// cant do entire app as mixes with flightdata timer
this.Refresh();
appui = DateTime.Now.Second;
}
}
MavlinkInterface.logreadmode = false;
MavlinkInterface.logplaybackfile.Close();
MavlinkInterface.logplaybackfile = null;
//writeKML(logfile + ".kml");
progressBar1.Value = 100;
}
}
private List<string> GetLogFileValidFields(string logfile)
{
Form selectform = SelectDataToGraphForm();
Hashtable seenIt = new Hashtable();
{
MAVLink mine = new MAVLink();
mine.logplaybackfile = new BinaryReader(File.Open(logfile, FileMode.Open, FileAccess.Read, FileShare.Read));
mine.logreadmode = true;
mine.packets.Initialize(); // clear
while (mine.logplaybackfile.BaseStream.Position < mine.logplaybackfile.BaseStream.Length)
{
progressBar1.Value = (int)((float)mine.logplaybackfile.BaseStream.Position / (float)mine.logplaybackfile.BaseStream.Length * 100.0f);
this.Refresh();
byte[] packet = mine.readPacket();
object data = mine.DebugPacket(packet, false);
Type test = data.GetType();
foreach (var field in test.GetFields())
{
// field.Name has the field's name.
object fieldValue = field.GetValue(data); // Get value
if (field.FieldType.IsArray)
{
}
else
{
if (!seenIt.ContainsKey(field.DeclaringType.Name + "." + field.Name))
{
AddDataOption(selectform, field.Name + " " + field.DeclaringType.Name);
seenIt[field.DeclaringType.Name + "." + field.Name] = 1;
}
}
}
}
mine.logreadmode = false;
mine.logplaybackfile.Close();
mine.logplaybackfile = null;
selectform.ShowDialog();
progressBar1.Value = 100;
}
return selection;
}
private void AddDataOption(Form selectform, string Name)
{
CheckBox chk_box = new CheckBox();
log.Info("Add Option " + Name);
chk_box.Text = Name;
chk_box.Name = Name;
chk_box.Location = new System.Drawing.Point(x, y);
chk_box.Size = new System.Drawing.Size(100, 20);
chk_box.CheckedChanged += new EventHandler(chk_box_CheckedChanged);
selectform.Controls.Add(chk_box);
Application.DoEvents();
x += 0;
y += 20;
if (y > selectform.Height - 50)
{
x += 100;
y = 10;
selectform.Width = x + 100;
}
}
void chk_box_CheckedChanged(object sender, EventArgs e)
{
if (((CheckBox)sender).Checked)
{
selection.Add(((CheckBox)sender).Name);
}
else
{
selection.Remove(((CheckBox)sender).Name);
}
}
int x = 10;
int y = 10;
private Form SelectDataToGraphForm()
{
Form selectform = new Form()
{
Name = "select",
Width = 50,
Height = 500,
Text = "Graph This"
};
x = 10;
y = 10;
{
CheckBox chk_box = new CheckBox();
chk_box.Text = "Logarithmic";
chk_box.Name = "Logarithmic";
chk_box.Location = new System.Drawing.Point(x, y);
chk_box.Size = new System.Drawing.Size(100, 20);
//chk_box.CheckedChanged += new EventHandler(chk_log_CheckedChanged);
selectform.Controls.Add(chk_box);
}
y += 20;
ThemeManager.ApplyThemeTo(selectform);
return selectform;
}
}
}

View File

@ -117,6 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="BUT_redokml.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="BUT_redokml.Location" type="System.Drawing.Point, System.Drawing">
<value>45, 12</value>
@ -141,7 +145,10 @@
<value>$this</value>
</data>
<data name="&gt;&gt;BUT_redokml.ZOrder" xml:space="preserve">
<value>3</value>
<value>4</value>
</data>
<data name="progressBar1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<data name="progressBar1.Location" type="System.Drawing.Point, System.Drawing">
<value>10, 42</value>
@ -162,9 +169,11 @@
<value>$this</value>
</data>
<data name="&gt;&gt;progressBar1.ZOrder" xml:space="preserve">
<value>2</value>
<value>3</value>
</data>
<data name="BUT_humanreadable.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="BUT_humanreadable.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
@ -190,13 +199,16 @@
<value>$this</value>
</data>
<data name="&gt;&gt;BUT_humanreadable.ZOrder" xml:space="preserve">
<value>1</value>
<value>2</value>
</data>
<data name="BUT_graphmavlog.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top</value>
</data>
<data name="BUT_graphmavlog.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="BUT_graphmavlog.Location" type="System.Drawing.Point, System.Drawing">
<value>289, 13</value>
<value>289, 12</value>
</data>
<data name="BUT_graphmavlog.Size" type="System.Drawing.Size, System.Drawing">
<value>116, 23</value>
@ -217,6 +229,30 @@
<value>$this</value>
</data>
<data name="&gt;&gt;BUT_graphmavlog.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="zg1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Bottom, Left, Right</value>
</data>
<data name="zg1.Location" type="System.Drawing.Point, System.Drawing">
<value>10, 74</value>
</data>
<data name="zg1.Size" type="System.Drawing.Size, System.Drawing">
<value>434, 293</value>
</data>
<data name="zg1.TabIndex" type="System.Int32, mscorlib">
<value>12</value>
</data>
<data name="&gt;&gt;zg1.Name" xml:space="preserve">
<value>zg1</value>
</data>
<data name="&gt;&gt;zg1.Type" xml:space="preserve">
<value>ZedGraph.ZedGraphControl, ZedGraph, Version=5.1.2.878, Culture=neutral, PublicKeyToken=02a83cbd123fcd60</value>
</data>
<data name="&gt;&gt;zg1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;zg1.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@ -226,7 +262,7 @@
<value>6, 13</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>456, 82</value>
<value>456, 379</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
@ -304,6 +340,9 @@
AAf4AAAP/AAAH/4AAD//gAD//+AD//////8=
</value>
</data>
<data name="$this.MinimumSize" type="System.Drawing.Size, System.Drawing">
<value>472, 417</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Log</value>
</data>

View File

@ -31,6 +31,7 @@ namespace ArdupilotMega
Application.Idle += Application_Idle;
CodeGen.runCode("Sin(0.55)");
//MagCalib.doWork();

View File

@ -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.1.48")]
[assembly: AssemblyFileVersion("1.1.49")]
[assembly: NeutralResourcesLanguageAttribute("")]

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.239
// Runtime Version:4.0.30319.261
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.

View File

@ -405,7 +405,7 @@
this.BARthrottle.minline = 0;
this.BARthrottle.Name = "BARthrottle";
this.BARthrottle.Value = 1000;
this.BARthrottle.ValueColor = System.Drawing.Color.FromArgb(((int)(((byte)(148)))), ((int)(((byte)(193)))), ((int)(((byte)(31)))));
this.BARthrottle.ValueColor = System.Drawing.Color.Magenta;
//
// BARyaw
//

File diff suppressed because it is too large Load Diff

View File

@ -61,10 +61,14 @@ namespace ArdupilotMega
private static void ApplyBurntKermitTheme(Control temp, int level)
{
Color BGColor = Color.FromArgb(0x26, 0x27, 0x28); // background
Color ControlBGColor = Color.FromArgb(0x43, 0x44, 0x45); // editable bg color
Color TextColor = Color.White;
if (level == 0)
{
temp.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
temp.ForeColor = Color.White;// Color.FromArgb(0xe6, 0xe8, 0xea);
temp.BackColor = BGColor;
temp.ForeColor = TextColor;// Color.FromArgb(0xe6, 0xe8, 0xea);
}
//temp.Font = new Font("Lucida Console", 8.25f);
@ -75,24 +79,34 @@ namespace ArdupilotMega
{
ctl.ForeColor = Color.Black;
}
else if (ctl.GetType() == typeof(MyButton))
{
Color PrimeColor = Color.FromArgb(0x94, 0xc1, 0x1f);
MyButton but = (MyButton)ctl;
//but.BGGradTop = Color.FromArgb(PrimeColor.R, PrimeColor.G, PrimeColor.B);
//but.BGGradBot = Color.FromArgb(255 - (int)(PrimeColor.R * 0.27), 255 - (int)(PrimeColor.G * 0.14), 255 - (int)(PrimeColor.B * 0.79));
//but.ForeColor = Color.FromArgb(0x40, 0x57, 0x04); //Color.FromArgb(255 - (int)(PrimeColor.R * 0.7), 255 - (int)(PrimeColor.G * 0.8), 255 - (int)(PrimeColor.B * 0.1));
//but.Outline = ControlBGColor;
}
else if (ctl.GetType() == typeof(TextBox))
{
ctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
ctl.ForeColor = Color.White;// Color.FromArgb(0xe6, 0xe8, 0xea);
ctl.BackColor = ControlBGColor;
ctl.ForeColor = TextColor;// Color.FromArgb(0xe6, 0xe8, 0xea);
TextBox txt = (TextBox)ctl;
txt.BorderStyle = BorderStyle.None;
}
else if (ctl.GetType() == typeof(DomainUpDown))
{
ctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
ctl.ForeColor = Color.White;// Color.FromArgb(0xe6, 0xe8, 0xea);
ctl.BackColor = ControlBGColor;
ctl.ForeColor = TextColor;// Color.FromArgb(0xe6, 0xe8, 0xea);
DomainUpDown txt = (DomainUpDown)ctl;
txt.BorderStyle = BorderStyle.None;
}
else if (ctl.GetType() == typeof(GroupBox))
{
ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
ctl.ForeColor = Color.White;// Color.FromArgb(0xe6, 0xe8, 0xea);
ctl.BackColor = BGColor;
ctl.ForeColor = TextColor;// Color.FromArgb(0xe6, 0xe8, 0xea);
}
else if (ctl.GetType() == typeof(ZedGraph.ZedGraphControl))
{
@ -103,7 +117,7 @@ namespace ArdupilotMega
foreach (ZedGraph.LineItem li in zg1.GraphPane.CurveList)
li.Line.Width = 4;
zg1.GraphPane.Title.FontSpec.FontColor = Color.White;
zg1.GraphPane.Title.FontSpec.FontColor = TextColor;
zg1.GraphPane.XAxis.MajorTic.Color = Color.White;
zg1.GraphPane.XAxis.MinorTic.Color = Color.White;
@ -120,95 +134,95 @@ namespace ArdupilotMega
zg1.GraphPane.XAxis.Title.FontSpec.FontColor = Color.White;
zg1.GraphPane.Legend.Fill = new ZedGraph.Fill(Color.FromArgb(0x85, 0x84, 0x83));
zg1.GraphPane.Legend.FontSpec.FontColor = Color.White;
zg1.GraphPane.Legend.FontSpec.FontColor = TextColor;
}
else if (ctl.GetType() == typeof(BSE.Windows.Forms.Panel) || ctl.GetType() == typeof(SplitterPanel))
{
ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
ctl.ForeColor = Color.White;// Color.FromArgb(0xe6, 0xe8, 0xea);
ctl.BackColor = BGColor;
ctl.ForeColor = TextColor;// Color.FromArgb(0xe6, 0xe8, 0xea);
}
else if (ctl.GetType() == typeof(Form))
{
ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
ctl.ForeColor = Color.White;// Color.FromArgb(0xe6, 0xe8, 0xea);
ctl.BackColor = BGColor;
ctl.ForeColor = TextColor;// Color.FromArgb(0xe6, 0xe8, 0xea);
}
else if (ctl.GetType() == typeof(RichTextBox))
{
ctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
ctl.ForeColor = Color.White;
ctl.BackColor = ControlBGColor;
ctl.ForeColor = TextColor;
RichTextBox txtr = (RichTextBox)ctl;
txtr.BorderStyle = BorderStyle.None;
}
else if (ctl.GetType() == typeof(CheckedListBox))
{
ctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
ctl.ForeColor = Color.White;
ctl.BackColor = ControlBGColor;
ctl.ForeColor = TextColor;
CheckedListBox txtr = (CheckedListBox)ctl;
txtr.BorderStyle = BorderStyle.None;
}
else if (ctl.GetType() == typeof(TabPage))
{
ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28); //Color.FromArgb(0x43, 0x44, 0x45);
ctl.ForeColor = Color.White;
ctl.BackColor = BGColor; //ControlBGColor
ctl.ForeColor = TextColor;
TabPage txtr = (TabPage)ctl;
txtr.BorderStyle = BorderStyle.None;
}
else if (ctl.GetType() == typeof(TabControl))
{
ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28); //Color.FromArgb(0x43, 0x44, 0x45);
ctl.ForeColor = Color.White;
ctl.BackColor = BGColor; //ControlBGColor
ctl.ForeColor = TextColor;
TabControl txtr = (TabControl)ctl;
}
else if (ctl.GetType() == typeof(DataGridView))
{
ctl.ForeColor = Color.White;
ctl.ForeColor = TextColor;
DataGridView dgv = (DataGridView)ctl;
dgv.EnableHeadersVisualStyles = false;
dgv.BorderStyle = BorderStyle.None;
dgv.BackgroundColor = Color.FromArgb(0x26, 0x27, 0x28);
dgv.BackgroundColor = BGColor;
DataGridViewCellStyle rs = new DataGridViewCellStyle();
rs.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
rs.ForeColor = Color.White;
rs.BackColor = ControlBGColor;
rs.ForeColor = TextColor;
dgv.RowsDefaultCellStyle = rs;
DataGridViewCellStyle hs = new DataGridViewCellStyle(dgv.ColumnHeadersDefaultCellStyle);
hs.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
hs.ForeColor = Color.White;
hs.BackColor = BGColor;
hs.ForeColor = TextColor;
dgv.ColumnHeadersDefaultCellStyle = hs;
dgv.RowHeadersDefaultCellStyle = hs;
}
else if (ctl.GetType() == typeof(ComboBox))
{
ctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
ctl.ForeColor = Color.White;
ctl.BackColor = ControlBGColor;
ctl.ForeColor = TextColor;
ComboBox CMB = (ComboBox)ctl;
CMB.FlatStyle = FlatStyle.Flat;
}
else if (ctl.GetType() == typeof(NumericUpDown))
{
ctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
ctl.ForeColor = Color.White;
ctl.BackColor = ControlBGColor;
ctl.ForeColor = TextColor;
}
else if (ctl.GetType() == typeof(TrackBar))
{
ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
ctl.ForeColor = Color.White;
ctl.BackColor = BGColor;
ctl.ForeColor = TextColor;
}
else if (ctl.GetType() == typeof(LinkLabel))
{
ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
ctl.ForeColor = Color.White;
ctl.BackColor = BGColor;
ctl.ForeColor = TextColor;
LinkLabel LNK = (LinkLabel)ctl;
LNK.ActiveLinkColor = Color.White;
LNK.LinkColor = Color.White;
LNK.VisitedLinkColor = Color.White;
LNK.ActiveLinkColor = TextColor;
LNK.LinkColor = TextColor;
LNK.VisitedLinkColor = TextColor;
}
else if (ctl.GetType() == typeof(HorizontalProgressBar2) || ctl.GetType() == typeof(VerticalProgressBar2))
{
((HorizontalProgressBar2)ctl).BackgroundColor = Color.FromArgb(0x43, 0x44, 0x45);
((HorizontalProgressBar2)ctl).BackgroundColor = ControlBGColor;
((HorizontalProgressBar2)ctl).ValueColor = Color.FromArgb(148, 193, 31);
}

View File

@ -1,2 +1,3 @@
*.pdb
*.etag
*.etag
*.new

View File

@ -11,7 +11,7 @@ $dir2 = "C:/Users/hog/Desktop/DIYDrones/ardupilot-mega/libraries/GCS_MAVLink/inc
$fname = "MAVLinkTypes.cs";
&doit();
#&doit();
<STDIN>;