mirror of https://github.com/ArduPilot/ardupilot
Merge branch 'master' of https://code.google.com/p/ardupilot-mega into param-suffix
Conflicts: Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj Tools/ArdupilotMegaPlanner/MainV2.cs Tools/ArdupilotMegaPlanner/Utilities/ParameterMetaDataConstants.cs Tools/ArdupilotMegaPlanner/Utilities/ParameterMetaDataParser.cs
This commit is contained in:
commit
6f07bd99c5
|
@ -8,6 +8,7 @@ using System.Text;
|
|||
using System.Windows.Forms;
|
||||
using ArdupilotMega.Controls.BackstageView;
|
||||
using ArdupilotMega.Comms;
|
||||
using ArdupilotMega.Utilities;
|
||||
|
||||
namespace ArdupilotMega.Antenna
|
||||
{
|
||||
|
|
|
@ -56,14 +56,14 @@ When the sticks are fully deflected:
|
|||
<FIELD>
|
||||
<NAME>Dampen</NAME>
|
||||
<PARAMNAME>STAB_D</PARAMNAME>
|
||||
<RANGEMIN>0.001</RANGEMIN>
|
||||
<RANGEMIN>0</RANGEMIN>
|
||||
<RANGEMAX>5</RANGEMAX>
|
||||
<STEP>0.001</STEP>
|
||||
</FIELD>
|
||||
<FIELD>
|
||||
<NAME>Dynamic</NAME>
|
||||
<PARAMNAME>STAB_D_S</PARAMNAME>
|
||||
<RANGEMIN>0.001</RANGEMIN>
|
||||
<RANGEMIN>0</RANGEMIN>
|
||||
<RANGEMAX>1</RANGEMAX>
|
||||
<STEP>0.001</STEP>
|
||||
</FIELD>
|
||||
|
@ -201,5 +201,87 @@ A distance error of 100cm * P of .25 = 25 cm/s
|
|||
<STEP>0.1</STEP>
|
||||
</FIELD>
|
||||
</FIELDS>
|
||||
<SUBHEAD>WP Speed:</SUBHEAD>
|
||||
<DESC>
|
||||
How fast the copter should move towards the target. A larger value means a faster return to center, but can cause the copter to oscillate around the target.
|
||||
|
||||
in m/s
|
||||
</DESC>
|
||||
<FIELDS>
|
||||
<FIELD>
|
||||
<NAME>Speed</NAME>
|
||||
<PARAMNAME>WP_SPEED_MAX</PARAMNAME>
|
||||
<RANGEMIN>1</RANGEMIN>
|
||||
<RANGEMAX>30</RANGEMAX>
|
||||
<STEP>1</STEP>
|
||||
</FIELD>
|
||||
</FIELDS>
|
||||
</Item>
|
||||
<!-- Alt Hold -->
|
||||
<Item>
|
||||
<HEAD>Altitude Hold:</HEAD>
|
||||
<SUBHEAD>Altitude Error:</SUBHEAD>
|
||||
<DESC>
|
||||
How fast the copter should go to reach the correct altitude.
|
||||
</DESC>
|
||||
<FIELDS>
|
||||
<FIELD>
|
||||
<NAME>P</NAME>
|
||||
<PARAMNAME>THR_ALT_P</PARAMNAME>
|
||||
<RANGEMIN>0.001</RANGEMIN>
|
||||
<RANGEMAX>5</RANGEMAX>
|
||||
<STEP>0.001</STEP>
|
||||
</FIELD>
|
||||
<FIELD>
|
||||
<NAME>I</NAME>
|
||||
<PARAMNAME>THR_ALT_I</PARAMNAME>
|
||||
<RANGEMIN>0</RANGEMIN>
|
||||
<RANGEMAX>5</RANGEMAX>
|
||||
<STEP>0.001</STEP>
|
||||
</FIELD>
|
||||
<FIELD>
|
||||
<NAME>IMAX</NAME>
|
||||
<PARAMNAME>THR_ALT_IMAX</PARAMNAME>
|
||||
<RANGEMIN>0</RANGEMIN>
|
||||
<RANGEMAX>50</RANGEMAX>
|
||||
<STEP>0.1</STEP>
|
||||
</FIELD>
|
||||
</FIELDS>
|
||||
<SUBHEAD>Thrust Rate:</SUBHEAD>
|
||||
<DESC>
|
||||
How much thrust to give us the desired rate.
|
||||
|
||||
This will change depending on the weight and thrust of your copter.
|
||||
</DESC>
|
||||
<FIELDS>
|
||||
<FIELD>
|
||||
<NAME>P</NAME>
|
||||
<PARAMNAME>THR_RATE_P</PARAMNAME>
|
||||
<RANGEMIN>0.001</RANGEMIN>
|
||||
<RANGEMAX>5</RANGEMAX>
|
||||
<STEP>0.001</STEP>
|
||||
</FIELD>
|
||||
<FIELD>
|
||||
<NAME>I</NAME>
|
||||
<PARAMNAME>THR_RATE_I</PARAMNAME>
|
||||
<RANGEMIN>0</RANGEMIN>
|
||||
<RANGEMAX>5</RANGEMAX>
|
||||
<STEP>0.001</STEP>
|
||||
</FIELD>
|
||||
<FIELD>
|
||||
<NAME>D</NAME>
|
||||
<PARAMNAME>THR_RATE_D</PARAMNAME>
|
||||
<RANGEMIN>0</RANGEMIN>
|
||||
<RANGEMAX>5</RANGEMAX>
|
||||
<STEP>0.001</STEP>
|
||||
</FIELD>
|
||||
<FIELD>
|
||||
<NAME>IMAX</NAME>
|
||||
<PARAMNAME>THR_RATE_IMAX</PARAMNAME>
|
||||
<RANGEMIN>0</RANGEMIN>
|
||||
<RANGEMAX>50</RANGEMAX>
|
||||
<STEP>0.1</STEP>
|
||||
</FIELD>
|
||||
</FIELDS>
|
||||
</Item>
|
||||
</AC>
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.Threading;
|
|||
using log4net;
|
||||
using System.Globalization;
|
||||
using ArdupilotMega.Comms;
|
||||
using ArdupilotMega.Utilities;
|
||||
|
||||
namespace ArdupilotMega.Arduino
|
||||
{
|
||||
|
|
|
@ -250,7 +250,7 @@
|
|||
<DependentUpon>ConnectionControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\ConfigPanel.cs">
|
||||
<SubType>Form</SubType>
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\ConfigPanel.Designer.cs">
|
||||
<DependentUpon>ConfigPanel.cs</DependentUpon>
|
||||
|
@ -322,12 +322,6 @@
|
|||
<Compile Include="GCSViews\ConfigurationView\ConfigTradHeli.Designer.cs">
|
||||
<DependentUpon>ConfigTradHeli.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GCSViews\ConfigurationView\Configuration.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GCSViews\ConfigurationView\Configuration.Designer.cs">
|
||||
<DependentUpon>Configuration.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GCSViews\ConfigurationView\ConfigRawParams.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
@ -341,7 +335,7 @@
|
|||
<DependentUpon>ConfigAccelerometerCalibrationPlane.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GCSViews\ConfigurationView\Setup.cs">
|
||||
<SubType>Form</SubType>
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GCSViews\ConfigurationView\Setup.Designer.cs">
|
||||
<DependentUpon>Setup.cs</DependentUpon>
|
||||
|
@ -359,14 +353,14 @@
|
|||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Arduino\ArduinoDetect.cs" />
|
||||
<Compile Include="AviWriter.cs" />
|
||||
<Compile Include="Utilities\AviWriter.cs" />
|
||||
<Compile Include="Camera.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Camera.Designer.cs">
|
||||
<DependentUpon>Camera.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Capture.cs" />
|
||||
<Compile Include="Utilities\Capture.cs" />
|
||||
<Compile Include="Comms\CommsSerialInterface.cs" />
|
||||
<Compile Include="Comms\CommsSerialPort.cs">
|
||||
<SubType>Component</SubType>
|
||||
|
@ -409,7 +403,7 @@
|
|||
<Compile Include="HIL\QuadCopter.cs" />
|
||||
<Compile Include="HIL\Quaternion.cs" />
|
||||
<Compile Include="HIL\Vector3d.cs" />
|
||||
<Compile Include="hires.cs" />
|
||||
<Compile Include="Utilities\hires.cs" />
|
||||
<Compile Include="MavlinkLog.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -536,7 +530,7 @@
|
|||
<Compile Include="SerialOutput.Designer.cs">
|
||||
<DependentUpon>SerialOutput.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Speech.cs" />
|
||||
<Compile Include="Utilities\Speech.cs" />
|
||||
<Compile Include="Splash.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -544,7 +538,7 @@
|
|||
<DependentUpon>Splash.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="srtm.cs" />
|
||||
<Compile Include="TCPConsole.cs" />
|
||||
<Compile Include="Utilities\TCPConsole.cs" />
|
||||
<Compile Include="temp.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -552,8 +546,8 @@
|
|||
<DependentUpon>temp.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Radio\Uploader.cs" />
|
||||
<Compile Include="LangUtility.cs" />
|
||||
<Compile Include="ThemeManager.cs" />
|
||||
<Compile Include="Utilities\LangUtility.cs" />
|
||||
<Compile Include="Utilities\ThemeManager.cs" />
|
||||
<Compile Include="Utilities\EnumTranslator.cs" />
|
||||
<Compile Include="Utilities\ParameterMetaDataParser.cs" />
|
||||
<Compile Include="Utilities\ParameterMetaDataRepository.cs" />
|
||||
|
@ -685,7 +679,6 @@
|
|||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="GCSViews\ConfigurationView\ConfigRadioInput.resx">
|
||||
<DependentUpon>ConfigRadioInput.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="GCSViews\ConfigurationView\ConfigRadioInput.zh-Hans.resx">
|
||||
<DependentUpon>ConfigRadioInput.cs</DependentUpon>
|
||||
|
@ -710,7 +703,6 @@
|
|||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="GCSViews\ConfigurationView\ConfigTradHeli.resx">
|
||||
<DependentUpon>ConfigTradHeli.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="GCSViews\ConfigurationView\ConfigTradHeli.zh-Hans.resx">
|
||||
<DependentUpon>ConfigTradHeli.cs</DependentUpon>
|
||||
|
@ -718,9 +710,6 @@
|
|||
<EmbeddedResource Include="GCSViews\ConfigurationView\ConfigTradHeli.zh-TW.resx">
|
||||
<DependentUpon>ConfigTradHeli.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="GCSViews\ConfigurationView\Configuration.resx">
|
||||
<DependentUpon>Configuration.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="GCSViews\ConfigurationView\ConfigAccelerometerCalibrationPlane.es-ES.resx">
|
||||
<DependentUpon>ConfigAccelerometerCalibrationPlane.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
@ -1085,9 +1074,7 @@
|
|||
<None Include="AeroSimRCAPMHil.zip">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="app.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="app.config" />
|
||||
<None Include="arducopter-xplane.zip">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
|
|
@ -125,6 +125,8 @@ namespace ArdupilotMega
|
|||
Matrix temp = g.Transform;
|
||||
g.TranslateTransform(LocalPosition.X, LocalPosition.Y);
|
||||
|
||||
g.RotateTransform(-MainMap.Bearing);
|
||||
|
||||
int length = 500;
|
||||
// anti NaN
|
||||
try
|
||||
|
@ -445,7 +447,7 @@ namespace ArdupilotMega
|
|||
// altitude controller
|
||||
CH6_THR_HOLD_KP = 14,
|
||||
CH6_Z_GAIN = 15,
|
||||
//CH6_DAMP = 16,
|
||||
CH6_DAMP = 16,
|
||||
|
||||
// optical flow controller
|
||||
CH6_OPTFLOW_KP = 17,
|
||||
|
@ -511,7 +513,7 @@ namespace ArdupilotMega
|
|||
{
|
||||
if (Common.getModes() == typeof(Common.apmmodes))
|
||||
{
|
||||
switch ((int)Enum.Parse(Common.getModes(), modein))
|
||||
switch (EnumTranslator.GetValue<Common.apmmodes>(modein))
|
||||
{
|
||||
case (int)Common.apmmodes.MANUAL:
|
||||
case (int)Common.apmmodes.CIRCLE:
|
||||
|
@ -525,13 +527,13 @@ namespace ArdupilotMega
|
|||
mode.custom_mode = (uint)(int)Enum.Parse(Common.getModes(), modein);
|
||||
break;
|
||||
default:
|
||||
MessageBox.Show("No Mode Changed " + (int)Enum.Parse(Common.getModes(), modein));
|
||||
MessageBox.Show("No Mode Changed " + modein);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (Common.getModes() == typeof(Common.ac2modes))
|
||||
{
|
||||
switch ((int)Enum.Parse(Common.getModes(), modein))
|
||||
switch (EnumTranslator.GetValue<Common.ac2modes>(modein))
|
||||
{
|
||||
case (int)Common.ac2modes.STABILIZE:
|
||||
case (int)Common.ac2modes.AUTO:
|
||||
|
@ -545,7 +547,7 @@ namespace ArdupilotMega
|
|||
mode.custom_mode = (uint)(int)Enum.Parse(Common.getModes(), modein);
|
||||
break;
|
||||
default:
|
||||
MessageBox.Show("No Mode Changed " + (int)Enum.Parse(Common.getModes(), modein));
|
||||
MessageBox.Show("No Mode Changed " + modein);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -555,7 +557,7 @@ namespace ArdupilotMega
|
|||
return true;
|
||||
}
|
||||
|
||||
#else
|
||||
#else
|
||||
public static bool translateMode(string modein, ref MAVLink.mavlink_set_nav_mode_t navmode, ref MAVLink.mavlink_set_mode_t mode)
|
||||
{
|
||||
|
||||
|
@ -570,7 +572,7 @@ namespace ArdupilotMega
|
|||
{
|
||||
if (Common.getModes() == typeof(Common.apmmodes))
|
||||
{
|
||||
switch ((int)Enum.Parse(Common.getModes(), modein))
|
||||
switch (EnumTranslator.GetValue<Common.apmmodes>(modein))
|
||||
{
|
||||
case (int)Common.apmmodes.MANUAL:
|
||||
mode.mode = (byte)MAVLink.MAV_MODE.MAV_MODE_MANUAL;
|
||||
|
@ -604,13 +606,13 @@ namespace ArdupilotMega
|
|||
mode.mode = (byte)MAVLink.MAV_MODE.MAV_MODE_TEST2;
|
||||
break;
|
||||
default:
|
||||
CustomMessageBox.Show("No Mode Changed " + (int)Enum.Parse(Common.getModes(), modein));
|
||||
CustomMessageBox.Show("No Mode Changed " + modein);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (Common.getModes() == typeof(Common.ac2modes))
|
||||
{
|
||||
switch ((int)Enum.Parse(Common.getModes(), modein))
|
||||
switch (EnumTranslator.GetValue<Common.ac2modes>(modein))
|
||||
{
|
||||
case (int)Common.ac2modes.GUIDED:
|
||||
mode.mode = (byte)MAVLink.MAV_MODE.MAV_MODE_GUIDED;
|
||||
|
@ -632,7 +634,7 @@ namespace ArdupilotMega
|
|||
mode.mode = (byte)MAVLink.MAV_MODE.MAV_MODE_AUTO;
|
||||
break;
|
||||
default:
|
||||
CustomMessageBox.Show("No Mode Changed " + (int)Enum.Parse(Common.getModes(), modein));
|
||||
CustomMessageBox.Show("No Mode Changed " + modein);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -697,7 +699,7 @@ namespace ArdupilotMega
|
|||
}
|
||||
catch (Exception ex) { log.Info("getFilefromNet(): " + ex.ToString()); return false; }
|
||||
}
|
||||
|
||||
|
||||
public static Type getModes()
|
||||
{
|
||||
if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane)
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace ArdupilotMega.Comms
|
|||
|
||||
frmProgressReporter.UpdateProgressAndStatus(-1, "Connecting Mavlink UDP");
|
||||
|
||||
ArdupilotMega.ThemeManager.ApplyThemeTo(frmProgressReporter);
|
||||
ArdupilotMega.Utilities.ThemeManager.ApplyThemeTo(frmProgressReporter);
|
||||
|
||||
frmProgressReporter.RunBackgroundOperationAsync();
|
||||
|
||||
|
|
|
@ -8,10 +8,12 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
using ArdupilotMega.Controls.BackstageView;
|
||||
using ArdupilotMega.Utilities;
|
||||
|
||||
namespace ArdupilotMega.Controls
|
||||
{
|
||||
public partial class ConfigPanel : Form
|
||||
public partial class ConfigPanel : BackStageViewContentPanel
|
||||
{
|
||||
/// <summary>
|
||||
/// store tempory pending changes
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Windows.Forms;
|
|||
//using ArdupilotMega.Controls;
|
||||
using System.Text;
|
||||
using ArdupilotMega;
|
||||
using ArdupilotMega.Utilities;
|
||||
|
||||
namespace System.Windows.Forms
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace System.Windows.Forms
|
||||
{
|
||||
|
@ -10,6 +11,19 @@ namespace System.Windows.Forms
|
|||
/// </summary>
|
||||
public class MyUserControl : System.Windows.Forms.UserControl
|
||||
{
|
||||
public event FormClosingEventHandler FormClosing;
|
||||
|
||||
public void Close(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (FormClosing != null)
|
||||
FormClosing(sender,e);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
Close(this, new FormClosingEventArgs(CloseReason.UserClosing, false));
|
||||
}
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -14,6 +14,8 @@ using System.Threading;
|
|||
using DirectShowLib;
|
||||
using System.Runtime.InteropServices;
|
||||
using ArdupilotMega.Controls;
|
||||
using ArdupilotMega.Utilities;
|
||||
using System.Linq;
|
||||
|
||||
namespace ArdupilotMega.GCSViews
|
||||
{
|
||||
|
@ -97,8 +99,13 @@ namespace ArdupilotMega.GCSViews
|
|||
readToolTips();
|
||||
|
||||
// ensure the fields are populated before setting them
|
||||
CH7_OPT.DataSource = Enum.GetNames(typeof(Common.ac2ch7modes));
|
||||
TUNE.DataSource = Enum.GetNames(typeof(Common.ac2ch6modes));
|
||||
CH7_OPT.DataSource = EnumTranslator.Translate<Common.ac2ch7modes>().ToList();
|
||||
CH7_OPT.DisplayMember = "Value";
|
||||
CH7_OPT.ValueMember = "Key";
|
||||
|
||||
TUNE.DataSource = EnumTranslator.Translate<Common.ac2ch6modes>().ToList();
|
||||
TUNE.DisplayMember = "Value";
|
||||
TUNE.ValueMember = "Key";
|
||||
|
||||
// prefill all fields
|
||||
param = MainV2.comPort.param;
|
||||
|
@ -726,11 +733,17 @@ namespace ArdupilotMega.GCSViews
|
|||
if (ConfigTabs.SelectedTab == TabSetup)
|
||||
{
|
||||
|
||||
GCSViews.ConfigurationView.Setup temp = new GCSViews.ConfigurationView.Setup();
|
||||
|
||||
ThemeManager.ApplyThemeTo(temp);
|
||||
|
||||
temp.ShowDialog();
|
||||
Form temp = new Form();
|
||||
MyUserControl configview = new GCSViews.ConfigurationView.Setup();
|
||||
temp.Controls.Add(configview);
|
||||
ThemeManager.ApplyThemeTo(temp);
|
||||
// fix title
|
||||
temp.Text = configview.Name;
|
||||
// fix size
|
||||
temp.Size = configview.Size;
|
||||
configview.Dock = DockStyle.Fill;
|
||||
temp.FormClosing += configview.Close;
|
||||
temp.ShowDialog();
|
||||
|
||||
startup = true;
|
||||
processToScreen();
|
||||
|
@ -999,7 +1012,6 @@ namespace ArdupilotMega.GCSViews
|
|||
}
|
||||
|
||||
|
||||
|
||||
private void CMB_rateattitude_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
MainV2.config[((ComboBox)sender).Name] = ((ComboBox)sender).Text;
|
||||
|
@ -1010,18 +1022,21 @@ namespace ArdupilotMega.GCSViews
|
|||
{
|
||||
MainV2.config[((ComboBox)sender).Name] = ((ComboBox)sender).Text;
|
||||
MainV2.cs.rateposition = byte.Parse(((ComboBox)sender).Text);
|
||||
|
||||
}
|
||||
|
||||
private void CMB_ratestatus_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
MainV2.config[((ComboBox)sender).Name] = ((ComboBox)sender).Text;
|
||||
MainV2.cs.ratestatus = byte.Parse(((ComboBox)sender).Text);
|
||||
|
||||
}
|
||||
|
||||
private void CMB_raterc_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
MainV2.config[((ComboBox)sender).Name] = ((ComboBox)sender).Text;
|
||||
MainV2.cs.raterc = byte.Parse(((ComboBox)sender).Text);
|
||||
|
||||
}
|
||||
|
||||
private void CHK_mavdebug_CheckedChanged(object sender, EventArgs e)
|
||||
|
|
|
@ -126,6 +126,7 @@
|
|||
this.RATE_RLL_P = new System.Windows.Forms.NumericUpDown();
|
||||
this.label91 = new System.Windows.Forms.Label();
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.BUT_writePIDS = new ArdupilotMega.Controls.MyButton();
|
||||
((System.ComponentModel.ISupportInitialize)(this.TUNE_LOW)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.TUNE_HIGH)).BeginInit();
|
||||
this.groupBox5.SuspendLayout();
|
||||
|
@ -785,10 +786,18 @@
|
|||
resources.ApplyResources(this.label91, "label91");
|
||||
this.label91.Name = "label91";
|
||||
//
|
||||
// BUT_writePIDS
|
||||
//
|
||||
resources.ApplyResources(this.BUT_writePIDS, "BUT_writePIDS");
|
||||
this.BUT_writePIDS.Name = "BUT_writePIDS";
|
||||
this.BUT_writePIDS.UseVisualStyleBackColor = true;
|
||||
this.BUT_writePIDS.Click += new System.EventHandler(this.BUT_writePIDS_Click);
|
||||
//
|
||||
// ConfigArducopter
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.BUT_writePIDS);
|
||||
this.Controls.Add(this.myLabel3);
|
||||
this.Controls.Add(this.TUNE_LOW);
|
||||
this.Controls.Add(this.TUNE_HIGH);
|
||||
|
@ -964,5 +973,6 @@
|
|||
private System.Windows.Forms.NumericUpDown RATE_RLL_P;
|
||||
private System.Windows.Forms.Label label91;
|
||||
private System.Windows.Forms.ToolTip toolTip1;
|
||||
private Controls.MyButton BUT_writePIDS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,8 +63,13 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
|
|||
readToolTips();
|
||||
|
||||
// ensure the fields are populated before setting them
|
||||
CH7_OPT.DataSource = Enum.GetNames(typeof(Common.ac2ch7modes));
|
||||
TUNE.DataSource = Enum.GetNames(typeof(Common.ac2ch6modes));
|
||||
CH7_OPT.DataSource = Utilities.EnumTranslator.Translate<Common.ac2ch7modes>().ToList();
|
||||
CH7_OPT.DisplayMember = "Value";
|
||||
CH7_OPT.ValueMember = "Key";
|
||||
|
||||
TUNE.DataSource = Utilities.EnumTranslator.Translate<Common.ac2ch6modes>().ToList();
|
||||
TUNE.DisplayMember = "Value";
|
||||
TUNE.ValueMember = "Key";
|
||||
|
||||
// prefill all fields
|
||||
processToScreen();
|
||||
|
@ -225,7 +230,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
|
|||
|
||||
ComboBox thisctl = ((ComboBox)ctl);
|
||||
|
||||
thisctl.SelectedIndex = (int)(float)MainV2.comPort.param[value];
|
||||
thisctl.SelectedValue = (int)(float)MainV2.comPort.param[value];
|
||||
|
||||
thisctl.Validated += new EventHandler(ComboBox_Validated);
|
||||
|
||||
|
@ -271,7 +276,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
|
|||
}
|
||||
else if (sender.GetType() == typeof(ComboBox))
|
||||
{
|
||||
value = ((ComboBox)sender).SelectedIndex;
|
||||
value = (int)((ComboBox)sender).SelectedValue;
|
||||
changes[name] = value;
|
||||
}
|
||||
((Control)sender).BackColor = Color.Green;
|
||||
|
@ -344,6 +349,38 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
|
|||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void BUT_writePIDS_Click(object sender, EventArgs e)
|
||||
{
|
||||
var temp = (Hashtable)changes.Clone();
|
||||
|
||||
foreach (string value in temp.Keys)
|
||||
{
|
||||
try
|
||||
{
|
||||
MainV2.comPort.setParam(value, (float)changes[value]);
|
||||
|
||||
try
|
||||
{
|
||||
// set control as well
|
||||
var textControls = this.Controls.Find(value, true);
|
||||
if (textControls.Length > 0)
|
||||
{
|
||||
textControls[0].BackColor = Color.FromArgb(0x43, 0x44, 0x45);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
CustomMessageBox.Show("Set " + value + " Failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -135,13 +135,13 @@
|
|||
<value>myLabel3</value>
|
||||
</data>
|
||||
<data name=">>myLabel3.Type" xml:space="preserve">
|
||||
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.24834, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>myLabel3.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>myLabel3.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="TUNE_LOW.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>575, 305</value>
|
||||
|
@ -162,7 +162,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>TUNE_LOW.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="TUNE_HIGH.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>665, 305</value>
|
||||
|
@ -183,7 +183,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>TUNE_HIGH.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="myLabel2.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>540, 277</value>
|
||||
|
@ -201,13 +201,13 @@
|
|||
<value>myLabel2</value>
|
||||
</data>
|
||||
<data name=">>myLabel2.Type" xml:space="preserve">
|
||||
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.24834, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>myLabel2.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>myLabel2.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="TUNE.Items" xml:space="preserve">
|
||||
<value>CH6_NONE</value>
|
||||
|
@ -294,7 +294,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>TUNE.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="myLabel1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>540, 329</value>
|
||||
|
@ -312,13 +312,13 @@
|
|||
<value>myLabel1</value>
|
||||
</data>
|
||||
<data name=">>myLabel1.Type" xml:space="preserve">
|
||||
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.24834, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>myLabel1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>myLabel1.ZOrder" xml:space="preserve">
|
||||
<value>5</value>
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name="CH7_OPT.Items" xml:space="preserve">
|
||||
<value>Do Nothing</value>
|
||||
|
@ -363,7 +363,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CH7_OPT.ZOrder" xml:space="preserve">
|
||||
<value>6</value>
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="THR_RATE_D.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>80, 60</value>
|
||||
|
@ -580,7 +580,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>groupBox5.ZOrder" xml:space="preserve">
|
||||
<value>7</value>
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="CHK_lockrollpitch.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
|
@ -610,7 +610,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CHK_lockrollpitch.ZOrder" xml:space="preserve">
|
||||
<value>8</value>
|
||||
<value>9</value>
|
||||
</data>
|
||||
<data name="NAV_LAT_D.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>80, 60</value>
|
||||
|
@ -874,7 +874,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>groupBox4.ZOrder" xml:space="preserve">
|
||||
<value>9</value>
|
||||
<value>10</value>
|
||||
</data>
|
||||
<data name="XTRK_GAIN_SC1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>80, 13</value>
|
||||
|
@ -946,7 +946,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>groupBox6.ZOrder" xml:space="preserve">
|
||||
<value>10</value>
|
||||
<value>11</value>
|
||||
</data>
|
||||
<data name="THR_ALT_IMAX.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>80, 63</value>
|
||||
|
@ -1114,7 +1114,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>groupBox7.ZOrder" xml:space="preserve">
|
||||
<value>11</value>
|
||||
<value>12</value>
|
||||
</data>
|
||||
<data name="HLD_LAT_IMAX.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>80, 61</value>
|
||||
|
@ -1282,7 +1282,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>groupBox19.ZOrder" xml:space="preserve">
|
||||
<value>12</value>
|
||||
<value>13</value>
|
||||
</data>
|
||||
<data name="STB_YAW_IMAX.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>80, 63</value>
|
||||
|
@ -1450,7 +1450,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>groupBox20.ZOrder" xml:space="preserve">
|
||||
<value>13</value>
|
||||
<value>14</value>
|
||||
</data>
|
||||
<data name="STAB_D.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>80, 88</value>
|
||||
|
@ -1666,7 +1666,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>groupBox21.ZOrder" xml:space="preserve">
|
||||
<value>14</value>
|
||||
<value>15</value>
|
||||
</data>
|
||||
<data name="STB_RLL_IMAX.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>80, 63</value>
|
||||
|
@ -1834,7 +1834,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>groupBox22.ZOrder" xml:space="preserve">
|
||||
<value>15</value>
|
||||
<value>16</value>
|
||||
</data>
|
||||
<data name="RATE_YAW_D.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>80, 60</value>
|
||||
|
@ -2050,7 +2050,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>groupBox23.ZOrder" xml:space="preserve">
|
||||
<value>16</value>
|
||||
<value>17</value>
|
||||
</data>
|
||||
<data name="RATE_PIT_D.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>80, 60</value>
|
||||
|
@ -2266,7 +2266,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>groupBox24.ZOrder" xml:space="preserve">
|
||||
<value>17</value>
|
||||
<value>18</value>
|
||||
</data>
|
||||
<data name="RATE_RLL_D.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>80, 60</value>
|
||||
|
@ -2482,11 +2482,41 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>groupBox25.ZOrder" xml:space="preserve">
|
||||
<value>18</value>
|
||||
<value>19</value>
|
||||
</data>
|
||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<data name="BUT_writePIDS.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="BUT_writePIDS.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="BUT_writePIDS.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>305, 383</value>
|
||||
</data>
|
||||
<data name="BUT_writePIDS.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>103, 19</value>
|
||||
</data>
|
||||
<data name="BUT_writePIDS.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>70</value>
|
||||
</data>
|
||||
<data name="BUT_writePIDS.Text" xml:space="preserve">
|
||||
<value>Write Params</value>
|
||||
</data>
|
||||
<data name=">>BUT_writePIDS.Name" xml:space="preserve">
|
||||
<value>BUT_writePIDS</value>
|
||||
</data>
|
||||
<data name=">>BUT_writePIDS.Type" xml:space="preserve">
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.24834, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>BUT_writePIDS.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>BUT_writePIDS.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">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
@ -2509,6 +2539,6 @@
|
|||
<value>ConfigArducopter</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>ArdupilotMega.Controls.BackstageView.BackStageViewContentPanel, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.BackstageView.BackStageViewContentPanel, ArdupilotMegaPlanner, Version=1.1.4498.24834, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
</root>
|
|
@ -131,6 +131,7 @@
|
|||
this.RLL2SRV_P = new System.Windows.Forms.NumericUpDown();
|
||||
this.label52 = new System.Windows.Forms.Label();
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.BUT_writePIDS = new ArdupilotMega.Controls.MyButton();
|
||||
this.groupBox3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.THR_FS_VALUE)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.THR_MAX)).BeginInit();
|
||||
|
@ -789,10 +790,18 @@
|
|||
resources.ApplyResources(this.label52, "label52");
|
||||
this.label52.Name = "label52";
|
||||
//
|
||||
// BUT_writePIDS
|
||||
//
|
||||
resources.ApplyResources(this.BUT_writePIDS, "BUT_writePIDS");
|
||||
this.BUT_writePIDS.Name = "BUT_writePIDS";
|
||||
this.BUT_writePIDS.UseVisualStyleBackColor = true;
|
||||
this.BUT_writePIDS.Click += new System.EventHandler(this.BUT_writePIDS_Click);
|
||||
//
|
||||
// ConfigArduplane
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.BUT_writePIDS);
|
||||
this.Controls.Add(this.groupBox3);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
|
@ -970,5 +979,6 @@
|
|||
private System.Windows.Forms.NumericUpDown RLL2SRV_P;
|
||||
private System.Windows.Forms.Label label52;
|
||||
private System.Windows.Forms.ToolTip toolTip1;
|
||||
private Controls.MyButton BUT_writePIDS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -268,5 +268,37 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
|
|||
}
|
||||
}
|
||||
|
||||
private void BUT_writePIDS_Click(object sender, EventArgs e)
|
||||
{
|
||||
var temp = (Hashtable)changes.Clone();
|
||||
|
||||
foreach (string value in temp.Keys)
|
||||
{
|
||||
try
|
||||
{
|
||||
MainV2.comPort.setParam(value, (float)changes[value]);
|
||||
|
||||
try
|
||||
{
|
||||
// set control as well
|
||||
var textControls = this.Controls.Find(value, true);
|
||||
if (textControls.Length > 0)
|
||||
{
|
||||
textControls[0].BackColor = Color.FromArgb(0x43, 0x44, 0x45);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
CustomMessageBox.Show("Set " + value + " Failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,12 +25,12 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
|
|||
|
||||
private void BUT_MagCalibration_Click(object sender, EventArgs e)
|
||||
{
|
||||
// list of x,y,z 's
|
||||
List<Tuple<float, float, float>> data = new List<Tuple<float, float, float>>();
|
||||
|
||||
// backup current rate and set to 10 hz
|
||||
byte backupratesens = MainV2.cs.ratesensors;
|
||||
|
||||
MainV2.cs.ratesensors = 10;
|
||||
|
||||
MainV2.comPort.requestDatastream((byte)MAVLink.MAV_DATA_STREAM.RAW_SENSORS, MainV2.cs.ratesensors); // mag captures at 10 hz
|
||||
|
||||
CustomMessageBox.Show("Data will be collected for 30 seconds, Please click ok and move the apm around all axises");
|
||||
|
@ -43,6 +43,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
|
|||
|
||||
while (deadline > DateTime.Now)
|
||||
{
|
||||
// dont let the gui hang
|
||||
Application.DoEvents();
|
||||
|
||||
if (oldmx != MainV2.cs.mx &&
|
||||
|
@ -60,7 +61,9 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
|
|||
}
|
||||
}
|
||||
|
||||
// restore old sensor rate
|
||||
MainV2.cs.ratesensors = backupratesens;
|
||||
MainV2.comPort.requestDatastream((byte)MAVLink.MAV_DATA_STREAM.RAW_SENSORS, MainV2.cs.ratesensors);
|
||||
|
||||
if (data.Count < 10)
|
||||
{
|
||||
|
|
|
@ -74,6 +74,8 @@
|
|||
this.BUT_Joystick = new ArdupilotMega.Controls.MyButton();
|
||||
this.BUT_videostop = new ArdupilotMega.Controls.MyButton();
|
||||
this.BUT_videostart = new ArdupilotMega.Controls.MyButton();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.CHK_maprotation = new System.Windows.Forms.CheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUM_tracklength)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
|
@ -94,6 +96,7 @@
|
|||
resources.GetString("CMB_ratesensors.Items4")});
|
||||
resources.ApplyResources(this.CMB_ratesensors, "CMB_ratesensors");
|
||||
this.CMB_ratesensors.Name = "CMB_ratesensors";
|
||||
this.CMB_ratesensors.SelectedIndexChanged += new System.EventHandler(this.CMB_ratesensors_SelectedIndexChanged);
|
||||
//
|
||||
// label26
|
||||
//
|
||||
|
@ -348,6 +351,7 @@
|
|||
this.CMB_osdcolor.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.CMB_osdcolor, "CMB_osdcolor");
|
||||
this.CMB_osdcolor.Name = "CMB_osdcolor";
|
||||
this.CMB_osdcolor.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.CMB_osdcolor_DrawItem);
|
||||
this.CMB_osdcolor.SelectedIndexChanged += new System.EventHandler(this.CMB_osdcolor_SelectedIndexChanged);
|
||||
//
|
||||
// CMB_language
|
||||
|
@ -377,7 +381,7 @@
|
|||
resources.ApplyResources(this.CHK_hudshow, "CHK_hudshow");
|
||||
this.CHK_hudshow.Name = "CHK_hudshow";
|
||||
this.CHK_hudshow.UseVisualStyleBackColor = true;
|
||||
this.CHK_hudshow.Click += new System.EventHandler(this.CHK_hudshow_CheckedChanged);
|
||||
this.CHK_hudshow.CheckedChanged += new System.EventHandler(this.CHK_hudshow_CheckedChanged);
|
||||
//
|
||||
// label92
|
||||
//
|
||||
|
@ -391,6 +395,7 @@
|
|||
resources.ApplyResources(this.CMB_videosources, "CMB_videosources");
|
||||
this.CMB_videosources.Name = "CMB_videosources";
|
||||
this.CMB_videosources.SelectedIndexChanged += new System.EventHandler(this.CMB_videosources_SelectedIndexChanged);
|
||||
this.CMB_videosources.Click += new System.EventHandler(this.CMB_videosources_Click);
|
||||
//
|
||||
// BUT_Joystick
|
||||
//
|
||||
|
@ -413,10 +418,24 @@
|
|||
this.BUT_videostart.UseVisualStyleBackColor = true;
|
||||
this.BUT_videostart.Click += new System.EventHandler(this.BUT_videostart_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
resources.ApplyResources(this.label1, "label1");
|
||||
this.label1.Name = "label1";
|
||||
//
|
||||
// CHK_maprotation
|
||||
//
|
||||
resources.ApplyResources(this.CHK_maprotation, "CHK_maprotation");
|
||||
this.CHK_maprotation.Name = "CHK_maprotation";
|
||||
this.CHK_maprotation.UseVisualStyleBackColor = true;
|
||||
this.CHK_maprotation.CheckedChanged += new System.EventHandler(this.CHK_maprotation_CheckedChanged);
|
||||
//
|
||||
// ConfigPlanner
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.CHK_maprotation);
|
||||
this.Controls.Add(this.label33);
|
||||
this.Controls.Add(this.CMB_ratesensors);
|
||||
this.Controls.Add(this.label26);
|
||||
|
@ -463,6 +482,7 @@
|
|||
this.Controls.Add(this.BUT_videostop);
|
||||
this.Controls.Add(this.BUT_videostart);
|
||||
this.Name = "ConfigPlanner";
|
||||
this.Load += new System.EventHandler(this.ConfigPlanner_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUM_tracklength)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
|
@ -515,5 +535,7 @@
|
|||
private ArdupilotMega.Controls.MyButton BUT_Joystick;
|
||||
private ArdupilotMega.Controls.MyButton BUT_videostop;
|
||||
private ArdupilotMega.Controls.MyButton BUT_videostart;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.CheckBox CHK_maprotation;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,13 +11,15 @@ using System.Windows.Forms;
|
|||
using DirectShowLib;
|
||||
using ArdupilotMega.Controls.BackstageView;
|
||||
using ArdupilotMega.Controls;
|
||||
using ArdupilotMega.Utilities;
|
||||
using System.Threading;
|
||||
|
||||
namespace ArdupilotMega.GCSViews.ConfigurationView
|
||||
{
|
||||
public partial class ConfigPlanner : BackStageViewContentPanel
|
||||
{
|
||||
// AR todo: replicate this functionality
|
||||
private bool startup = false;
|
||||
List<CultureInfo> languages = new List<CultureInfo>();
|
||||
|
||||
public ConfigPlanner()
|
||||
{
|
||||
|
@ -291,32 +293,54 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
|
|||
|
||||
private void CMB_rateattitude_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (startup)
|
||||
return;
|
||||
MainV2.config[((ComboBox)sender).Name] = ((ComboBox)sender).Text;
|
||||
MainV2.cs.rateattitude = byte.Parse(((ComboBox)sender).Text);
|
||||
|
||||
MainV2.comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.EXTRA1, MainV2.cs.rateattitude); // request attitude
|
||||
MainV2.comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.EXTRA2, MainV2.cs.rateattitude); // request vfr
|
||||
}
|
||||
|
||||
private void CMB_rateposition_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (startup)
|
||||
return;
|
||||
MainV2.config[((ComboBox)sender).Name] = ((ComboBox)sender).Text;
|
||||
MainV2.cs.rateposition = byte.Parse(((ComboBox)sender).Text);
|
||||
|
||||
MainV2.comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.POSITION, MainV2.cs.rateposition); // request gps
|
||||
}
|
||||
|
||||
private void CMB_ratestatus_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (startup)
|
||||
return;
|
||||
MainV2.config[((ComboBox)sender).Name] = ((ComboBox)sender).Text;
|
||||
MainV2.cs.ratestatus = byte.Parse(((ComboBox)sender).Text);
|
||||
|
||||
MainV2.comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.EXTENDED_STATUS, MainV2.cs.ratestatus); // mode
|
||||
}
|
||||
|
||||
private void CMB_raterc_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (startup)
|
||||
return;
|
||||
MainV2.config[((ComboBox)sender).Name] = ((ComboBox)sender).Text;
|
||||
MainV2.cs.raterc = byte.Parse(((ComboBox)sender).Text);
|
||||
|
||||
MainV2.comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RC_CHANNELS, MainV2.cs.raterc); // request rc info
|
||||
}
|
||||
|
||||
private void CMB_ratesensors_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (startup)
|
||||
return;
|
||||
MainV2.config[((ComboBox)sender).Name] = ((ComboBox)sender).Text;
|
||||
MainV2.cs.ratesensors = byte.Parse(((ComboBox)sender).Text);
|
||||
|
||||
MainV2.comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.EXTRA3, MainV2.cs.ratesensors); // request extra stuff - tridge
|
||||
MainV2.comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RAW_SENSORS, MainV2.cs.ratesensors); // request raw sensor
|
||||
}
|
||||
|
||||
private void CHK_mavdebug_CheckedChanged(object sender, EventArgs e)
|
||||
|
@ -371,5 +395,154 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
|
|||
MainV2.config["CHK_GDIPlus"] = CHK_GDIPlus.Checked.ToString();
|
||||
}
|
||||
|
||||
private void ConfigPlanner_Load(object sender, EventArgs e)
|
||||
{
|
||||
startup = true;
|
||||
|
||||
// setup up camera button states
|
||||
if (MainV2.cam != null)
|
||||
{
|
||||
BUT_videostart.Enabled = false;
|
||||
CHK_hudshow.Checked = GCSViews.FlightData.myhud.hudon;
|
||||
}
|
||||
else
|
||||
{
|
||||
BUT_videostart.Enabled = true;
|
||||
}
|
||||
|
||||
// setup speech states
|
||||
if (MainV2.config["speechenable"] != null)
|
||||
CHK_enablespeech.Checked = bool.Parse(MainV2.config["speechenable"].ToString());
|
||||
if (MainV2.config["speechwaypointenabled"] != null)
|
||||
CHK_speechwaypoint.Checked = bool.Parse(MainV2.config["speechwaypointenabled"].ToString());
|
||||
if (MainV2.config["speechmodeenabled"] != null)
|
||||
CHK_speechmode.Checked = bool.Parse(MainV2.config["speechmodeenabled"].ToString());
|
||||
if (MainV2.config["speechcustomenabled"] != null)
|
||||
CHK_speechcustom.Checked = bool.Parse(MainV2.config["speechcustomenabled"].ToString());
|
||||
if (MainV2.config["speechbatteryenabled"] != null)
|
||||
CHK_speechbattery.Checked = bool.Parse(MainV2.config["speechbatteryenabled"].ToString());
|
||||
if (MainV2.config["speechaltenabled"] != null)
|
||||
CHK_speechaltwarning.Checked = bool.Parse(MainV2.config["speechaltenabled"].ToString());
|
||||
|
||||
// this can't fail because it set at startup
|
||||
NUM_tracklength.Value = int.Parse(MainV2.config["NUM_tracklength"].ToString());
|
||||
|
||||
// get wps on connect
|
||||
if (MainV2.config["loadwpsonconnect"] != null)
|
||||
CHK_loadwponconnect.Checked = bool.Parse(MainV2.config["loadwpsonconnect"].ToString());
|
||||
|
||||
// setup other config state
|
||||
if (MainV2.config["CHK_resetapmonconnect"] != null)
|
||||
CHK_resetapmonconnect.Checked = bool.Parse(MainV2.config["CHK_resetapmonconnect"].ToString());
|
||||
|
||||
CMB_rateattitude.Text = MainV2.cs.rateattitude.ToString();
|
||||
CMB_rateposition.Text = MainV2.cs.rateposition.ToString();
|
||||
CMB_raterc.Text = MainV2.cs.raterc.ToString();
|
||||
CMB_ratestatus.Text = MainV2.cs.ratestatus.ToString();
|
||||
CMB_ratesensors.Text = MainV2.cs.ratesensors.ToString();
|
||||
|
||||
|
||||
if (MainV2.config["CHK_GDIPlus"] != null)
|
||||
CHK_GDIPlus.Checked = bool.Parse(MainV2.config["CHK_GDIPlus"].ToString());
|
||||
|
||||
if (MainV2.config["CHK_maprotation"] != null)
|
||||
CHK_maprotation.Checked = bool.Parse(MainV2.config["CHK_maprotation"].ToString());
|
||||
|
||||
//set hud color state
|
||||
string hudcolor = (string)MainV2.config["hudcolor"];
|
||||
|
||||
CMB_osdcolor.DataSource = Enum.GetNames(typeof(KnownColor));
|
||||
if (hudcolor != null)
|
||||
{
|
||||
int index = CMB_osdcolor.Items.IndexOf(hudcolor);
|
||||
CMB_osdcolor.SelectedIndex = index;
|
||||
}
|
||||
else
|
||||
{
|
||||
int index = CMB_osdcolor.Items.IndexOf("White");
|
||||
CMB_osdcolor.SelectedIndex = index;
|
||||
}
|
||||
|
||||
// set distance/speed unit states
|
||||
CMB_distunits.DataSource = Enum.GetNames(typeof(Common.distances));
|
||||
CMB_speedunits.DataSource = Enum.GetNames(typeof(Common.speeds));
|
||||
|
||||
if (MainV2.config["distunits"] != null)
|
||||
CMB_distunits.Text = MainV2.config["distunits"].ToString();
|
||||
if (MainV2.config["speedunits"] != null)
|
||||
CMB_speedunits.Text = MainV2.config["speedunits"].ToString();
|
||||
|
||||
// setup language selection
|
||||
CultureInfo ci = null;
|
||||
foreach (string name in new string[] { "en-US", "zh-Hans", "zh-TW", "ru-RU", "Fr", "Pl", "it-IT", "es-ES" })
|
||||
{
|
||||
ci = CultureInfoEx.GetCultureInfo(name);
|
||||
if (ci != null)
|
||||
languages.Add(ci);
|
||||
}
|
||||
|
||||
CMB_language.DisplayMember = "DisplayName";
|
||||
CMB_language.DataSource = languages;
|
||||
ci = Thread.CurrentThread.CurrentUICulture;
|
||||
for (int i = 0; i < languages.Count; i++)
|
||||
{
|
||||
if (ci.IsChildOf(languages[i]))
|
||||
{
|
||||
CMB_language.SelectedIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
CMB_language.SelectedIndexChanged += CMB_language_SelectedIndexChanged;
|
||||
|
||||
startup = false;
|
||||
}
|
||||
|
||||
private void CMB_osdcolor_DrawItem(object sender, DrawItemEventArgs e)
|
||||
{
|
||||
if (e.Index < 0)
|
||||
return;
|
||||
|
||||
Graphics g = e.Graphics;
|
||||
Rectangle rect = e.Bounds;
|
||||
Brush brush = null;
|
||||
|
||||
if ((e.State & DrawItemState.Selected) == 0)
|
||||
brush = new SolidBrush(CMB_osdcolor.BackColor);
|
||||
else
|
||||
brush = SystemBrushes.Highlight;
|
||||
|
||||
g.FillRectangle(brush, rect);
|
||||
|
||||
brush = new SolidBrush(Color.FromName((string)CMB_osdcolor.Items[e.Index]));
|
||||
|
||||
g.FillRectangle(brush, rect.X + 2, rect.Y + 2, 30, rect.Height - 4);
|
||||
g.DrawRectangle(Pens.Black, rect.X + 2, rect.Y + 2, 30, rect.Height - 4);
|
||||
|
||||
if ((e.State & DrawItemState.Selected) == 0)
|
||||
brush = new SolidBrush(CMB_osdcolor.ForeColor);
|
||||
else
|
||||
brush = SystemBrushes.HighlightText;
|
||||
g.DrawString(CMB_osdcolor.Items[e.Index].ToString(),
|
||||
CMB_osdcolor.Font, brush, rect.X + 35, rect.Top + rect.Height - CMB_osdcolor.Font.Height);
|
||||
}
|
||||
|
||||
private void CMB_videosources_Click(object sender, EventArgs e)
|
||||
{
|
||||
// the reason why i dont populate this list is because on linux/mac this call will fail.
|
||||
WebCamService.Capture capt = new WebCamService.Capture();
|
||||
|
||||
List<string> devices = WebCamService.Capture.getDevices();
|
||||
|
||||
CMB_videosources.DataSource = devices;
|
||||
|
||||
capt.Dispose();
|
||||
}
|
||||
|
||||
private void CHK_maprotation_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (startup)
|
||||
return;
|
||||
MainV2.config["CHK_maprotation"] = CHK_maprotation.Checked.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label33.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="CMB_ratesensors.Items" xml:space="preserve">
|
||||
<value>0</value>
|
||||
|
@ -181,7 +181,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CMB_ratesensors.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="label26.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -208,7 +208,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label26.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="CMB_videoresolutions.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>124, 49</value>
|
||||
|
@ -229,7 +229,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CMB_videoresolutions.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="label12.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -256,7 +256,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label12.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name="CHK_GDIPlus.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -283,7 +283,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CHK_GDIPlus.ZOrder" xml:space="preserve">
|
||||
<value>5</value>
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="label24.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -310,7 +310,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label24.ZOrder" xml:space="preserve">
|
||||
<value>6</value>
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="CHK_loadwponconnect.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -337,7 +337,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CHK_loadwponconnect.ZOrder" xml:space="preserve">
|
||||
<value>7</value>
|
||||
<value>9</value>
|
||||
</data>
|
||||
<data name="label23.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -364,7 +364,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label23.ZOrder" xml:space="preserve">
|
||||
<value>8</value>
|
||||
<value>10</value>
|
||||
</data>
|
||||
<data name="NUM_tracklength.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>124, 293</value>
|
||||
|
@ -385,7 +385,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>NUM_tracklength.ZOrder" xml:space="preserve">
|
||||
<value>9</value>
|
||||
<value>11</value>
|
||||
</data>
|
||||
<data name="CHK_speechaltwarning.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -412,7 +412,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CHK_speechaltwarning.ZOrder" xml:space="preserve">
|
||||
<value>10</value>
|
||||
<value>12</value>
|
||||
</data>
|
||||
<data name="label108.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -439,7 +439,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label108.ZOrder" xml:space="preserve">
|
||||
<value>11</value>
|
||||
<value>13</value>
|
||||
</data>
|
||||
<data name="CHK_resetapmonconnect.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -466,7 +466,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CHK_resetapmonconnect.ZOrder" xml:space="preserve">
|
||||
<value>12</value>
|
||||
<value>14</value>
|
||||
</data>
|
||||
<data name="CHK_mavdebug.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom, Left</value>
|
||||
|
@ -475,7 +475,7 @@
|
|||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="CHK_mavdebug.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>15, 378</value>
|
||||
<value>15, 398</value>
|
||||
</data>
|
||||
<data name="CHK_mavdebug.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>144, 17</value>
|
||||
|
@ -496,7 +496,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CHK_mavdebug.ZOrder" xml:space="preserve">
|
||||
<value>13</value>
|
||||
<value>15</value>
|
||||
</data>
|
||||
<data name="label107.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -523,7 +523,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label107.ZOrder" xml:space="preserve">
|
||||
<value>14</value>
|
||||
<value>16</value>
|
||||
</data>
|
||||
<data name="CMB_raterc.Items" xml:space="preserve">
|
||||
<value>0</value>
|
||||
|
@ -556,7 +556,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CMB_raterc.ZOrder" xml:space="preserve">
|
||||
<value>15</value>
|
||||
<value>17</value>
|
||||
</data>
|
||||
<data name="label104.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -583,7 +583,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label104.ZOrder" xml:space="preserve">
|
||||
<value>16</value>
|
||||
<value>18</value>
|
||||
</data>
|
||||
<data name="label103.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -610,7 +610,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label103.ZOrder" xml:space="preserve">
|
||||
<value>17</value>
|
||||
<value>19</value>
|
||||
</data>
|
||||
<data name="label102.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -637,7 +637,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label102.ZOrder" xml:space="preserve">
|
||||
<value>18</value>
|
||||
<value>20</value>
|
||||
</data>
|
||||
<data name="label101.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -664,7 +664,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label101.ZOrder" xml:space="preserve">
|
||||
<value>19</value>
|
||||
<value>21</value>
|
||||
</data>
|
||||
<data name="CMB_ratestatus.Items" xml:space="preserve">
|
||||
<value>0</value>
|
||||
|
@ -697,7 +697,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CMB_ratestatus.ZOrder" xml:space="preserve">
|
||||
<value>20</value>
|
||||
<value>22</value>
|
||||
</data>
|
||||
<data name="CMB_rateposition.Items" xml:space="preserve">
|
||||
<value>0</value>
|
||||
|
@ -730,7 +730,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CMB_rateposition.ZOrder" xml:space="preserve">
|
||||
<value>21</value>
|
||||
<value>23</value>
|
||||
</data>
|
||||
<data name="CMB_rateattitude.Items" xml:space="preserve">
|
||||
<value>0</value>
|
||||
|
@ -763,7 +763,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CMB_rateattitude.ZOrder" xml:space="preserve">
|
||||
<value>22</value>
|
||||
<value>24</value>
|
||||
</data>
|
||||
<data name="label99.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -791,7 +791,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label99.ZOrder" xml:space="preserve">
|
||||
<value>23</value>
|
||||
<value>25</value>
|
||||
</data>
|
||||
<data name="label98.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -818,7 +818,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label98.ZOrder" xml:space="preserve">
|
||||
<value>24</value>
|
||||
<value>26</value>
|
||||
</data>
|
||||
<data name="label97.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -845,7 +845,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label97.ZOrder" xml:space="preserve">
|
||||
<value>25</value>
|
||||
<value>27</value>
|
||||
</data>
|
||||
<data name="CMB_speedunits.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>124, 216</value>
|
||||
|
@ -866,7 +866,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CMB_speedunits.ZOrder" xml:space="preserve">
|
||||
<value>26</value>
|
||||
<value>28</value>
|
||||
</data>
|
||||
<data name="CMB_distunits.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>124, 189</value>
|
||||
|
@ -887,7 +887,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CMB_distunits.ZOrder" xml:space="preserve">
|
||||
<value>27</value>
|
||||
<value>29</value>
|
||||
</data>
|
||||
<data name="label96.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -914,7 +914,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label96.ZOrder" xml:space="preserve">
|
||||
<value>28</value>
|
||||
<value>30</value>
|
||||
</data>
|
||||
<data name="label95.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -941,7 +941,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label95.ZOrder" xml:space="preserve">
|
||||
<value>29</value>
|
||||
<value>31</value>
|
||||
</data>
|
||||
<data name="CHK_speechbattery.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -968,7 +968,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CHK_speechbattery.ZOrder" xml:space="preserve">
|
||||
<value>30</value>
|
||||
<value>32</value>
|
||||
</data>
|
||||
<data name="CHK_speechcustom.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -995,7 +995,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CHK_speechcustom.ZOrder" xml:space="preserve">
|
||||
<value>31</value>
|
||||
<value>33</value>
|
||||
</data>
|
||||
<data name="CHK_speechmode.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -1022,7 +1022,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CHK_speechmode.ZOrder" xml:space="preserve">
|
||||
<value>32</value>
|
||||
<value>34</value>
|
||||
</data>
|
||||
<data name="CHK_speechwaypoint.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -1049,7 +1049,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CHK_speechwaypoint.ZOrder" xml:space="preserve">
|
||||
<value>33</value>
|
||||
<value>35</value>
|
||||
</data>
|
||||
<data name="label94.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -1076,7 +1076,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label94.ZOrder" xml:space="preserve">
|
||||
<value>34</value>
|
||||
<value>36</value>
|
||||
</data>
|
||||
<data name="CMB_osdcolor.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>124, 82</value>
|
||||
|
@ -1097,7 +1097,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CMB_osdcolor.ZOrder" xml:space="preserve">
|
||||
<value>35</value>
|
||||
<value>37</value>
|
||||
</data>
|
||||
<data name="CMB_language.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>124, 133</value>
|
||||
|
@ -1118,7 +1118,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CMB_language.ZOrder" xml:space="preserve">
|
||||
<value>36</value>
|
||||
<value>38</value>
|
||||
</data>
|
||||
<data name="label93.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -1145,7 +1145,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label93.ZOrder" xml:space="preserve">
|
||||
<value>37</value>
|
||||
<value>39</value>
|
||||
</data>
|
||||
<data name="CHK_enablespeech.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -1172,7 +1172,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CHK_enablespeech.ZOrder" xml:space="preserve">
|
||||
<value>38</value>
|
||||
<value>40</value>
|
||||
</data>
|
||||
<data name="CHK_hudshow.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -1199,7 +1199,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CHK_hudshow.ZOrder" xml:space="preserve">
|
||||
<value>39</value>
|
||||
<value>41</value>
|
||||
</data>
|
||||
<data name="label92.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -1226,7 +1226,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label92.ZOrder" xml:space="preserve">
|
||||
<value>40</value>
|
||||
<value>42</value>
|
||||
</data>
|
||||
<data name="CMB_videosources.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>124, 15</value>
|
||||
|
@ -1247,7 +1247,7 @@
|
|||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CMB_videosources.ZOrder" xml:space="preserve">
|
||||
<value>41</value>
|
||||
<value>43</value>
|
||||
</data>
|
||||
<data name="BUT_Joystick.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -1268,13 +1268,13 @@
|
|||
<value>BUT_Joystick</value>
|
||||
</data>
|
||||
<data name=">>BUT_Joystick.Type" xml:space="preserve">
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.31567, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>BUT_Joystick.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>BUT_Joystick.ZOrder" xml:space="preserve">
|
||||
<value>42</value>
|
||||
<value>44</value>
|
||||
</data>
|
||||
<data name="BUT_videostop.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -1295,13 +1295,13 @@
|
|||
<value>BUT_videostop</value>
|
||||
</data>
|
||||
<data name=">>BUT_videostop.Type" xml:space="preserve">
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.31567, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>BUT_videostop.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>BUT_videostop.ZOrder" xml:space="preserve">
|
||||
<value>43</value>
|
||||
<value>45</value>
|
||||
</data>
|
||||
<data name="BUT_videostart.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
|
@ -1322,13 +1322,67 @@
|
|||
<value>BUT_videostart</value>
|
||||
</data>
|
||||
<data name=">>BUT_videostart.Type" xml:space="preserve">
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.31567, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>BUT_videostart.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>BUT_videostart.ZOrder" xml:space="preserve">
|
||||
<value>44</value>
|
||||
<value>46</value>
|
||||
</data>
|
||||
<data name="label1.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>15, 365</value>
|
||||
</data>
|
||||
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>81, 17</value>
|
||||
</data>
|
||||
<data name="label1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>89</value>
|
||||
</data>
|
||||
<data name="label1.Text" xml:space="preserve">
|
||||
<value>Map Follow</value>
|
||||
</data>
|
||||
<data name=">>label1.Name" xml:space="preserve">
|
||||
<value>label1</value>
|
||||
</data>
|
||||
<data name=">>label1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>label1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label1.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="CHK_maprotation.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="CHK_maprotation.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>124, 365</value>
|
||||
</data>
|
||||
<data name="CHK_maprotation.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>205, 17</value>
|
||||
</data>
|
||||
<data name="CHK_maprotation.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>90</value>
|
||||
</data>
|
||||
<data name="CHK_maprotation.Text" xml:space="preserve">
|
||||
<value>Map is rotated to follow the plane</value>
|
||||
</data>
|
||||
<data name=">>CHK_maprotation.Name" xml:space="preserve">
|
||||
<value>CHK_maprotation</value>
|
||||
</data>
|
||||
<data name=">>CHK_maprotation.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>CHK_maprotation.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>CHK_maprotation.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
|
@ -1337,12 +1391,12 @@
|
|||
<value>6, 13</value>
|
||||
</data>
|
||||
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>682, 398</value>
|
||||
<value>682, 418</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>ConfigPlanner</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>ArdupilotMega.Controls.BackstageView.BackStageViewContentPanel, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.BackstageView.BackStageViewContentPanel, ArdupilotMegaPlanner, Version=1.1.4498.31567, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
</root>
|
|
@ -16,7 +16,6 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
|
|||
{
|
||||
private static readonly ILog log =
|
||||
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private readonly ParameterMetaDataRepository _parameterMetaDataRepository;
|
||||
|
||||
// Changes made to the params between writing to the copter
|
||||
|
@ -41,8 +40,6 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
|
|||
public ConfigRawParams()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Init the accessor class for the parameter meta data
|
||||
_parameterMetaDataRepository = new ParameterMetaDataRepository();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
namespace ArdupilotMega.GCSViews.ConfigurationView
|
||||
{
|
||||
partial class Configuration
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Configuration));
|
||||
this.backstageView = new ArdupilotMega.Controls.BackstageView.BackstageView();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// backstageView
|
||||
//
|
||||
this.backstageView.AutoSize = true;
|
||||
this.backstageView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.backstageView.Location = new System.Drawing.Point(0, 0);
|
||||
this.backstageView.Name = "backstageView";
|
||||
this.backstageView.Size = new System.Drawing.Size(634, 336);
|
||||
this.backstageView.TabIndex = 0;
|
||||
//
|
||||
// Configuration
|
||||
//
|
||||
this.ClientSize = new System.Drawing.Size(634, 336);
|
||||
this.Controls.Add(this.backstageView);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "Configuration";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Configuration_FormClosing);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Controls.BackstageView.BackstageView backstageView;
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
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;
|
||||
using ArdupilotMega.Controls.BackstageView;
|
||||
|
||||
namespace ArdupilotMega.GCSViews.ConfigurationView
|
||||
{
|
||||
public partial class Configuration : Form
|
||||
{
|
||||
public Configuration()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigRadioInput(), "Radio Calibration"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigFlightModes(), "Flight Modes"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigHardwareOptions(), "Hardware Options"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigBatteryMonitoring(), "Battery Monitor"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigAccelerometerCalibrationQuad(), "ArduCopter"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigAccelerometerCalibrationPlane(), "ArduPlane"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigArducopter(), "Arducopter Setup"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigArduplane(), "Arduplane Setup"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigTradHeli(), "Heli Setup"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigRawParams(), "Raw params (Advanced)"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigPlanner(), "Planner"));
|
||||
}
|
||||
|
||||
private void Configuration_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
backstageView.Close();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,197 +0,0 @@
|
|||
<?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>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABILAAASCwAAAAAAAAAA
|
||||
AAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADOxkjAtnoOAKpJ4vyiK
|
||||
c+8nh3D/J4Zv/yeHcP8oi3PvKpJ4vy6fg4AzsZIwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADjGo2AyspPfLZ+D/yiQ
|
||||
d/8hlXj/G6F9/xeqg/8XqYL/GKqD/xuhfv8ilnn/KZB3/y2fhP8yspPfN8ajYAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADvRrDA1vpzfL6uN/yel
|
||||
hP8XvJD/DMyY/wfQl/8FzJP/A8qS/wPJkf8EypL/BsyU/wnRmP8PzZn/Gb2R/yemhP8tqoz/Mb2a3zbQ
|
||||
qkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAA4y6ZgMbWV/yin
|
||||
iP8WwZP/Btqf/wDPlf8AyI7/A8aP/yfNnv9T2LP/UNax/03XsP8506b/G8ya/wHKkf8F0Zf/CNuf/xLB
|
||||
kv8fpYT/J7KQ/y7IomAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAAAAAANcajny+w
|
||||
kf8hqoj/CNSd/wDRlf8Axor/Hcyd/3Lhwf+p7Nj/o+vV/57m0/+X5dD/k+TN/4/jzf+K5Mz/fuHH/0PW
|
||||
rf8HzJT/ANCT/wDRlv8OpX//HayI/yrFn58AAAAAAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAADDC
|
||||
nmAtro7/H62J/wPWmv8Ay47/AMaO/3XhxP+e6tT/mObP/5Pjy/+Q4sr/jODJ/4ffx/+C3MT/f9vC/3nb
|
||||
wf9y2r7/adq7/2DauP8ZzZv/Fdae/8T/9/9WxKj/HKuI/y7IomAAAAAAAAAAAAAAAAD///8AAAAAAAAA
|
||||
AAAiuZMwKKyM/x6ohf8C1Zr/AMmL/wHGjv+49OL///////////9+3ML/f9zD/4Dcwv9+28L/e9rA/3bZ
|
||||
vv9w1rr/Z9S4/17Rs/9Qz63/Qcyn/3LewP////////////n///8MpH7/JbKP/zXQqUAAAAAAAAAAAP//
|
||||
/wAAAAAAAAAAABymhN8dnn//BNGa/wDKjP8AxY3/sfHf/////////////////2nXt/9w1rv/c9e8/3TX
|
||||
vP9x17z/a9W5/2TTtf9Y0K//SMyp/zXFoP9i07X/////////////////f/LR/wDQlf8epYT/Mb2a3wAA
|
||||
AAAAAAAA////AAAAAAADlnJgFZR1/wq4iv8AzpH/AMCD/4rmzf//////////////////////WdGv/2PU
|
||||
tf9p1rf/atS4/2nUtv9i0rT/Vc+u/0fKpv8zxZz/Ws+w//////////////////////8GyJL/ANCS/xLB
|
||||
kv8tq4z/OMajYAAAAAD///8AAAAAAACHZt8NkW//ANKV/wDChP9i27r//////////////////////9Dx
|
||||
6P9MzKn/Vc+v/17Rsv9g0rP/XNCx/1XNrv9Fyaf/McSd/1fPr///////////////////////QM2m/ynK
|
||||
oP8JzJX/C9yh/ymmhf80spPfAAAAAP///wAAcUwwAHtc/wCrfP8AyIv/AMKK////////////////////
|
||||
/////////////5Dgyv9Gyqb/TMyq/07Nq/9MzKn/Qcmj/y/Fnf9Wzq3//////////////////////57k
|
||||
0v8av5T/Lceg/yzOo/8M05v/Hr6T/zCghf80spIw////AABoRYAAclT/AL2H/wDBhf9R1rL/////////
|
||||
////////4vfw//////////////////H8+P9KzKn/Ocah/zTFnv8qwpj/Us2t////////////////////
|
||||
////////DLqM/yDBlv8wxp//OM6m/xPPm/8Xz53/LZF5/y+fg4////8AAGNAvwB7Wf8Aw4j/ALyC/4bj
|
||||
yP+g5tL/g93E/2HSsv9Pzqz/Us6s//////////////////////9Yzq//Gr2S/0jLp///////////////
|
||||
/////////////yrDm/8SvI//JMGY/zDHn/81zKT/Is2e/xTUnf8nl3v/LJJ5v////wAAXz3vAIlg/wDA
|
||||
hf8AuoD/quzZ/5Hjyv9628D/ada2/1jRsP9Jy6f/a9a4//////////////////////+Y4s7/////////
|
||||
//////////////////+c4tD/AbaH/xW8kf8jwZj/LcWd/y/Jn/8kzJ3/E9Ca/yGjgf8ri3Tv////AABd
|
||||
PP8Ak2b/AL6D/w/Ekv+m6tf/j+HJ/3vawP9p1rf/W9Gx/0rNqf85yJ//Nsaf////////////////////
|
||||
/////////////////////////////wCwe/8AtoT/ELqP/xu+k/8jwZj/KMeb/yHKm/8QzZf/HqyG/ymI
|
||||
cf////8AAF07/wCSZP8AvYL/GMWU/6Dn1P+K38f/ddi+/27Wuf+E3MX/leHN/6fm1f+l5tX/neLQ////
|
||||
////////////////////////////////////////j9/J/27Vuv9Tzq7/JsKY/xa/kv8aw5T/FcaW/wvL
|
||||
lf8aqoT/J4dw/////wAAXTv/AJFk/wC9gP8GwY3/mObQ/5rkz/+26dv/y/Hl/8Dt3/+06tz/pebV/5bg
|
||||
zP+g5NL//////////////v///f7+//7+/v//////7fn2////////////tOnb/6Ll0v+v6Nj/jeDI/zXK
|
||||
o/8IxJD/BMqS/xaqgv8lh2//////AABeO+8AgVf/AL1//wDBif/R9uv/1PPq/8Tv5P+36t3/rujY/6Lk
|
||||
0v+U4cv/jt7J//j8+///////+/38//f8+//2+/r/+Pz7//3+/v/m9/P/9Pv6//D6+P9/28L/jd7J/5jj
|
||||
z/+h5dL/qOvX/4Hmyf8f1J//E596/yOJcO////8AAGA8vwB3U/8p06P/hufM/8Ty5f/D7+T/s+vb/6bm
|
||||
1P+c4c//j9/K/4vcyP/t+fb///7///j8/P/0+/r/8vr5//P7+f/1+/r/+/39///////i9fL/ZNO1/3HW
|
||||
vP992sH/htzG/4vhyv+S5dD/mO7W/6X74v80noT/Io90v////wAAZkCAAHla/33ny/945cb/nunV/7Xr
|
||||
3v+l5tT/luDN/4ndxv992cL/1vLq//v9/P/1+/n/8vv4//L69//z+/j/9Pv5/7Xo2//x+vn/////////
|
||||
//+y59n/aNS3/3LWvP932r//fNzD/4Ljyf+J7ND/l/bd/yORdf8knH6A////AABuRzAAdlT/Xc6x/23o
|
||||
xv9s4MH/qurZ/5jiz/+I3cb/edjA/8ju5f/3/Pv/8vv4//H6+P/y+/j/6/f0/7np3v/7/fz//v7+/6fk
|
||||
1f+56tz///////////9h0bT/aNW4/23Wu/9v3L//dOLG/37w0f9m1rn/Hpt8/ymujTD///8AAAAAAACD
|
||||
X98po4X/Z+7K/1vgvP+A4sf/jOHK/3rZwv+r59f/9Pv6/+/69//v+vf/8vr4/9fy6/9n0rf/VM6t/6Di
|
||||
0v/N7+f/adO4/1PMrf9t1Lr/i9zI/1/Rs/9h0rX/ZNe4/2bbvf9s5sb/ePfV/z2ylf8lrozfAAAAAP//
|
||||
/wAAAAAAAJNsYAWQbf9U1rP/Vee//0rYsf993sb/pebV//P7+v/s+Pb/6/f1/+749v+s5tj/Vc2u/1jP
|
||||
r/9ZzrD/btW5/1bOr/9Wza//Vs6v/1fOr/9Z0LD/WdCy/1vTtP9d1rX/Xt+8/2btyP9k4L//IaaF/y7D
|
||||
nmAAAAAA////AAAAAAAAAAAAD6J9zyCjgv9S68L/P9+0/2Pevv/5////7/v6/+v59//j9/L/gtvF/1PN
|
||||
r/9Wz7D/Wc+x/1nQsf9Zz7H/WM6w/1fPsP9UzrD/VM+w/1TPrv9U0a//U9Oy/1Tatv9Z5sD/Y/LL/zSx
|
||||
lP8qupbPAAAAAAAAAAD///8AAAAAAAAAAAAYto4wGaeE/y23lP8+5rn/6/////j////w//3/ve/i/2bV
|
||||
uP9Tzq7/Vc+v/1jPsP9Z0LL/WM+w/1fOsf9Wz7D/Us2w/1HOrf9Qzq3/T9Cu/0zSr/9M2LP/TeC5/1bt
|
||||
xP9HxaX/KLKQ/zTPqDAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAkvpdgG6iF/y++m//e/////P///3rl
|
||||
yf9G0K3/VdKy/1bPsf9Wz7H/Vs6w/1bPsP9Sza//Ucyu/0/Nrf9NzKz/S82s/0fOrP9G0a7/QdWv/0Le
|
||||
tP9I6L7/Q8Ok/yitjP8yyKJgAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAmwJlgG6iF/yK3
|
||||
kP8k3q7/H9el/x7Pn/8tzKT/Q9Cs/1HQsP9Q0K7/TM6u/0nMrf9Hzaz/RMyp/0LNqf8+zqn/ONGo/zTV
|
||||
qf833rD/O+S4/zvCof8orIv/MMSfYAAAAAAAAAAAAAAAAAAAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAkvpdgG6iE/xukgv8gy53/HNql/xzRn/8czJz/HcmZ/yXJnP8qyp7/Lcqg/yzLn/8nypz/JMqc/yTO
|
||||
n/8l1KT/KN2r/y3Tpv8nq4n/JaqJ/yzAm2AAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAato8wFKN/zxCScv8RnHn/DbqM/wjIlP8GyZT/BsaS/wbFkf8GxZH/B8WR/wfH
|
||||
k/8IypX/DMmV/xG3jP8WoX3/Fph2/xqkgs8ft5EwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJVvYACGZM8Aelr/AHlZ/wCFX/8AiWL/AJlr/wCb
|
||||
bP8AlGf/AI5k/wB/W/8AeFj/AHtb/wCHZd8ClXBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwSzAAaESAAGI/vwBf
|
||||
Pd8AXTz/AF08/wBdPP8AXz3fAGJAvwBoRIAAcUswAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP//
|
||||
/wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP//
|
||||
/wD///8A////AP///wD///8A/+AD//+AAP/+AAA//AAAH/gAAA/wAAAH4AAAA+AAAAPAAAABwAAAAYAA
|
||||
AACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAwAAAAcAAAAHgAAAD4AAAA/AA
|
||||
AAf4AAAP/AAAH/4AAD//gAD//+AD//////8=
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
|
@ -45,7 +45,7 @@
|
|||
//
|
||||
this.ClientSize = new System.Drawing.Size(931, 468);
|
||||
this.Controls.Add(this.backstageView);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
//this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MinimumSize = new System.Drawing.Size(947, 506);
|
||||
this.Name = "Setup";
|
||||
this.Text = "Setup";
|
||||
|
|
|
@ -10,26 +10,62 @@ using ArdupilotMega.Controls.BackstageView;
|
|||
|
||||
namespace ArdupilotMega.GCSViews.ConfigurationView
|
||||
{
|
||||
public partial class Setup : Form
|
||||
public partial class Setup : MyUserControl
|
||||
{
|
||||
public Setup()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigRadioInput(), "Radio Calibration"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigFlightModes(), "Flight Modes"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigHardwareOptions(), "Hardware Options"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigBatteryMonitoring(), "Battery Monitor"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigAccelerometerCalibrationQuad(), "ArduCopter Level"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigAccelerometerCalibrationPlane(), "ArduPlane Level"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigTradHeli(), "Heli Setup"));
|
||||
if (MainV2.comPort.BaseStream.IsOpen)
|
||||
{
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigRadioInput(), "Radio Calibration"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigFlightModes(), "Flight Modes"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigHardwareOptions(), "Hardware Options"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigBatteryMonitoring(), "Battery Monitor"));
|
||||
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigRawParams(), "Raw params (Advanced)"));
|
||||
|
||||
/******************************HELI **************************/
|
||||
if (MainV2.comPort.param["H_GYR_ENABLE"] != null) // heli
|
||||
{
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigAccelerometerCalibrationQuad(), "ArduCopter Level"));
|
||||
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigTradHeli(), "Heli Setup"));
|
||||
|
||||
var configpanel = new Controls.ConfigPanel();
|
||||
configpanel.LoadXML("ArduCopterConfig.xml");
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(configpanel, "ArduCopter Config"));
|
||||
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigArducopter(), "OLD ArduCopter Config"));
|
||||
}
|
||||
/****************************** ArduCopter **************************/
|
||||
else if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2)
|
||||
{
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigAccelerometerCalibrationQuad(), "ArduCopter Level"));
|
||||
|
||||
var configpanel = new Controls.ConfigPanel();
|
||||
configpanel.LoadXML("ArduCopterConfig.xml");
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(configpanel, "ArduCopter Config"));
|
||||
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigArducopter(), "OLD ArduCopter Config"));
|
||||
}
|
||||
/****************************** ArduPlane **************************/
|
||||
else if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane)
|
||||
{
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigAccelerometerCalibrationPlane(), "ArduPlane Level"));
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigArduplane(), "ArduPlane Config"));
|
||||
}
|
||||
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigRawParams(), "Raw params (Adv)"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ArdupilotMega._3DRradio(), "3DR Radio"));
|
||||
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ArdupilotMega.Antenna.Tracker(), "Antenna Tracker"));
|
||||
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigPlanner(), "Planner"));
|
||||
|
||||
this.backstageView.ActivatePage(backstageView.Pages[0]);
|
||||
|
||||
if (!MainV2.comPort.BaseStream.IsOpen)
|
||||
|
|
|
@ -8,6 +8,7 @@ using System.Xml;
|
|||
using System.Net;
|
||||
using log4net;
|
||||
using ArdupilotMega.Arduino;
|
||||
using ArdupilotMega.Utilities;
|
||||
|
||||
namespace ArdupilotMega.GCSViews
|
||||
{
|
||||
|
@ -649,8 +650,16 @@ namespace ArdupilotMega.GCSViews
|
|||
|
||||
private void BUT_setup_Click(object sender, EventArgs e)
|
||||
{
|
||||
Form temp = new GCSViews.ConfigurationView.Setup();
|
||||
Form temp = new Form();
|
||||
MyUserControl configview = new GCSViews.ConfigurationView.Setup();
|
||||
temp.Controls.Add(configview);
|
||||
ThemeManager.ApplyThemeTo(temp);
|
||||
// fix title
|
||||
temp.Text = configview.Name;
|
||||
// fix size
|
||||
temp.Size = configview.Size;
|
||||
configview.Dock = DockStyle.Fill;
|
||||
temp.FormClosing += configview.Close;
|
||||
temp.ShowDialog();
|
||||
}
|
||||
|
||||
|
|
|
@ -152,7 +152,9 @@ namespace ArdupilotMega.GCSViews
|
|||
|
||||
CMB_action.DataSource = list;
|
||||
|
||||
CMB_modes.DataSource = Enum.GetNames(typeof(Common.apmmodes));
|
||||
CMB_modes.DataSource = Common.getModesList();
|
||||
CMB_modes.ValueMember = "Key";
|
||||
CMB_modes.DisplayMember = "Value";
|
||||
|
||||
CMB_setwp.SelectedIndex = 0;
|
||||
|
||||
|
@ -288,7 +290,7 @@ namespace ArdupilotMega.GCSViews
|
|||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RC_CHANNELS, MainV2.cs.raterc); // request rc info
|
||||
}
|
||||
catch { }
|
||||
lastdata = DateTime.Now.AddSeconds(12); // prevent flooding
|
||||
lastdata = DateTime.Now.AddSeconds(120); // prevent flooding
|
||||
}
|
||||
|
||||
if (!MainV2.comPort.logreadmode)
|
||||
|
@ -408,6 +410,11 @@ namespace ArdupilotMega.GCSViews
|
|||
|
||||
if (tracklast.AddSeconds(1) < DateTime.Now)
|
||||
{
|
||||
if (MainV2.config["CHK_maprotation"] != null && MainV2.config["CHK_maprotation"].ToString() == "True")
|
||||
{
|
||||
setMapBearing();
|
||||
}
|
||||
|
||||
gMapControl1.HoldInvalidation = true;
|
||||
|
||||
while (gMapControl1.inOnPaint == true)
|
||||
|
@ -423,7 +430,6 @@ namespace ArdupilotMega.GCSViews
|
|||
trackPoints.Add(new PointLatLng(MainV2.cs.lat, MainV2.cs.lng));
|
||||
|
||||
|
||||
|
||||
// if (CB_tuning.Checked == false) // draw if in view
|
||||
{
|
||||
|
||||
|
@ -514,6 +520,14 @@ namespace ArdupilotMega.GCSViews
|
|||
Console.WriteLine("FD Main loop exit");
|
||||
}
|
||||
|
||||
private void setMapBearing()
|
||||
{
|
||||
this.Invoke((System.Windows.Forms.MethodInvoker)delegate()
|
||||
{
|
||||
gMapControl1.Bearing = (int)MainV2.cs.yaw;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// to prevent cross thread calls while in a draw and exception
|
||||
private void updateClearRoutes()
|
||||
|
|
|
@ -208,7 +208,7 @@
|
|||
<value>hud1</value>
|
||||
</data>
|
||||
<data name=">>hud1.Type" xml:space="preserve">
|
||||
<value>hud.HUD, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.HUD, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.myGMAP, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4498.22301, 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.4497.35992, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner, Version=1.1.4498.22301, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
</root>
|
|
@ -22,7 +22,7 @@ using log4net;
|
|||
using SharpKml.Base;
|
||||
using SharpKml.Dom;
|
||||
using ArdupilotMega.Controls;
|
||||
|
||||
using ArdupilotMega.Utilities;
|
||||
|
||||
|
||||
namespace ArdupilotMega.GCSViews
|
||||
|
|
|
@ -9,7 +9,7 @@ using System.Windows.Forms;
|
|||
using ArdupilotMega;
|
||||
using System.IO.Ports;
|
||||
using ArdupilotMega.Comms;
|
||||
|
||||
using ArdupilotMega.Utilities;
|
||||
|
||||
namespace ArdupilotMega.GCSViews
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ using ArdupilotMega.Controls;
|
|||
using System.ComponentModel;
|
||||
using log4net;
|
||||
using ArdupilotMega.Comms;
|
||||
using ArdupilotMega.Utilities;
|
||||
|
||||
namespace ArdupilotMega
|
||||
{
|
||||
|
@ -678,7 +679,7 @@ namespace ArdupilotMega
|
|||
continue;
|
||||
}
|
||||
|
||||
log.Info(DateTime.Now.Millisecond + " got param " + (par.param_index) + " of " + (par.param_count - 2) + " name: " + paramID);
|
||||
log.Info(DateTime.Now.Millisecond + " got param " + (par.param_index) + " of " + (par.param_count - 2) + " name: " + paramID );
|
||||
|
||||
modifyParamForDisplay(true, paramID, ref par.param_value);
|
||||
param[paramID] = (par.param_value);
|
||||
|
@ -1027,7 +1028,7 @@ namespace ArdupilotMega
|
|||
|
||||
public void requestDatastream(byte id, byte hzrate)
|
||||
{
|
||||
/*
|
||||
|
||||
double pps = 0;
|
||||
|
||||
switch (id)
|
||||
|
@ -1118,7 +1119,7 @@ namespace ArdupilotMega
|
|||
{
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
log.InfoFormat("Request stream {0} at {1} hz", Enum.Parse(typeof(MAV_DATA_STREAM), id.ToString()), hzrate);
|
||||
getDatastream(id, hzrate);
|
||||
|
@ -1148,7 +1149,7 @@ namespace ArdupilotMega
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
|
@ -12,15 +10,13 @@ using System.Xml;
|
|||
using System.Collections;
|
||||
using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Speech.Synthesis;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using System.Net.Sockets;
|
||||
using System.Net.Sockets;
|
||||
using ArdupilotMega.Utilities;
|
||||
using ArdupilotMega.Utilities.Constants;
|
||||
using IronPython.Hosting;
|
||||
using log4net;
|
||||
using ArdupilotMega.Controls;
|
||||
|
@ -129,8 +125,8 @@ namespace ArdupilotMega
|
|||
/// </summary>
|
||||
GCSViews.FlightData FlightData;
|
||||
GCSViews.FlightPlanner FlightPlanner;
|
||||
GCSViews.Configuration Configuration;
|
||||
//GCSViews.ConfigurationView.Configuration Configuration;
|
||||
//GCSViews.Configuration Configuration;
|
||||
GCSViews.ConfigurationView.Setup Configuration;
|
||||
GCSViews.Simulation Simulation;
|
||||
GCSViews.Firmware Firmware;
|
||||
GCSViews.Terminal Terminal;
|
||||
|
@ -428,23 +424,19 @@ namespace ArdupilotMega
|
|||
catch { }
|
||||
}
|
||||
|
||||
Configuration = new GCSViews.Configuration();
|
||||
//Configuration = new GCSViews.ConfigurationView.Configuration();
|
||||
//Configuration = new GCSViews.Configuration();
|
||||
Configuration = new GCSViews.ConfigurationView.Setup();
|
||||
|
||||
UserControl temp = Configuration;
|
||||
|
||||
ThemeManager.ApplyThemeTo(temp);
|
||||
|
||||
//temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
|
||||
|
||||
temp.Location = new Point(0, 0);
|
||||
|
||||
temp.Dock = DockStyle.Fill;
|
||||
|
||||
temp.Size = MyView.Size;
|
||||
|
||||
//temp.Parent = MyView;
|
||||
|
||||
MyView.Controls.Add(temp);
|
||||
}
|
||||
|
||||
|
@ -1738,11 +1730,18 @@ namespace ArdupilotMega
|
|||
|
||||
static void DoUpdateWorker_DoWork(object sender, Controls.ProgressWorkerEventArgs e)
|
||||
{
|
||||
((ProgressReporterDialogue)sender).UpdateProgressAndStatus(-1, "Getting Base URL");
|
||||
MainV2.updateCheckMain((ProgressReporterDialogue)sender);
|
||||
// TODO: Is this the right place?
|
||||
#region Fetch Parameter Meta Data
|
||||
|
||||
var progressReporterDialogue = ((ProgressReporterDialogue) sender);
|
||||
progressReporterDialogue.UpdateProgressAndStatus(-1, "Getting Updated Parameters");
|
||||
|
||||
// TODO: Is this the right place?
|
||||
ParameterMetaDataParser.GetParameterInformation();
|
||||
ParameterMetaDataParser.GetParameterInformation();
|
||||
|
||||
#endregion Fetch Parameter Meta Data
|
||||
|
||||
progressReporterDialogue.UpdateProgressAndStatus(-1, "Getting Base URL");
|
||||
MainV2.updateCheckMain(progressReporterDialogue);
|
||||
}
|
||||
|
||||
private static bool updateCheck(ProgressReporterDialogue frmProgressReporter, string baseurl, string subdir)
|
||||
|
@ -2043,7 +2042,7 @@ namespace ArdupilotMega
|
|||
|
||||
cfg.LoadXML("ArduCopterConfig.xml");
|
||||
|
||||
cfg.ShowDialog();
|
||||
//cfg.ShowDialog();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ using System.Xml;
|
|||
using log4net;
|
||||
using ZedGraph; // Graphs
|
||||
|
||||
using ArdupilotMega.Utilities;
|
||||
|
||||
using System.CodeDom.Compiler;
|
||||
|
||||
namespace ArdupilotMega
|
||||
|
|
Binary file not shown.
|
@ -60,7 +60,7 @@ namespace ArdupilotMega
|
|||
|
||||
static void Application_Idle(object sender, EventArgs e)
|
||||
{
|
||||
Console.Write("Idle\r");
|
||||
// Console.Write("Idle\r");
|
||||
}
|
||||
|
||||
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
|
||||
|
|
|
@ -214,10 +214,6 @@ namespace ArdupilotMega
|
|||
{
|
||||
if (sw != null)
|
||||
sw.Close();
|
||||
|
||||
MainV2.cs.ratesensors = 3; // hardcode 3 hz
|
||||
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RAW_SENSORS, MainV2.cs.ratesensors); // request raw sensor
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
|
|
@ -294,7 +294,6 @@
|
|||
//
|
||||
// RS4
|
||||
//
|
||||
resources.ApplyResources(this.RS4, "RS4");
|
||||
this.RS4.FormattingEnabled = true;
|
||||
this.RS4.Items.AddRange(new object[] {
|
||||
resources.GetString("RS4.Items"),
|
||||
|
@ -318,12 +317,12 @@
|
|||
resources.GetString("RS4.Items18"),
|
||||
resources.GetString("RS4.Items19"),
|
||||
resources.GetString("RS4.Items20")});
|
||||
resources.ApplyResources(this.RS4, "RS4");
|
||||
this.RS4.Name = "RS4";
|
||||
this.toolTip1.SetToolTip(this.RS4, resources.GetString("RS4.ToolTip"));
|
||||
//
|
||||
// RS3
|
||||
//
|
||||
resources.ApplyResources(this.RS3, "RS3");
|
||||
this.RS3.FormattingEnabled = true;
|
||||
this.RS3.Items.AddRange(new object[] {
|
||||
resources.GetString("RS3.Items"),
|
||||
|
@ -356,12 +355,12 @@
|
|||
resources.GetString("RS3.Items27"),
|
||||
resources.GetString("RS3.Items28"),
|
||||
resources.GetString("RS3.Items29")});
|
||||
resources.ApplyResources(this.RS3, "RS3");
|
||||
this.RS3.Name = "RS3";
|
||||
this.toolTip1.SetToolTip(this.RS3, resources.GetString("RS3.ToolTip"));
|
||||
//
|
||||
// RS2
|
||||
//
|
||||
resources.ApplyResources(this.RS2, "RS2");
|
||||
this.RS2.FormattingEnabled = true;
|
||||
this.RS2.Items.AddRange(new object[] {
|
||||
resources.GetString("RS2.Items"),
|
||||
|
@ -374,12 +373,12 @@
|
|||
resources.GetString("RS2.Items7"),
|
||||
resources.GetString("RS2.Items8"),
|
||||
resources.GetString("RS2.Items9")});
|
||||
resources.ApplyResources(this.RS2, "RS2");
|
||||
this.RS2.Name = "RS2";
|
||||
this.toolTip1.SetToolTip(this.RS2, resources.GetString("RS2.ToolTip"));
|
||||
//
|
||||
// RS1
|
||||
//
|
||||
resources.ApplyResources(this.RS1, "RS1");
|
||||
this.RS1.FormattingEnabled = true;
|
||||
this.RS1.Items.AddRange(new object[] {
|
||||
resources.GetString("RS1.Items"),
|
||||
|
@ -391,6 +390,7 @@
|
|||
resources.GetString("RS1.Items6"),
|
||||
resources.GetString("RS1.Items7"),
|
||||
resources.GetString("RS1.Items8")});
|
||||
resources.ApplyResources(this.RS1, "RS1");
|
||||
this.RS1.Name = "RS1";
|
||||
this.toolTip1.SetToolTip(this.RS1, resources.GetString("RS1.ToolTip"));
|
||||
//
|
||||
|
@ -458,17 +458,16 @@
|
|||
//
|
||||
// RS12
|
||||
//
|
||||
resources.ApplyResources(this.RS12, "RS12");
|
||||
this.RS12.FormattingEnabled = true;
|
||||
this.RS12.Items.AddRange(new object[] {
|
||||
resources.GetString("RS12.Items"),
|
||||
resources.GetString("RS12.Items1")});
|
||||
resources.ApplyResources(this.RS12, "RS12");
|
||||
this.RS12.Name = "RS12";
|
||||
this.toolTip1.SetToolTip(this.RS12, resources.GetString("RS12.ToolTip"));
|
||||
//
|
||||
// RS11
|
||||
//
|
||||
resources.ApplyResources(this.RS11, "RS11");
|
||||
this.RS11.FormattingEnabled = true;
|
||||
this.RS11.Items.AddRange(new object[] {
|
||||
resources.GetString("RS11.Items"),
|
||||
|
@ -481,12 +480,12 @@
|
|||
resources.GetString("RS11.Items7"),
|
||||
resources.GetString("RS11.Items8"),
|
||||
resources.GetString("RS11.Items9")});
|
||||
resources.ApplyResources(this.RS11, "RS11");
|
||||
this.RS11.Name = "RS11";
|
||||
this.toolTip1.SetToolTip(this.RS11, resources.GetString("RS11.ToolTip"));
|
||||
//
|
||||
// RS10
|
||||
//
|
||||
resources.ApplyResources(this.RS10, "RS10");
|
||||
this.RS10.FormattingEnabled = true;
|
||||
this.RS10.Items.AddRange(new object[] {
|
||||
resources.GetString("RS10.Items"),
|
||||
|
@ -508,6 +507,7 @@
|
|||
resources.GetString("RS10.Items16"),
|
||||
resources.GetString("RS10.Items17"),
|
||||
resources.GetString("RS10.Items18")});
|
||||
resources.ApplyResources(this.RS10, "RS10");
|
||||
this.RS10.Name = "RS10";
|
||||
this.toolTip1.SetToolTip(this.RS10, resources.GetString("RS10.ToolTip"));
|
||||
//
|
||||
|
@ -548,7 +548,6 @@
|
|||
//
|
||||
// RS8
|
||||
//
|
||||
resources.ApplyResources(this.RS8, "RS8");
|
||||
this.RS8.FormattingEnabled = true;
|
||||
this.RS8.Items.AddRange(new object[] {
|
||||
resources.GetString("RS8.Items"),
|
||||
|
@ -560,11 +559,11 @@
|
|||
resources.GetString("RS8.Items6"),
|
||||
resources.GetString("RS8.Items7"),
|
||||
resources.GetString("RS8.Items8")});
|
||||
resources.ApplyResources(this.RS8, "RS8");
|
||||
this.RS8.Name = "RS8";
|
||||
//
|
||||
// RS9
|
||||
//
|
||||
resources.ApplyResources(this.RS9, "RS9");
|
||||
this.RS9.FormattingEnabled = true;
|
||||
this.RS9.Items.AddRange(new object[] {
|
||||
resources.GetString("RS9.Items"),
|
||||
|
@ -576,6 +575,7 @@
|
|||
resources.GetString("RS9.Items6"),
|
||||
resources.GetString("RS9.Items7"),
|
||||
resources.GetString("RS9.Items8")});
|
||||
resources.ApplyResources(this.RS9, "RS9");
|
||||
this.RS9.Name = "RS9";
|
||||
//
|
||||
// RS0
|
||||
|
@ -632,8 +632,8 @@
|
|||
//
|
||||
// lbl_status
|
||||
//
|
||||
resources.ApplyResources(this.lbl_status, "lbl_status");
|
||||
this.lbl_status.BackColor = System.Drawing.Color.Transparent;
|
||||
resources.ApplyResources(this.lbl_status, "lbl_status");
|
||||
this.lbl_status.Name = "lbl_status";
|
||||
//
|
||||
// BUT_upload
|
||||
|
|
|
@ -117,10 +117,6 @@
|
|||
<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="Progressbar.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom, Left, Right</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="Progressbar.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 389</value>
|
||||
|
@ -767,9 +763,6 @@
|
|||
<data name=">>S7.ZOrder" xml:space="preserve">
|
||||
<value>51</value>
|
||||
</data>
|
||||
<data name="RS7.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="RS7.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>499, 287</value>
|
||||
</data>
|
||||
|
@ -795,9 +788,6 @@
|
|||
<data name=">>RS7.ZOrder" xml:space="preserve">
|
||||
<value>41</value>
|
||||
</data>
|
||||
<data name="RS6.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="RS6.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>499, 260</value>
|
||||
</data>
|
||||
|
@ -823,9 +813,6 @@
|
|||
<data name=">>RS6.ZOrder" xml:space="preserve">
|
||||
<value>42</value>
|
||||
</data>
|
||||
<data name="RS5.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="RS5.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>499, 233</value>
|
||||
</data>
|
||||
|
@ -851,9 +838,6 @@
|
|||
<data name=">>RS5.ZOrder" xml:space="preserve">
|
||||
<value>43</value>
|
||||
</data>
|
||||
<data name="RS4.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="RS4.Items" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
|
@ -942,9 +926,6 @@
|
|||
<data name=">>RS4.ZOrder" xml:space="preserve">
|
||||
<value>44</value>
|
||||
</data>
|
||||
<data name="RS3.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="RS3.Items" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
|
@ -1059,9 +1040,6 @@
|
|||
<data name=">>RS3.ZOrder" xml:space="preserve">
|
||||
<value>45</value>
|
||||
</data>
|
||||
<data name="RS2.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="RS2.Items" xml:space="preserve">
|
||||
<value>250</value>
|
||||
</data>
|
||||
|
@ -1116,9 +1094,6 @@
|
|||
<data name=">>RS2.ZOrder" xml:space="preserve">
|
||||
<value>46</value>
|
||||
</data>
|
||||
<data name="RS1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="RS1.Items" xml:space="preserve">
|
||||
<value>115</value>
|
||||
</data>
|
||||
|
@ -1373,9 +1348,6 @@ which result in a valid packet CRC
|
|||
<data name=">>S12.ZOrder" xml:space="preserve">
|
||||
<value>27</value>
|
||||
</data>
|
||||
<data name="RS12.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="RS12.Items" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
|
@ -1407,9 +1379,6 @@ which result in a valid packet CRC
|
|||
<data name=">>RS12.ZOrder" xml:space="preserve">
|
||||
<value>17</value>
|
||||
</data>
|
||||
<data name="RS11.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="RS11.Items" xml:space="preserve">
|
||||
<value>10</value>
|
||||
</data>
|
||||
|
@ -1465,9 +1434,6 @@ which result in a valid packet CRC
|
|||
<data name=">>RS11.ZOrder" xml:space="preserve">
|
||||
<value>18</value>
|
||||
</data>
|
||||
<data name="RS10.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="RS10.Items" xml:space="preserve">
|
||||
<value>5</value>
|
||||
</data>
|
||||
|
@ -1655,9 +1621,6 @@ which result in a valid packet CRC
|
|||
<data name=">>S8.ZOrder" xml:space="preserve">
|
||||
<value>26</value>
|
||||
</data>
|
||||
<data name="RS8.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="RS8.Items" xml:space="preserve">
|
||||
<value>902000</value>
|
||||
</data>
|
||||
|
@ -1706,9 +1669,6 @@ which result in a valid packet CRC
|
|||
<data name=">>RS8.ZOrder" xml:space="preserve">
|
||||
<value>16</value>
|
||||
</data>
|
||||
<data name="RS9.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="RS9.Items" xml:space="preserve">
|
||||
<value>902000</value>
|
||||
</data>
|
||||
|
@ -1757,9 +1717,6 @@ which result in a valid packet CRC
|
|||
<data name=">>RS9.ZOrder" xml:space="preserve">
|
||||
<value>20</value>
|
||||
</data>
|
||||
<data name="RS0.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="RS0.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>499, 99</value>
|
||||
</data>
|
||||
|
@ -1808,9 +1765,6 @@ which result in a valid packet CRC
|
|||
<data name=">>label9.ZOrder" xml:space="preserve">
|
||||
<value>40</value>
|
||||
</data>
|
||||
<data name="label10.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="label10.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
|
@ -1838,9 +1792,6 @@ which result in a valid packet CRC
|
|||
<data name=">>label10.ZOrder" xml:space="preserve">
|
||||
<value>39</value>
|
||||
</data>
|
||||
<data name="RTI.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="RTI.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>543, 25</value>
|
||||
</data>
|
||||
|
@ -1937,9 +1888,6 @@ which result in a valid packet CRC
|
|||
<data name=">>label12.ZOrder" xml:space="preserve">
|
||||
<value>34</value>
|
||||
</data>
|
||||
<data name="BUT_savesettings.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom</value>
|
||||
</data>
|
||||
<data name="BUT_savesettings.Enabled" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
|
@ -1959,7 +1907,7 @@ which result in a valid packet CRC
|
|||
<value>BUT_savesettings</value>
|
||||
</data>
|
||||
<data name=">>BUT_savesettings.Type" xml:space="preserve">
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.26252, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>BUT_savesettings.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
|
@ -1967,9 +1915,6 @@ which result in a valid packet CRC
|
|||
<data name=">>BUT_savesettings.ZOrder" xml:space="preserve">
|
||||
<value>49</value>
|
||||
</data>
|
||||
<data name="BUT_getcurrent.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom</value>
|
||||
</data>
|
||||
<data name="BUT_getcurrent.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>253, 319</value>
|
||||
</data>
|
||||
|
@ -1986,7 +1931,7 @@ which result in a valid packet CRC
|
|||
<value>BUT_getcurrent</value>
|
||||
</data>
|
||||
<data name=">>BUT_getcurrent.Type" xml:space="preserve">
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.26252, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>BUT_getcurrent.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
|
@ -1994,9 +1939,6 @@ which result in a valid packet CRC
|
|||
<data name=">>BUT_getcurrent.ZOrder" xml:space="preserve">
|
||||
<value>64</value>
|
||||
</data>
|
||||
<data name="lbl_status.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom, Left, Right</value>
|
||||
</data>
|
||||
<data name="lbl_status.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 361</value>
|
||||
</data>
|
||||
|
@ -2018,9 +1960,6 @@ which result in a valid packet CRC
|
|||
<data name=">>lbl_status.ZOrder" xml:space="preserve">
|
||||
<value>67</value>
|
||||
</data>
|
||||
<data name="BUT_upload.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom</value>
|
||||
</data>
|
||||
<data name="BUT_upload.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>403, 319</value>
|
||||
</data>
|
||||
|
@ -2037,7 +1976,7 @@ which result in a valid packet CRC
|
|||
<value>BUT_upload</value>
|
||||
</data>
|
||||
<data name=">>BUT_upload.Type" xml:space="preserve">
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.26252, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>BUT_upload.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
|
@ -2061,7 +2000,7 @@ which result in a valid packet CRC
|
|||
<value>BUT_syncS2</value>
|
||||
</data>
|
||||
<data name=">>BUT_syncS2.Type" xml:space="preserve">
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.26252, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>BUT_syncS2.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
|
@ -2085,7 +2024,7 @@ which result in a valid packet CRC
|
|||
<value>BUT_syncS3</value>
|
||||
</data>
|
||||
<data name=">>BUT_syncS3.Type" xml:space="preserve">
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.26252, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>BUT_syncS3.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
|
@ -2109,7 +2048,7 @@ which result in a valid packet CRC
|
|||
<value>BUT_syncS5</value>
|
||||
</data>
|
||||
<data name=">>BUT_syncS5.Type" xml:space="preserve">
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.26252, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>BUT_syncS5.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
|
@ -2120,6 +2059,7 @@ which result in a valid packet CRC
|
|||
<data name="label13.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="label13.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
|
@ -2267,9 +2207,6 @@ which result in a valid packet CRC
|
|||
<data name=">>label17.ZOrder" xml:space="preserve">
|
||||
<value>21</value>
|
||||
</data>
|
||||
<data name="label20.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="label20.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
|
@ -2300,9 +2237,6 @@ which result in a valid packet CRC
|
|||
<data name=">>label20.ZOrder" xml:space="preserve">
|
||||
<value>11</value>
|
||||
</data>
|
||||
<data name="label21.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="label21.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
|
@ -2333,9 +2267,6 @@ which result in a valid packet CRC
|
|||
<data name=">>label21.ZOrder" xml:space="preserve">
|
||||
<value>12</value>
|
||||
</data>
|
||||
<data name="label22.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="label22.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
|
@ -2366,9 +2297,6 @@ which result in a valid packet CRC
|
|||
<data name=">>label22.ZOrder" xml:space="preserve">
|
||||
<value>13</value>
|
||||
</data>
|
||||
<data name="label23.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="label23.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
|
@ -2399,9 +2327,6 @@ which result in a valid packet CRC
|
|||
<data name=">>label23.ZOrder" xml:space="preserve">
|
||||
<value>14</value>
|
||||
</data>
|
||||
<data name="label24.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="label24.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
|
@ -2432,9 +2357,6 @@ which result in a valid packet CRC
|
|||
<data name=">>label24.ZOrder" xml:space="preserve">
|
||||
<value>15</value>
|
||||
</data>
|
||||
<data name="label25.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="label25.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
|
@ -2465,9 +2387,6 @@ which result in a valid packet CRC
|
|||
<data name=">>label25.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="label26.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="label26.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
|
@ -2498,9 +2417,6 @@ which result in a valid packet CRC
|
|||
<data name=">>label26.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="label27.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="label27.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
|
@ -2531,9 +2447,6 @@ which result in a valid packet CRC
|
|||
<data name=">>label27.ZOrder" xml:space="preserve">
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="label28.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="label28.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
|
@ -2564,9 +2477,6 @@ which result in a valid packet CRC
|
|||
<data name=">>label28.ZOrder" xml:space="preserve">
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name="label29.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="label29.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
|
@ -2597,9 +2507,6 @@ which result in a valid packet CRC
|
|||
<data name=">>label29.ZOrder" xml:space="preserve">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="label30.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="label30.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
|
@ -2630,9 +2537,6 @@ which result in a valid packet CRC
|
|||
<data name=">>label30.ZOrder" xml:space="preserve">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="label31.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="label31.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
|
@ -2663,9 +2567,6 @@ which result in a valid packet CRC
|
|||
<data name=">>label31.ZOrder" xml:space="preserve">
|
||||
<value>9</value>
|
||||
</data>
|
||||
<data name="label32.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="label32.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
|
@ -2715,7 +2616,7 @@ which result in a valid packet CRC
|
|||
<value>BUT_syncS8</value>
|
||||
</data>
|
||||
<data name=">>BUT_syncS8.Type" xml:space="preserve">
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.26252, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>BUT_syncS8.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
|
@ -2742,7 +2643,7 @@ which result in a valid packet CRC
|
|||
<value>BUT_syncS9</value>
|
||||
</data>
|
||||
<data name=">>BUT_syncS9.Type" xml:space="preserve">
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.26252, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>BUT_syncS9.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
|
@ -2769,7 +2670,7 @@ which result in a valid packet CRC
|
|||
<value>BUT_syncS10</value>
|
||||
</data>
|
||||
<data name=">>BUT_syncS10.Type" xml:space="preserve">
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4498.26252, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>BUT_syncS10.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
|
@ -2796,6 +2697,6 @@ which result in a valid packet CRC
|
|||
<value>_3DRradio</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>ArdupilotMega.Controls.BackstageView.BackStageViewContentPanel, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ArdupilotMega.Controls.BackstageView.BackStageViewContentPanel, ArdupilotMegaPlanner, Version=1.1.4498.26252, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1,310 +1,310 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using u32 = System.UInt32;
|
||||
using u16 = System.UInt16;
|
||||
using u8 = System.Byte;
|
||||
|
||||
/// <summary>
|
||||
/// based off ftp://pserver.samba.org/pub/unpacked/picturebook/avi.c
|
||||
/// </summary>
|
||||
|
||||
public class AviWriter
|
||||
{
|
||||
/*
|
||||
avi debug: * LIST-root size:1233440040 pos:0
|
||||
avi debug: + RIFF-AVI size:1233440032 pos:0
|
||||
avi debug: | + LIST-hdrl size:310 pos:12
|
||||
avi debug: | | + avih size:56 pos:24
|
||||
avi debug: | | + LIST-strl size:124 pos:88
|
||||
avi debug: | | | + strh size:64 pos:100
|
||||
avi debug: | | | + strf size:40 pos:172
|
||||
avi debug: | | + LIST-strl size:102 pos:220
|
||||
avi debug: | | | + strh size:64 pos:232
|
||||
avi debug: | | | + strf size:18 pos:304
|
||||
avi debug: | + JUNK size:1698 pos:330
|
||||
avi debug: | + LIST-movi size:1232936964 pos:2036
|
||||
avi debug: | + idx1 size:501024 pos:1232939008
|
||||
avi debug: AVIH: 2 stream, flags HAS_INDEX
|
||||
avi debug: stream[0] rate:1000000 scale:33333 samplesize:0
|
||||
avi debug: stream[0] video(MJPG) 1280x720 24bpp 30.000300fps
|
||||
*/
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct riff_head
|
||||
{
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] riff; /* "RIFF" */
|
||||
public u32 size;
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] avistr; /* "AVI " */
|
||||
};
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct stream_head
|
||||
{ /* 56 bytes */
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] strh; /* "strh" */
|
||||
public u32 size;
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] vids; /* "vids" */
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] codec; /* codec name */
|
||||
public u32 flags;
|
||||
public u32 reserved1;
|
||||
public u32 initialframes;
|
||||
public u32 scale; /* 1 */
|
||||
public u32 rate; /* in frames per second */
|
||||
public u32 start;
|
||||
public u32 length; /* what units?? fps*nframes ?? */
|
||||
public u32 suggested_bufsize;
|
||||
public u32 quality; /* -1 */
|
||||
public u32 samplesize;
|
||||
public short l;
|
||||
public short t;
|
||||
public short r;
|
||||
public short b;
|
||||
};
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct avi_head
|
||||
{ /* 64 bytes */
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] avih; /* "avih" */
|
||||
public u32 size;
|
||||
public u32 time; /* microsec per frame? 1e6 / fps ?? */
|
||||
public u32 maxbytespersec;
|
||||
public u32 reserved1;
|
||||
public u32 flags;
|
||||
public u32 nframes;
|
||||
public u32 initialframes;
|
||||
public u32 numstreams; /* 1 */
|
||||
public u32 suggested_bufsize;
|
||||
public u32 width;
|
||||
public u32 height;
|
||||
public u32 scale; /* 1 */
|
||||
public u32 rate; /* fps */
|
||||
public u32 start;
|
||||
public u32 length; /* what units?? fps*nframes ?? */
|
||||
};
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct list_head
|
||||
{ /* 12 bytes */
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] list; /* "LIST" */
|
||||
public u32 size;
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] type;
|
||||
};
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct db_head
|
||||
{
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] db; /* "00db" */
|
||||
public u32 size;
|
||||
};
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct frame_head
|
||||
{ /* 48 bytes */
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] strf; /* "strf" */
|
||||
public u32 size;
|
||||
public UInt32 size2; /* repeat of previous field? */
|
||||
public Int32 width;
|
||||
public Int32 height;
|
||||
public Int16 planes; /* 1 */
|
||||
public Int16 bitcount; /* 24 */
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] codec; /* MJPG */
|
||||
public UInt32 unpackedsize; /* 3 * w * h */
|
||||
public Int32 r1;
|
||||
public Int32 r2;
|
||||
public UInt32 clr_used;
|
||||
public UInt32 clr_important;
|
||||
};
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct BITMAPINFOHEADER
|
||||
{
|
||||
public UInt32 biSize;
|
||||
public Int32 biWidth;
|
||||
public Int32 biHeight;
|
||||
public Int16 biPlanes;
|
||||
public Int16 biBitCount;
|
||||
public UInt32 biCompression;
|
||||
public UInt32 biSizeImage;
|
||||
public Int32 biXPelsPerMeter;
|
||||
public Int32 biYPelsPerMeter;
|
||||
public UInt32 biClrUsed;
|
||||
public UInt32 biClrImportant;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int nframes;
|
||||
static uint totalsize;
|
||||
System.IO.BufferedStream fd;
|
||||
|
||||
public void avi_close()
|
||||
{
|
||||
if (fd != null)
|
||||
fd.Close();
|
||||
}
|
||||
|
||||
/* start writing an AVI file */
|
||||
public void avi_start(string filename)
|
||||
{
|
||||
avi_close();
|
||||
|
||||
fd = new BufferedStream(File.Open(filename, FileMode.Create));
|
||||
|
||||
fd.Seek(2048,SeekOrigin.Begin);
|
||||
|
||||
nframes = 0;
|
||||
totalsize = 0;
|
||||
}
|
||||
|
||||
|
||||
/* add a jpeg frame to an AVI file */
|
||||
public void avi_add(u8[] buf, uint size)
|
||||
{
|
||||
Console.WriteLine(DateTime.Now.Millisecond + "avi frame");
|
||||
db_head db = new db_head { db = "00dc".ToCharArray(), size = size };
|
||||
fd.Write(StructureToByteArray(db), 0, Marshal.SizeOf(db));
|
||||
fd.Write(buf, 0, (int)size);
|
||||
if (size % 2 == 1)
|
||||
{
|
||||
size++;
|
||||
fd.Seek(1, SeekOrigin.Current);
|
||||
}
|
||||
nframes++;
|
||||
totalsize += size;
|
||||
}
|
||||
|
||||
void strcpy(ref char[] to,string orig)
|
||||
{
|
||||
to = orig.ToCharArray();
|
||||
}
|
||||
|
||||
/* finish writing the AVI file - filling in the header */
|
||||
public void avi_end(int width, int height, int fps)
|
||||
{
|
||||
riff_head rh = new riff_head { riff = "RIFF".ToCharArray(), size = 0, avistr = "AVI ".ToCharArray() };
|
||||
list_head lh1 = new list_head { list = "LIST".ToCharArray(), size = 0, type = "hdrl".ToCharArray() };
|
||||
avi_head ah = new avi_head();
|
||||
list_head lh2 = new list_head { list = "LIST".ToCharArray(), size = 0, type = "strl".ToCharArray() };
|
||||
stream_head sh = new stream_head();
|
||||
frame_head fh = new frame_head();
|
||||
list_head junk = new list_head() { list = "JUNK".ToCharArray(), size = 0 };
|
||||
list_head lh3 = new list_head { list = "LIST".ToCharArray(), size = 0, type = "movi".ToCharArray() };
|
||||
|
||||
//bzero(&ah, sizeof(ah));
|
||||
strcpy(ref ah.avih, "avih");
|
||||
ah.time = (u32)(1e6 / fps);
|
||||
ah.numstreams = 1;
|
||||
//ah.scale = (u32)(1e6 / fps);
|
||||
//ah.rate = (u32)fps;
|
||||
//ah.length = (u32)(nframes);
|
||||
ah.nframes = (u32)(nframes);
|
||||
ah.width = (u32)width;
|
||||
ah.height = (u32)height;
|
||||
ah.flags = 0;
|
||||
ah.suggested_bufsize = (u32)(3 * width * height * fps);
|
||||
ah.maxbytespersec = (u32)(3 * width * height * fps);
|
||||
|
||||
//bzero(&sh, sizeof(sh));
|
||||
strcpy(ref sh.strh, "strh");
|
||||
strcpy(ref sh.vids, "vids");
|
||||
strcpy(ref sh.codec, "MJPG");
|
||||
sh.scale = (u32)(1e6 / fps);
|
||||
sh.rate = (u32)1000000;
|
||||
sh.length = (u32)(nframes);
|
||||
sh.suggested_bufsize = (u32)(3 * width * height * fps);
|
||||
unchecked
|
||||
{
|
||||
sh.quality = (uint)-1;
|
||||
}
|
||||
|
||||
//bzero(&fh, sizeof(fh));
|
||||
strcpy(ref fh.strf, "strf");
|
||||
fh.width = width;
|
||||
fh.height = height;
|
||||
fh.planes = 1;
|
||||
fh.bitcount = 24;
|
||||
strcpy(ref fh.codec, "MJPG");
|
||||
fh.unpackedsize = (u32)(3 * width * height);
|
||||
|
||||
rh.size = (u32)(Marshal.SizeOf(lh1) + Marshal.SizeOf(ah) + Marshal.SizeOf(lh2) + Marshal.SizeOf(sh) +
|
||||
Marshal.SizeOf(fh) + Marshal.SizeOf(lh3) +
|
||||
nframes * Marshal.SizeOf((new db_head())) +
|
||||
totalsize);
|
||||
lh1.size = (u32)(4 + Marshal.SizeOf(ah) + Marshal.SizeOf(lh2) + Marshal.SizeOf(sh) + Marshal.SizeOf(fh));
|
||||
ah.size = (u32)(Marshal.SizeOf(ah) - 8);
|
||||
lh2.size = (u32)(4 + Marshal.SizeOf(sh) + Marshal.SizeOf(fh));
|
||||
sh.size = (u32)(Marshal.SizeOf(sh) - 8);
|
||||
fh.size = (u32)(Marshal.SizeOf(fh) - 8);
|
||||
fh.size2 = fh.size;
|
||||
lh3.size = (u32)(4 +
|
||||
nframes * Marshal.SizeOf((new db_head())) +
|
||||
totalsize);
|
||||
junk.size = 2048 - lh1.size - 12 - 12 - 12 - 4; // junk head, list head, rif head , 4
|
||||
long pos = fd.Position;
|
||||
fd.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
fd.Write(StructureToByteArray(rh),0, Marshal.SizeOf(rh));
|
||||
fd.Write(StructureToByteArray(lh1), 0, Marshal.SizeOf(lh1));
|
||||
fd.Write(StructureToByteArray(ah), 0, Marshal.SizeOf(ah));
|
||||
fd.Write(StructureToByteArray(lh2), 0, Marshal.SizeOf(lh2));
|
||||
fd.Write(StructureToByteArray(sh), 0, Marshal.SizeOf(sh));
|
||||
fd.Write(StructureToByteArray(fh), 0, Marshal.SizeOf(fh));
|
||||
fd.Write(StructureToByteArray(junk), 0, Marshal.SizeOf(junk));
|
||||
fd.Seek(2036, SeekOrigin.Begin);
|
||||
fd.Write(StructureToByteArray(lh3), 0, Marshal.SizeOf(lh3));
|
||||
|
||||
fd.Seek(pos, SeekOrigin.Begin);
|
||||
}
|
||||
|
||||
byte[] StructureToByteArray(object obj)
|
||||
{
|
||||
|
||||
int len = Marshal.SizeOf(obj);
|
||||
|
||||
byte[] arr = new byte[len];
|
||||
|
||||
IntPtr ptr = Marshal.AllocHGlobal(len);
|
||||
|
||||
Marshal.StructureToPtr(obj, ptr, true);
|
||||
|
||||
Marshal.Copy(ptr, arr, 0, len);
|
||||
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
|
||||
return arr;
|
||||
|
||||
}
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using u32 = System.UInt32;
|
||||
using u16 = System.UInt16;
|
||||
using u8 = System.Byte;
|
||||
|
||||
/// <summary>
|
||||
/// based off ftp://pserver.samba.org/pub/unpacked/picturebook/avi.c
|
||||
/// </summary>
|
||||
|
||||
public class AviWriter
|
||||
{
|
||||
/*
|
||||
avi debug: * LIST-root size:1233440040 pos:0
|
||||
avi debug: + RIFF-AVI size:1233440032 pos:0
|
||||
avi debug: | + LIST-hdrl size:310 pos:12
|
||||
avi debug: | | + avih size:56 pos:24
|
||||
avi debug: | | + LIST-strl size:124 pos:88
|
||||
avi debug: | | | + strh size:64 pos:100
|
||||
avi debug: | | | + strf size:40 pos:172
|
||||
avi debug: | | + LIST-strl size:102 pos:220
|
||||
avi debug: | | | + strh size:64 pos:232
|
||||
avi debug: | | | + strf size:18 pos:304
|
||||
avi debug: | + JUNK size:1698 pos:330
|
||||
avi debug: | + LIST-movi size:1232936964 pos:2036
|
||||
avi debug: | + idx1 size:501024 pos:1232939008
|
||||
avi debug: AVIH: 2 stream, flags HAS_INDEX
|
||||
avi debug: stream[0] rate:1000000 scale:33333 samplesize:0
|
||||
avi debug: stream[0] video(MJPG) 1280x720 24bpp 30.000300fps
|
||||
*/
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct riff_head
|
||||
{
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] riff; /* "RIFF" */
|
||||
public u32 size;
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] avistr; /* "AVI " */
|
||||
};
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct stream_head
|
||||
{ /* 56 bytes */
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] strh; /* "strh" */
|
||||
public u32 size;
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] vids; /* "vids" */
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] codec; /* codec name */
|
||||
public u32 flags;
|
||||
public u32 reserved1;
|
||||
public u32 initialframes;
|
||||
public u32 scale; /* 1 */
|
||||
public u32 rate; /* in frames per second */
|
||||
public u32 start;
|
||||
public u32 length; /* what units?? fps*nframes ?? */
|
||||
public u32 suggested_bufsize;
|
||||
public u32 quality; /* -1 */
|
||||
public u32 samplesize;
|
||||
public short l;
|
||||
public short t;
|
||||
public short r;
|
||||
public short b;
|
||||
};
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct avi_head
|
||||
{ /* 64 bytes */
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] avih; /* "avih" */
|
||||
public u32 size;
|
||||
public u32 time; /* microsec per frame? 1e6 / fps ?? */
|
||||
public u32 maxbytespersec;
|
||||
public u32 reserved1;
|
||||
public u32 flags;
|
||||
public u32 nframes;
|
||||
public u32 initialframes;
|
||||
public u32 numstreams; /* 1 */
|
||||
public u32 suggested_bufsize;
|
||||
public u32 width;
|
||||
public u32 height;
|
||||
public u32 scale; /* 1 */
|
||||
public u32 rate; /* fps */
|
||||
public u32 start;
|
||||
public u32 length; /* what units?? fps*nframes ?? */
|
||||
};
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct list_head
|
||||
{ /* 12 bytes */
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] list; /* "LIST" */
|
||||
public u32 size;
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] type;
|
||||
};
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct db_head
|
||||
{
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] db; /* "00db" */
|
||||
public u32 size;
|
||||
};
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct frame_head
|
||||
{ /* 48 bytes */
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] strf; /* "strf" */
|
||||
public u32 size;
|
||||
public UInt32 size2; /* repeat of previous field? */
|
||||
public Int32 width;
|
||||
public Int32 height;
|
||||
public Int16 planes; /* 1 */
|
||||
public Int16 bitcount; /* 24 */
|
||||
[MarshalAs(
|
||||
UnmanagedType.ByValArray,
|
||||
SizeConst = 4)]
|
||||
public char[] codec; /* MJPG */
|
||||
public UInt32 unpackedsize; /* 3 * w * h */
|
||||
public Int32 r1;
|
||||
public Int32 r2;
|
||||
public UInt32 clr_used;
|
||||
public UInt32 clr_important;
|
||||
};
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct BITMAPINFOHEADER
|
||||
{
|
||||
public UInt32 biSize;
|
||||
public Int32 biWidth;
|
||||
public Int32 biHeight;
|
||||
public Int16 biPlanes;
|
||||
public Int16 biBitCount;
|
||||
public UInt32 biCompression;
|
||||
public UInt32 biSizeImage;
|
||||
public Int32 biXPelsPerMeter;
|
||||
public Int32 biYPelsPerMeter;
|
||||
public UInt32 biClrUsed;
|
||||
public UInt32 biClrImportant;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int nframes;
|
||||
static uint totalsize;
|
||||
System.IO.BufferedStream fd;
|
||||
|
||||
public void avi_close()
|
||||
{
|
||||
if (fd != null)
|
||||
fd.Close();
|
||||
}
|
||||
|
||||
/* start writing an AVI file */
|
||||
public void avi_start(string filename)
|
||||
{
|
||||
avi_close();
|
||||
|
||||
fd = new BufferedStream(File.Open(filename, FileMode.Create));
|
||||
|
||||
fd.Seek(2048,SeekOrigin.Begin);
|
||||
|
||||
nframes = 0;
|
||||
totalsize = 0;
|
||||
}
|
||||
|
||||
|
||||
/* add a jpeg frame to an AVI file */
|
||||
public void avi_add(u8[] buf, uint size)
|
||||
{
|
||||
Console.WriteLine(DateTime.Now.Millisecond + "avi frame");
|
||||
db_head db = new db_head { db = "00dc".ToCharArray(), size = size };
|
||||
fd.Write(StructureToByteArray(db), 0, Marshal.SizeOf(db));
|
||||
fd.Write(buf, 0, (int)size);
|
||||
if (size % 2 == 1)
|
||||
{
|
||||
size++;
|
||||
fd.Seek(1, SeekOrigin.Current);
|
||||
}
|
||||
nframes++;
|
||||
totalsize += size;
|
||||
}
|
||||
|
||||
void strcpy(ref char[] to,string orig)
|
||||
{
|
||||
to = orig.ToCharArray();
|
||||
}
|
||||
|
||||
/* finish writing the AVI file - filling in the header */
|
||||
public void avi_end(int width, int height, int fps)
|
||||
{
|
||||
riff_head rh = new riff_head { riff = "RIFF".ToCharArray(), size = 0, avistr = "AVI ".ToCharArray() };
|
||||
list_head lh1 = new list_head { list = "LIST".ToCharArray(), size = 0, type = "hdrl".ToCharArray() };
|
||||
avi_head ah = new avi_head();
|
||||
list_head lh2 = new list_head { list = "LIST".ToCharArray(), size = 0, type = "strl".ToCharArray() };
|
||||
stream_head sh = new stream_head();
|
||||
frame_head fh = new frame_head();
|
||||
list_head junk = new list_head() { list = "JUNK".ToCharArray(), size = 0 };
|
||||
list_head lh3 = new list_head { list = "LIST".ToCharArray(), size = 0, type = "movi".ToCharArray() };
|
||||
|
||||
//bzero(&ah, sizeof(ah));
|
||||
strcpy(ref ah.avih, "avih");
|
||||
ah.time = (u32)(1e6 / fps);
|
||||
ah.numstreams = 1;
|
||||
//ah.scale = (u32)(1e6 / fps);
|
||||
//ah.rate = (u32)fps;
|
||||
//ah.length = (u32)(nframes);
|
||||
ah.nframes = (u32)(nframes);
|
||||
ah.width = (u32)width;
|
||||
ah.height = (u32)height;
|
||||
ah.flags = 0;
|
||||
ah.suggested_bufsize = (u32)(3 * width * height * fps);
|
||||
ah.maxbytespersec = (u32)(3 * width * height * fps);
|
||||
|
||||
//bzero(&sh, sizeof(sh));
|
||||
strcpy(ref sh.strh, "strh");
|
||||
strcpy(ref sh.vids, "vids");
|
||||
strcpy(ref sh.codec, "MJPG");
|
||||
sh.scale = (u32)(1e6 / fps);
|
||||
sh.rate = (u32)1000000;
|
||||
sh.length = (u32)(nframes);
|
||||
sh.suggested_bufsize = (u32)(3 * width * height * fps);
|
||||
unchecked
|
||||
{
|
||||
sh.quality = (uint)-1;
|
||||
}
|
||||
|
||||
//bzero(&fh, sizeof(fh));
|
||||
strcpy(ref fh.strf, "strf");
|
||||
fh.width = width;
|
||||
fh.height = height;
|
||||
fh.planes = 1;
|
||||
fh.bitcount = 24;
|
||||
strcpy(ref fh.codec, "MJPG");
|
||||
fh.unpackedsize = (u32)(3 * width * height);
|
||||
|
||||
rh.size = (u32)(Marshal.SizeOf(lh1) + Marshal.SizeOf(ah) + Marshal.SizeOf(lh2) + Marshal.SizeOf(sh) +
|
||||
Marshal.SizeOf(fh) + Marshal.SizeOf(lh3) +
|
||||
nframes * Marshal.SizeOf((new db_head())) +
|
||||
totalsize);
|
||||
lh1.size = (u32)(4 + Marshal.SizeOf(ah) + Marshal.SizeOf(lh2) + Marshal.SizeOf(sh) + Marshal.SizeOf(fh));
|
||||
ah.size = (u32)(Marshal.SizeOf(ah) - 8);
|
||||
lh2.size = (u32)(4 + Marshal.SizeOf(sh) + Marshal.SizeOf(fh));
|
||||
sh.size = (u32)(Marshal.SizeOf(sh) - 8);
|
||||
fh.size = (u32)(Marshal.SizeOf(fh) - 8);
|
||||
fh.size2 = fh.size;
|
||||
lh3.size = (u32)(4 +
|
||||
nframes * Marshal.SizeOf((new db_head())) +
|
||||
totalsize);
|
||||
junk.size = 2048 - lh1.size - 12 - 12 - 12 - 4; // junk head, list head, rif head , 4
|
||||
long pos = fd.Position;
|
||||
fd.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
fd.Write(StructureToByteArray(rh),0, Marshal.SizeOf(rh));
|
||||
fd.Write(StructureToByteArray(lh1), 0, Marshal.SizeOf(lh1));
|
||||
fd.Write(StructureToByteArray(ah), 0, Marshal.SizeOf(ah));
|
||||
fd.Write(StructureToByteArray(lh2), 0, Marshal.SizeOf(lh2));
|
||||
fd.Write(StructureToByteArray(sh), 0, Marshal.SizeOf(sh));
|
||||
fd.Write(StructureToByteArray(fh), 0, Marshal.SizeOf(fh));
|
||||
fd.Write(StructureToByteArray(junk), 0, Marshal.SizeOf(junk));
|
||||
fd.Seek(2036, SeekOrigin.Begin);
|
||||
fd.Write(StructureToByteArray(lh3), 0, Marshal.SizeOf(lh3));
|
||||
|
||||
fd.Seek(pos, SeekOrigin.Begin);
|
||||
}
|
||||
|
||||
byte[] StructureToByteArray(object obj)
|
||||
{
|
||||
|
||||
int len = Marshal.SizeOf(obj);
|
||||
|
||||
byte[] arr = new byte[len];
|
||||
|
||||
IntPtr ptr = Marshal.AllocHGlobal(len);
|
||||
|
||||
Marshal.StructureToPtr(obj, ptr, true);
|
||||
|
||||
Marshal.Copy(ptr, arr, 0, len);
|
||||
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
|
||||
return arr;
|
||||
|
||||
}
|
||||
}
|
|
@ -1,498 +1,498 @@
|
|||
/****************************************************************************
|
||||
While the underlying libraries are covered by LGPL, this sample is released
|
||||
as public domain. It is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Diagnostics;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using DirectShowLib;
|
||||
|
||||
|
||||
namespace WebCamService
|
||||
{
|
||||
public delegate void CamImage(Image camimage);
|
||||
|
||||
/// <summary> Summary description for MainForm. </summary>
|
||||
public class Capture : ISampleGrabberCB, IDisposable
|
||||
{
|
||||
#region Member variables
|
||||
|
||||
/// <summary> graph builder interface. </summary>
|
||||
private IFilterGraph2 m_FilterGraph = null;
|
||||
private IMediaControl m_mediaCtrl = null;
|
||||
|
||||
/// <summary> so we can wait for the async job to finish </summary>
|
||||
private ManualResetEvent m_PictureReady = null;
|
||||
|
||||
/// <summary> Set by async routine when it captures an image </summary>
|
||||
private volatile bool m_bGotOne = false;
|
||||
|
||||
/// <summary> Indicates the status of the graph </summary>
|
||||
private bool m_bRunning = false;
|
||||
|
||||
/// <summary> Dimensions of the image, calculated once in constructor. </summary>
|
||||
private IntPtr m_handle = IntPtr.Zero;
|
||||
private int m_videoWidth;
|
||||
private int m_videoHeight;
|
||||
private int m_stride;
|
||||
public int m_Dropped = 0;
|
||||
|
||||
public Image image = null;
|
||||
IntPtr ip = IntPtr.Zero;
|
||||
|
||||
public event CamImage camimage;
|
||||
System.Windows.Forms.Timer timer1 = new System.Windows.Forms.Timer();
|
||||
|
||||
#endregion
|
||||
|
||||
#region API
|
||||
|
||||
[DllImport("Kernel32.dll", EntryPoint="RtlMoveMemory")]
|
||||
private static extern void CopyMemory(IntPtr Destination, IntPtr Source, int Length);
|
||||
|
||||
#endregion
|
||||
|
||||
public Capture()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary> Use capture with selected media caps</summary>
|
||||
public Capture(int iDeviceNum, AMMediaType media)
|
||||
{
|
||||
DsDevice[] capDevices;
|
||||
|
||||
// Get the collection of video devices
|
||||
capDevices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);
|
||||
|
||||
if (iDeviceNum + 1 > capDevices.Length)
|
||||
{
|
||||
throw new Exception("No video capture devices found at that index!");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Set up the capture graph
|
||||
SetupGraph(capDevices[iDeviceNum], media);
|
||||
|
||||
// tell the callback to ignore new images
|
||||
m_PictureReady = new ManualResetEvent(false);
|
||||
m_bGotOne = true;
|
||||
m_bRunning = false;
|
||||
|
||||
timer1.Interval = 1000 / 15; // 15 fps
|
||||
timer1.Tick += new EventHandler(timer1_Tick);
|
||||
timer1.Start();
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
Dispose();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary> release everything. </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
timer1.Stop();
|
||||
if (camimage != null)
|
||||
{
|
||||
camimage(null); // clear last pic
|
||||
}
|
||||
CloseInterfaces();
|
||||
if (m_PictureReady != null)
|
||||
{
|
||||
m_PictureReady.Close();
|
||||
m_PictureReady = null;
|
||||
}
|
||||
}
|
||||
// Destructor
|
||||
~Capture()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
public int Width
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_videoWidth;
|
||||
}
|
||||
}
|
||||
public int Height
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_videoHeight;
|
||||
}
|
||||
}
|
||||
public int Stride
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_stride;
|
||||
}
|
||||
}
|
||||
/// <summary> capture the next image </summary>
|
||||
public IntPtr GetBitMap()
|
||||
{
|
||||
if (m_handle == IntPtr.Zero)
|
||||
m_handle = Marshal.AllocCoTaskMem(m_stride * m_videoHeight);
|
||||
|
||||
try
|
||||
{
|
||||
// get ready to wait for new image
|
||||
m_PictureReady.Reset();
|
||||
m_bGotOne = false;
|
||||
|
||||
// If the graph hasn't been started, start it.
|
||||
Start();
|
||||
|
||||
// Start waiting
|
||||
if ( ! m_PictureReady.WaitOne(5000, false) )
|
||||
{
|
||||
throw new Exception("Timeout waiting to get picture");
|
||||
}
|
||||
//Pause(); //- we are effectivly pulling at 15 fps, so no need to pause
|
||||
}
|
||||
catch
|
||||
{
|
||||
Marshal.FreeCoTaskMem(m_handle);
|
||||
throw;
|
||||
}
|
||||
|
||||
// Got one
|
||||
return m_handle;
|
||||
}
|
||||
// Start the capture graph
|
||||
public void Start()
|
||||
{
|
||||
if (!m_bRunning)
|
||||
{
|
||||
int hr = m_mediaCtrl.Run();
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
|
||||
m_bRunning = true;
|
||||
}
|
||||
}
|
||||
// Pause the capture graph.
|
||||
// Running the graph takes up a lot of resources. Pause it when it
|
||||
// isn't needed.
|
||||
public void Pause()
|
||||
{
|
||||
if (m_bRunning)
|
||||
{
|
||||
int hr = m_mediaCtrl.Pause();
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
|
||||
m_bRunning = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<string> getDevices()
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
DsDevice[] capDevices;
|
||||
|
||||
// Get the collection of video devices
|
||||
capDevices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);
|
||||
|
||||
foreach (DsDevice dev in capDevices)
|
||||
{
|
||||
list.Add(dev.Name);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool showhud = true;
|
||||
|
||||
void timer1_Tick(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
ip = this.GetBitMap();
|
||||
image = new Bitmap(this.Width, this.Height, this.Stride, PixelFormat.Format24bppRgb, ip);
|
||||
image.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||
if (camimage != null)
|
||||
{
|
||||
camimage(image);
|
||||
}
|
||||
}
|
||||
catch { Console.WriteLine("Grab bmp failed"); timer1.Enabled = false; this.CloseInterfaces(); System.Windows.Forms.CustomMessageBox.Show("Problem with capture device, grabbing frame took longer than 5 sec"); }
|
||||
}
|
||||
|
||||
/// <summary> build the capture graph for grabber. </summary>
|
||||
private void SetupGraph(DsDevice dev, AMMediaType media)
|
||||
{
|
||||
int hr;
|
||||
|
||||
ISampleGrabber sampGrabber = null;
|
||||
IBaseFilter capFilter = null;
|
||||
ICaptureGraphBuilder2 capGraph = null;
|
||||
|
||||
// Get the graphbuilder object
|
||||
m_FilterGraph = (IFilterGraph2) new FilterGraph();
|
||||
m_mediaCtrl = m_FilterGraph as IMediaControl;
|
||||
try
|
||||
{
|
||||
// Get the ICaptureGraphBuilder2
|
||||
capGraph = (ICaptureGraphBuilder2) new CaptureGraphBuilder2();
|
||||
|
||||
// Get the SampleGrabber interface
|
||||
sampGrabber = (ISampleGrabber) new SampleGrabber();
|
||||
|
||||
// Start building the graph
|
||||
hr = capGraph.SetFiltergraph( m_FilterGraph );
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
|
||||
// Add the video device
|
||||
hr = m_FilterGraph.AddSourceFilterForMoniker(dev.Mon, null, "Video input", out capFilter);
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
|
||||
// add video crossbar
|
||||
// thanks to Andrew Fernie - this is to get tv tuner cards working
|
||||
IAMCrossbar crossbar = null;
|
||||
object o;
|
||||
|
||||
hr = capGraph.FindInterface(PinCategory.Capture, MediaType.Video, capFilter, typeof(IAMCrossbar).GUID, out o);
|
||||
if (hr >= 0)
|
||||
{
|
||||
crossbar = (IAMCrossbar)o;
|
||||
int oPin, iPin;
|
||||
int ovLink, ivLink;
|
||||
ovLink = ivLink = 0;
|
||||
|
||||
crossbar.get_PinCounts(out oPin, out iPin);
|
||||
int pIdxRel;
|
||||
PhysicalConnectorType tp;
|
||||
for (int i = 0; i < iPin; i++)
|
||||
{
|
||||
crossbar.get_CrossbarPinInfo(true, i, out pIdxRel, out tp);
|
||||
if (tp == PhysicalConnectorType.Video_Composite) ivLink = i;
|
||||
}
|
||||
|
||||
for (int i = 0; i < oPin; i++)
|
||||
{
|
||||
crossbar.get_CrossbarPinInfo(false, i, out pIdxRel, out tp);
|
||||
if (tp == PhysicalConnectorType.Video_VideoDecoder) ovLink = i;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
crossbar.Route(ovLink, ivLink);
|
||||
o = null;
|
||||
}
|
||||
|
||||
catch
|
||||
{
|
||||
throw new Exception("Failed to get IAMCrossbar");
|
||||
}
|
||||
}
|
||||
|
||||
//add AVI Decompressor
|
||||
IBaseFilter pAVIDecompressor = (IBaseFilter)new AVIDec();
|
||||
hr = m_FilterGraph.AddFilter(pAVIDecompressor, "AVI Decompressor");
|
||||
DsError.ThrowExceptionForHR(hr);
|
||||
|
||||
//
|
||||
IBaseFilter baseGrabFlt = (IBaseFilter) sampGrabber;
|
||||
ConfigureSampleGrabber(sampGrabber);
|
||||
|
||||
// Add the frame grabber to the graph
|
||||
hr = m_FilterGraph.AddFilter( baseGrabFlt, "Ds.NET Grabber" );
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
|
||||
SetConfigParms(capGraph, capFilter, media);
|
||||
|
||||
hr = capGraph.RenderStream(PinCategory.Capture, MediaType.Video, capFilter, pAVIDecompressor, baseGrabFlt);
|
||||
if (hr < 0)
|
||||
{
|
||||
hr = capGraph.RenderStream(PinCategory.Capture, MediaType.Video, capFilter, null, baseGrabFlt);
|
||||
}
|
||||
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
|
||||
SaveSizeInfo(sampGrabber);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (capFilter != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(capFilter);
|
||||
capFilter = null;
|
||||
}
|
||||
if (sampGrabber != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(sampGrabber);
|
||||
sampGrabber = null;
|
||||
}
|
||||
if (capGraph != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(capGraph);
|
||||
capGraph = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveSizeInfo(ISampleGrabber sampGrabber)
|
||||
{
|
||||
int hr;
|
||||
|
||||
// Get the media type from the SampleGrabber
|
||||
AMMediaType media = new AMMediaType();
|
||||
hr = sampGrabber.GetConnectedMediaType( media );
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
|
||||
if( (media.formatType != FormatType.VideoInfo) || (media.formatPtr == IntPtr.Zero) )
|
||||
{
|
||||
throw new NotSupportedException( "Unknown Grabber Media Format" );
|
||||
}
|
||||
|
||||
// Grab the size info
|
||||
VideoInfoHeader videoInfoHeader = (VideoInfoHeader) Marshal.PtrToStructure( media.formatPtr, typeof(VideoInfoHeader) );
|
||||
m_videoWidth = videoInfoHeader.BmiHeader.Width;
|
||||
m_videoHeight = videoInfoHeader.BmiHeader.Height;
|
||||
m_stride = m_videoWidth * (videoInfoHeader.BmiHeader.BitCount / 8);
|
||||
|
||||
DsUtils.FreeAMMediaType(media);
|
||||
media = null;
|
||||
}
|
||||
private void ConfigureSampleGrabber(ISampleGrabber sampGrabber)
|
||||
{
|
||||
AMMediaType media;
|
||||
int hr;
|
||||
|
||||
// Set the media type to Video/RBG24
|
||||
media = new AMMediaType();
|
||||
media.majorType = MediaType.Video;
|
||||
media.subType = MediaSubType.RGB24;
|
||||
media.formatType = FormatType.VideoInfo;
|
||||
hr = sampGrabber.SetMediaType( media );
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
|
||||
DsUtils.FreeAMMediaType(media);
|
||||
media = null;
|
||||
|
||||
// Configure the samplegrabber
|
||||
hr = sampGrabber.SetCallback( this, 1 );
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
}
|
||||
|
||||
// Set the Framerate, and video size
|
||||
private void SetConfigParms(ICaptureGraphBuilder2 capGraph, IBaseFilter capFilter, AMMediaType media)
|
||||
{
|
||||
int hr;
|
||||
object o;
|
||||
|
||||
// Find the stream config interface
|
||||
hr = capGraph.FindInterface(
|
||||
PinCategory.Capture, MediaType.Video, capFilter, typeof(IAMStreamConfig).GUID, out o );
|
||||
|
||||
IAMStreamConfig videoStreamConfig = o as IAMStreamConfig;
|
||||
if (videoStreamConfig == null)
|
||||
{
|
||||
throw new Exception("Failed to get IAMStreamConfig");
|
||||
}
|
||||
|
||||
// Set the new format
|
||||
hr = videoStreamConfig.SetFormat( media );
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
|
||||
DsUtils.FreeAMMediaType(media);
|
||||
media = null;
|
||||
}
|
||||
|
||||
/// <summary> Shut down capture </summary>
|
||||
private void CloseInterfaces()
|
||||
{
|
||||
int hr;
|
||||
|
||||
try
|
||||
{
|
||||
if( m_mediaCtrl != null )
|
||||
{
|
||||
// Stop the graph
|
||||
hr = m_mediaCtrl.Stop();
|
||||
m_bRunning = false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex);
|
||||
}
|
||||
|
||||
if (m_FilterGraph != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(m_FilterGraph);
|
||||
m_FilterGraph = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> sample callback, NOT USED. </summary>
|
||||
int ISampleGrabberCB.SampleCB( double SampleTime, IMediaSample pSample )
|
||||
{
|
||||
if (!m_bGotOne)
|
||||
{
|
||||
// Set bGotOne to prevent further calls until we
|
||||
// request a new bitmap.
|
||||
m_bGotOne = true;
|
||||
IntPtr pBuffer;
|
||||
|
||||
pSample.GetPointer(out pBuffer);
|
||||
int iBufferLen = pSample.GetSize();
|
||||
|
||||
if (pSample.GetSize() > m_stride * m_videoHeight)
|
||||
{
|
||||
throw new Exception("Buffer is wrong size");
|
||||
}
|
||||
|
||||
CopyMemory(m_handle, pBuffer, m_stride * m_videoHeight);
|
||||
|
||||
// Picture is ready.
|
||||
m_PictureReady.Set();
|
||||
}
|
||||
|
||||
Marshal.ReleaseComObject(pSample);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary> buffer callback, COULD BE FROM FOREIGN THREAD. </summary>
|
||||
int ISampleGrabberCB.BufferCB( double SampleTime, IntPtr pBuffer, int BufferLen )
|
||||
{
|
||||
if (!m_bGotOne)
|
||||
{
|
||||
// The buffer should be long enought
|
||||
if(BufferLen <= m_stride * m_videoHeight)
|
||||
{
|
||||
// Copy the frame to the buffer
|
||||
CopyMemory(m_handle, pBuffer, m_stride * m_videoHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Buffer is wrong size");
|
||||
}
|
||||
|
||||
// Set bGotOne to prevent further calls until we
|
||||
// request a new bitmap.
|
||||
m_bGotOne = true;
|
||||
|
||||
// Picture is ready.
|
||||
m_PictureReady.Set();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Dropped++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
/****************************************************************************
|
||||
While the underlying libraries are covered by LGPL, this sample is released
|
||||
as public domain. It is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Diagnostics;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using DirectShowLib;
|
||||
|
||||
|
||||
namespace WebCamService
|
||||
{
|
||||
public delegate void CamImage(Image camimage);
|
||||
|
||||
/// <summary> Summary description for MainForm. </summary>
|
||||
public class Capture : ISampleGrabberCB, IDisposable
|
||||
{
|
||||
#region Member variables
|
||||
|
||||
/// <summary> graph builder interface. </summary>
|
||||
private IFilterGraph2 m_FilterGraph = null;
|
||||
private IMediaControl m_mediaCtrl = null;
|
||||
|
||||
/// <summary> so we can wait for the async job to finish </summary>
|
||||
private ManualResetEvent m_PictureReady = null;
|
||||
|
||||
/// <summary> Set by async routine when it captures an image </summary>
|
||||
private volatile bool m_bGotOne = false;
|
||||
|
||||
/// <summary> Indicates the status of the graph </summary>
|
||||
private bool m_bRunning = false;
|
||||
|
||||
/// <summary> Dimensions of the image, calculated once in constructor. </summary>
|
||||
private IntPtr m_handle = IntPtr.Zero;
|
||||
private int m_videoWidth;
|
||||
private int m_videoHeight;
|
||||
private int m_stride;
|
||||
public int m_Dropped = 0;
|
||||
|
||||
public Image image = null;
|
||||
IntPtr ip = IntPtr.Zero;
|
||||
|
||||
public event CamImage camimage;
|
||||
System.Windows.Forms.Timer timer1 = new System.Windows.Forms.Timer();
|
||||
|
||||
#endregion
|
||||
|
||||
#region API
|
||||
|
||||
[DllImport("Kernel32.dll", EntryPoint="RtlMoveMemory")]
|
||||
private static extern void CopyMemory(IntPtr Destination, IntPtr Source, int Length);
|
||||
|
||||
#endregion
|
||||
|
||||
public Capture()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary> Use capture with selected media caps</summary>
|
||||
public Capture(int iDeviceNum, AMMediaType media)
|
||||
{
|
||||
DsDevice[] capDevices;
|
||||
|
||||
// Get the collection of video devices
|
||||
capDevices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);
|
||||
|
||||
if (iDeviceNum + 1 > capDevices.Length)
|
||||
{
|
||||
throw new Exception("No video capture devices found at that index!");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Set up the capture graph
|
||||
SetupGraph(capDevices[iDeviceNum], media);
|
||||
|
||||
// tell the callback to ignore new images
|
||||
m_PictureReady = new ManualResetEvent(false);
|
||||
m_bGotOne = true;
|
||||
m_bRunning = false;
|
||||
|
||||
timer1.Interval = 1000 / 15; // 15 fps
|
||||
timer1.Tick += new EventHandler(timer1_Tick);
|
||||
timer1.Start();
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
Dispose();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary> release everything. </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
timer1.Stop();
|
||||
if (camimage != null)
|
||||
{
|
||||
camimage(null); // clear last pic
|
||||
}
|
||||
CloseInterfaces();
|
||||
if (m_PictureReady != null)
|
||||
{
|
||||
m_PictureReady.Close();
|
||||
m_PictureReady = null;
|
||||
}
|
||||
}
|
||||
// Destructor
|
||||
~Capture()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
public int Width
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_videoWidth;
|
||||
}
|
||||
}
|
||||
public int Height
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_videoHeight;
|
||||
}
|
||||
}
|
||||
public int Stride
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_stride;
|
||||
}
|
||||
}
|
||||
/// <summary> capture the next image </summary>
|
||||
public IntPtr GetBitMap()
|
||||
{
|
||||
if (m_handle == IntPtr.Zero)
|
||||
m_handle = Marshal.AllocCoTaskMem(m_stride * m_videoHeight);
|
||||
|
||||
try
|
||||
{
|
||||
// get ready to wait for new image
|
||||
m_PictureReady.Reset();
|
||||
m_bGotOne = false;
|
||||
|
||||
// If the graph hasn't been started, start it.
|
||||
Start();
|
||||
|
||||
// Start waiting
|
||||
if ( ! m_PictureReady.WaitOne(5000, false) )
|
||||
{
|
||||
throw new Exception("Timeout waiting to get picture");
|
||||
}
|
||||
//Pause(); //- we are effectivly pulling at 15 fps, so no need to pause
|
||||
}
|
||||
catch
|
||||
{
|
||||
Marshal.FreeCoTaskMem(m_handle);
|
||||
throw;
|
||||
}
|
||||
|
||||
// Got one
|
||||
return m_handle;
|
||||
}
|
||||
// Start the capture graph
|
||||
public void Start()
|
||||
{
|
||||
if (!m_bRunning)
|
||||
{
|
||||
int hr = m_mediaCtrl.Run();
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
|
||||
m_bRunning = true;
|
||||
}
|
||||
}
|
||||
// Pause the capture graph.
|
||||
// Running the graph takes up a lot of resources. Pause it when it
|
||||
// isn't needed.
|
||||
public void Pause()
|
||||
{
|
||||
if (m_bRunning)
|
||||
{
|
||||
int hr = m_mediaCtrl.Pause();
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
|
||||
m_bRunning = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<string> getDevices()
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
DsDevice[] capDevices;
|
||||
|
||||
// Get the collection of video devices
|
||||
capDevices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);
|
||||
|
||||
foreach (DsDevice dev in capDevices)
|
||||
{
|
||||
list.Add(dev.Name);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool showhud = true;
|
||||
|
||||
void timer1_Tick(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
ip = this.GetBitMap();
|
||||
image = new Bitmap(this.Width, this.Height, this.Stride, PixelFormat.Format24bppRgb, ip);
|
||||
image.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||
if (camimage != null)
|
||||
{
|
||||
camimage(image);
|
||||
}
|
||||
}
|
||||
catch { Console.WriteLine("Grab bmp failed"); timer1.Enabled = false; this.CloseInterfaces(); System.Windows.Forms.CustomMessageBox.Show("Problem with capture device, grabbing frame took longer than 5 sec"); }
|
||||
}
|
||||
|
||||
/// <summary> build the capture graph for grabber. </summary>
|
||||
private void SetupGraph(DsDevice dev, AMMediaType media)
|
||||
{
|
||||
int hr;
|
||||
|
||||
ISampleGrabber sampGrabber = null;
|
||||
IBaseFilter capFilter = null;
|
||||
ICaptureGraphBuilder2 capGraph = null;
|
||||
|
||||
// Get the graphbuilder object
|
||||
m_FilterGraph = (IFilterGraph2) new FilterGraph();
|
||||
m_mediaCtrl = m_FilterGraph as IMediaControl;
|
||||
try
|
||||
{
|
||||
// Get the ICaptureGraphBuilder2
|
||||
capGraph = (ICaptureGraphBuilder2) new CaptureGraphBuilder2();
|
||||
|
||||
// Get the SampleGrabber interface
|
||||
sampGrabber = (ISampleGrabber) new SampleGrabber();
|
||||
|
||||
// Start building the graph
|
||||
hr = capGraph.SetFiltergraph( m_FilterGraph );
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
|
||||
// Add the video device
|
||||
hr = m_FilterGraph.AddSourceFilterForMoniker(dev.Mon, null, "Video input", out capFilter);
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
|
||||
// add video crossbar
|
||||
// thanks to Andrew Fernie - this is to get tv tuner cards working
|
||||
IAMCrossbar crossbar = null;
|
||||
object o;
|
||||
|
||||
hr = capGraph.FindInterface(PinCategory.Capture, MediaType.Video, capFilter, typeof(IAMCrossbar).GUID, out o);
|
||||
if (hr >= 0)
|
||||
{
|
||||
crossbar = (IAMCrossbar)o;
|
||||
int oPin, iPin;
|
||||
int ovLink, ivLink;
|
||||
ovLink = ivLink = 0;
|
||||
|
||||
crossbar.get_PinCounts(out oPin, out iPin);
|
||||
int pIdxRel;
|
||||
PhysicalConnectorType tp;
|
||||
for (int i = 0; i < iPin; i++)
|
||||
{
|
||||
crossbar.get_CrossbarPinInfo(true, i, out pIdxRel, out tp);
|
||||
if (tp == PhysicalConnectorType.Video_Composite) ivLink = i;
|
||||
}
|
||||
|
||||
for (int i = 0; i < oPin; i++)
|
||||
{
|
||||
crossbar.get_CrossbarPinInfo(false, i, out pIdxRel, out tp);
|
||||
if (tp == PhysicalConnectorType.Video_VideoDecoder) ovLink = i;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
crossbar.Route(ovLink, ivLink);
|
||||
o = null;
|
||||
}
|
||||
|
||||
catch
|
||||
{
|
||||
throw new Exception("Failed to get IAMCrossbar");
|
||||
}
|
||||
}
|
||||
|
||||
//add AVI Decompressor
|
||||
IBaseFilter pAVIDecompressor = (IBaseFilter)new AVIDec();
|
||||
hr = m_FilterGraph.AddFilter(pAVIDecompressor, "AVI Decompressor");
|
||||
DsError.ThrowExceptionForHR(hr);
|
||||
|
||||
//
|
||||
IBaseFilter baseGrabFlt = (IBaseFilter) sampGrabber;
|
||||
ConfigureSampleGrabber(sampGrabber);
|
||||
|
||||
// Add the frame grabber to the graph
|
||||
hr = m_FilterGraph.AddFilter( baseGrabFlt, "Ds.NET Grabber" );
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
|
||||
SetConfigParms(capGraph, capFilter, media);
|
||||
|
||||
hr = capGraph.RenderStream(PinCategory.Capture, MediaType.Video, capFilter, pAVIDecompressor, baseGrabFlt);
|
||||
if (hr < 0)
|
||||
{
|
||||
hr = capGraph.RenderStream(PinCategory.Capture, MediaType.Video, capFilter, null, baseGrabFlt);
|
||||
}
|
||||
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
|
||||
SaveSizeInfo(sampGrabber);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (capFilter != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(capFilter);
|
||||
capFilter = null;
|
||||
}
|
||||
if (sampGrabber != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(sampGrabber);
|
||||
sampGrabber = null;
|
||||
}
|
||||
if (capGraph != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(capGraph);
|
||||
capGraph = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveSizeInfo(ISampleGrabber sampGrabber)
|
||||
{
|
||||
int hr;
|
||||
|
||||
// Get the media type from the SampleGrabber
|
||||
AMMediaType media = new AMMediaType();
|
||||
hr = sampGrabber.GetConnectedMediaType( media );
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
|
||||
if( (media.formatType != FormatType.VideoInfo) || (media.formatPtr == IntPtr.Zero) )
|
||||
{
|
||||
throw new NotSupportedException( "Unknown Grabber Media Format" );
|
||||
}
|
||||
|
||||
// Grab the size info
|
||||
VideoInfoHeader videoInfoHeader = (VideoInfoHeader) Marshal.PtrToStructure( media.formatPtr, typeof(VideoInfoHeader) );
|
||||
m_videoWidth = videoInfoHeader.BmiHeader.Width;
|
||||
m_videoHeight = videoInfoHeader.BmiHeader.Height;
|
||||
m_stride = m_videoWidth * (videoInfoHeader.BmiHeader.BitCount / 8);
|
||||
|
||||
DsUtils.FreeAMMediaType(media);
|
||||
media = null;
|
||||
}
|
||||
private void ConfigureSampleGrabber(ISampleGrabber sampGrabber)
|
||||
{
|
||||
AMMediaType media;
|
||||
int hr;
|
||||
|
||||
// Set the media type to Video/RBG24
|
||||
media = new AMMediaType();
|
||||
media.majorType = MediaType.Video;
|
||||
media.subType = MediaSubType.RGB24;
|
||||
media.formatType = FormatType.VideoInfo;
|
||||
hr = sampGrabber.SetMediaType( media );
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
|
||||
DsUtils.FreeAMMediaType(media);
|
||||
media = null;
|
||||
|
||||
// Configure the samplegrabber
|
||||
hr = sampGrabber.SetCallback( this, 1 );
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
}
|
||||
|
||||
// Set the Framerate, and video size
|
||||
private void SetConfigParms(ICaptureGraphBuilder2 capGraph, IBaseFilter capFilter, AMMediaType media)
|
||||
{
|
||||
int hr;
|
||||
object o;
|
||||
|
||||
// Find the stream config interface
|
||||
hr = capGraph.FindInterface(
|
||||
PinCategory.Capture, MediaType.Video, capFilter, typeof(IAMStreamConfig).GUID, out o );
|
||||
|
||||
IAMStreamConfig videoStreamConfig = o as IAMStreamConfig;
|
||||
if (videoStreamConfig == null)
|
||||
{
|
||||
throw new Exception("Failed to get IAMStreamConfig");
|
||||
}
|
||||
|
||||
// Set the new format
|
||||
hr = videoStreamConfig.SetFormat( media );
|
||||
DsError.ThrowExceptionForHR( hr );
|
||||
|
||||
DsUtils.FreeAMMediaType(media);
|
||||
media = null;
|
||||
}
|
||||
|
||||
/// <summary> Shut down capture </summary>
|
||||
private void CloseInterfaces()
|
||||
{
|
||||
int hr;
|
||||
|
||||
try
|
||||
{
|
||||
if( m_mediaCtrl != null )
|
||||
{
|
||||
// Stop the graph
|
||||
hr = m_mediaCtrl.Stop();
|
||||
m_bRunning = false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex);
|
||||
}
|
||||
|
||||
if (m_FilterGraph != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(m_FilterGraph);
|
||||
m_FilterGraph = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> sample callback, NOT USED. </summary>
|
||||
int ISampleGrabberCB.SampleCB( double SampleTime, IMediaSample pSample )
|
||||
{
|
||||
if (!m_bGotOne)
|
||||
{
|
||||
// Set bGotOne to prevent further calls until we
|
||||
// request a new bitmap.
|
||||
m_bGotOne = true;
|
||||
IntPtr pBuffer;
|
||||
|
||||
pSample.GetPointer(out pBuffer);
|
||||
int iBufferLen = pSample.GetSize();
|
||||
|
||||
if (pSample.GetSize() > m_stride * m_videoHeight)
|
||||
{
|
||||
throw new Exception("Buffer is wrong size");
|
||||
}
|
||||
|
||||
CopyMemory(m_handle, pBuffer, m_stride * m_videoHeight);
|
||||
|
||||
// Picture is ready.
|
||||
m_PictureReady.Set();
|
||||
}
|
||||
|
||||
Marshal.ReleaseComObject(pSample);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary> buffer callback, COULD BE FROM FOREIGN THREAD. </summary>
|
||||
int ISampleGrabberCB.BufferCB( double SampleTime, IntPtr pBuffer, int BufferLen )
|
||||
{
|
||||
if (!m_bGotOne)
|
||||
{
|
||||
// The buffer should be long enought
|
||||
if(BufferLen <= m_stride * m_videoHeight)
|
||||
{
|
||||
// Copy the frame to the buffer
|
||||
CopyMemory(m_handle, pBuffer, m_stride * m_videoHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Buffer is wrong size");
|
||||
}
|
||||
|
||||
// Set bGotOne to prevent further calls until we
|
||||
// request a new bitmap.
|
||||
m_bGotOne = true;
|
||||
|
||||
// Picture is ready.
|
||||
m_PictureReady.Set();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Dropped++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -115,6 +115,19 @@ namespace ArdupilotMega.Utilities
|
|||
return displayText;
|
||||
}
|
||||
|
||||
public static int GetValue<T>(string item)
|
||||
{
|
||||
var list = Translate<T>();
|
||||
|
||||
foreach (var kvp in list)
|
||||
{
|
||||
if (kvp.Value == item)
|
||||
return kvp.Key;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ using System.Globalization;
|
|||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ArdupilotMega
|
||||
namespace ArdupilotMega.Utilities
|
||||
{
|
||||
static class CultureInfoEx
|
||||
{
|
|
@ -5,7 +5,7 @@ using System.Text;
|
|||
using System.Speech.Synthesis;
|
||||
using log4net;
|
||||
|
||||
namespace ArdupilotMega
|
||||
namespace ArdupilotMega.Utilities
|
||||
{
|
||||
public class Speech
|
||||
{
|
|
@ -5,7 +5,7 @@ using System.Text;
|
|||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace ArdupilotMega
|
||||
namespace ArdupilotMega.Utilities
|
||||
{
|
||||
static class TCPConsole
|
||||
{
|
|
@ -5,7 +5,7 @@ using ArdupilotMega.Controls.BackstageView;
|
|||
using log4net;
|
||||
using ArdupilotMega.Controls;
|
||||
|
||||
namespace ArdupilotMega
|
||||
namespace ArdupilotMega.Utilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper class for the stylng 'theming' of forms and controls, and provides MessageBox
|
|
@ -56,14 +56,14 @@ When the sticks are fully deflected:
|
|||
<FIELD>
|
||||
<NAME>Dampen</NAME>
|
||||
<PARAMNAME>STAB_D</PARAMNAME>
|
||||
<RANGEMIN>0.001</RANGEMIN>
|
||||
<RANGEMIN>0</RANGEMIN>
|
||||
<RANGEMAX>5</RANGEMAX>
|
||||
<STEP>0.001</STEP>
|
||||
</FIELD>
|
||||
<FIELD>
|
||||
<NAME>Dynamic</NAME>
|
||||
<PARAMNAME>STAB_D_S</PARAMNAME>
|
||||
<RANGEMIN>0.001</RANGEMIN>
|
||||
<RANGEMIN>0</RANGEMIN>
|
||||
<RANGEMAX>1</RANGEMAX>
|
||||
<STEP>0.001</STEP>
|
||||
</FIELD>
|
||||
|
@ -201,5 +201,87 @@ A distance error of 100cm * P of .25 = 25 cm/s
|
|||
<STEP>0.1</STEP>
|
||||
</FIELD>
|
||||
</FIELDS>
|
||||
<SUBHEAD>WP Speed:</SUBHEAD>
|
||||
<DESC>
|
||||
How fast the copter should move towards the target. A larger value means a faster return to center, but can cause the copter to oscillate around the target.
|
||||
|
||||
in m/s
|
||||
</DESC>
|
||||
<FIELDS>
|
||||
<FIELD>
|
||||
<NAME>Speed</NAME>
|
||||
<PARAMNAME>WP_SPEED_MAX</PARAMNAME>
|
||||
<RANGEMIN>1</RANGEMIN>
|
||||
<RANGEMAX>30</RANGEMAX>
|
||||
<STEP>1</STEP>
|
||||
</FIELD>
|
||||
</FIELDS>
|
||||
</Item>
|
||||
<!-- Alt Hold -->
|
||||
<Item>
|
||||
<HEAD>Altitude Hold:</HEAD>
|
||||
<SUBHEAD>Altitude Error:</SUBHEAD>
|
||||
<DESC>
|
||||
How fast the copter should go to reach the correct altitude.
|
||||
</DESC>
|
||||
<FIELDS>
|
||||
<FIELD>
|
||||
<NAME>P</NAME>
|
||||
<PARAMNAME>THR_ALT_P</PARAMNAME>
|
||||
<RANGEMIN>0.001</RANGEMIN>
|
||||
<RANGEMAX>5</RANGEMAX>
|
||||
<STEP>0.001</STEP>
|
||||
</FIELD>
|
||||
<FIELD>
|
||||
<NAME>I</NAME>
|
||||
<PARAMNAME>THR_ALT_I</PARAMNAME>
|
||||
<RANGEMIN>0</RANGEMIN>
|
||||
<RANGEMAX>5</RANGEMAX>
|
||||
<STEP>0.001</STEP>
|
||||
</FIELD>
|
||||
<FIELD>
|
||||
<NAME>IMAX</NAME>
|
||||
<PARAMNAME>THR_ALT_IMAX</PARAMNAME>
|
||||
<RANGEMIN>0</RANGEMIN>
|
||||
<RANGEMAX>50</RANGEMAX>
|
||||
<STEP>0.1</STEP>
|
||||
</FIELD>
|
||||
</FIELDS>
|
||||
<SUBHEAD>Thrust Rate:</SUBHEAD>
|
||||
<DESC>
|
||||
How much thrust to give us the desired rate.
|
||||
|
||||
This will change depending on the weight and thrust of your copter.
|
||||
</DESC>
|
||||
<FIELDS>
|
||||
<FIELD>
|
||||
<NAME>P</NAME>
|
||||
<PARAMNAME>THR_RATE_P</PARAMNAME>
|
||||
<RANGEMIN>0.001</RANGEMIN>
|
||||
<RANGEMAX>5</RANGEMAX>
|
||||
<STEP>0.001</STEP>
|
||||
</FIELD>
|
||||
<FIELD>
|
||||
<NAME>I</NAME>
|
||||
<PARAMNAME>THR_RATE_I</PARAMNAME>
|
||||
<RANGEMIN>0</RANGEMIN>
|
||||
<RANGEMAX>5</RANGEMAX>
|
||||
<STEP>0.001</STEP>
|
||||
</FIELD>
|
||||
<FIELD>
|
||||
<NAME>D</NAME>
|
||||
<PARAMNAME>THR_RATE_D</PARAMNAME>
|
||||
<RANGEMIN>0</RANGEMIN>
|
||||
<RANGEMAX>5</RANGEMAX>
|
||||
<STEP>0.001</STEP>
|
||||
</FIELD>
|
||||
<FIELD>
|
||||
<NAME>IMAX</NAME>
|
||||
<PARAMNAME>THR_RATE_IMAX</PARAMNAME>
|
||||
<RANGEMIN>0</RANGEMIN>
|
||||
<RANGEMAX>50</RANGEMAX>
|
||||
<STEP>0.1</STEP>
|
||||
</FIELD>
|
||||
</FIELDS>
|
||||
</Item>
|
||||
</AC>
|
||||
|
|
Binary file not shown.
|
@ -1 +1 @@
|
|||
1.1.4494.38818
|
||||
1.1.4498.32482
|
|
@ -17,6 +17,7 @@ using log4net;
|
|||
|
||||
using System.Security.Permissions;
|
||||
using ArdupilotMega.Arduino;
|
||||
using ArdupilotMega.Utilities;
|
||||
|
||||
namespace ArdupilotMega
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue