mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-22 08:38:36 -04:00
APM Planner 1.1.62
3dr Radio support update mavlink library
This commit is contained in:
parent
127a990509
commit
762b1ea0df
@ -45,7 +45,7 @@
|
||||
<DefineConstants>TRACE;DEBUG;MAVLINK10cra</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
@ -61,7 +61,7 @@
|
||||
<DefineConstants>TRACE;DEBUG;MAVLINK10cra</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
@ -318,6 +318,7 @@
|
||||
<DependentUpon>Setup.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MagCalib.cs" />
|
||||
<Compile Include="Mavlink\MavlinkOther.cs" />
|
||||
<Compile Include="PIDTunning.cs" />
|
||||
<Compile Include="Radio\3DRradio.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
|
@ -49,13 +49,12 @@ namespace ArdupilotMega
|
||||
return answer;
|
||||
}
|
||||
|
||||
static ICodeCompiler CreateCompiler()
|
||||
static CodeDomProvider CreateCompiler()
|
||||
{
|
||||
//Create an instance of the C# compiler
|
||||
CodeDomProvider codeProvider = null;
|
||||
codeProvider = new CSharpCodeProvider();
|
||||
ICodeCompiler compiler = codeProvider.CreateCompiler();
|
||||
return compiler;
|
||||
CodeDomProvider codeProvider = CodeDomProvider.CreateProvider("CSharp");
|
||||
//ICodeCompiler compiler = codeProvider.CreateCompiler();
|
||||
return codeProvider;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -88,7 +87,7 @@ namespace ArdupilotMega
|
||||
/// <param name="parms"></param>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
static private CompilerResults CompileCode(ICodeCompiler compiler, CompilerParameters parms, string source)
|
||||
static private CompilerResults CompileCode(CodeDomProvider compiler, CompilerParameters parms, string source)
|
||||
{
|
||||
//actually compile the code
|
||||
CompilerResults results = compiler.CompileAssemblyFromSource(
|
||||
@ -144,7 +143,7 @@ namespace ArdupilotMega
|
||||
static private CompilerResults CompileAssembly()
|
||||
{
|
||||
// create a compiler
|
||||
ICodeCompiler compiler = CreateCompiler();
|
||||
CodeDomProvider compiler = CreateCompiler();
|
||||
// get all the compiler parameters
|
||||
CompilerParameters parms = CreateCompilerParameters();
|
||||
// compile the code into an assembly
|
||||
|
@ -448,7 +448,7 @@ namespace ArdupilotMega
|
||||
case (int)Common.apmmodes.LOITER:
|
||||
case (int)Common.apmmodes.FLY_BY_WIRE_A:
|
||||
case (int)Common.apmmodes.FLY_BY_WIRE_B:
|
||||
mode.base_mode = (byte)MAVLink.MAV_MODE_FLAG.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED;
|
||||
mode.base_mode = (byte)MAVLink.MAV_MODE_FLAG.CUSTOM_MODE_ENABLED;
|
||||
mode.custom_mode = (uint)(int)Enum.Parse(Common.getModes(), modein);
|
||||
break;
|
||||
default:
|
||||
@ -468,7 +468,7 @@ namespace ArdupilotMega
|
||||
case (int)Common.ac2modes.ALT_HOLD:
|
||||
case (int)Common.ac2modes.CIRCLE:
|
||||
case (int)Common.ac2modes.POSITION:
|
||||
mode.base_mode = (byte)MAVLink.MAV_MODE_FLAG.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED;
|
||||
mode.base_mode = (byte)MAVLink.MAV_MODE_FLAG.CUSTOM_MODE_ENABLED;
|
||||
mode.custom_mode = (uint)(int)Enum.Parse(Common.getModes(), modein);
|
||||
break;
|
||||
default:
|
||||
@ -576,7 +576,10 @@ namespace ArdupilotMega
|
||||
try
|
||||
{
|
||||
// this is for mono to a ssl server
|
||||
ServicePointManager.CertificatePolicy = new NoCheckCertificatePolicy();
|
||||
//ServicePointManager.CertificatePolicy = new NoCheckCertificatePolicy();
|
||||
|
||||
ServicePointManager.ServerCertificateValidationCallback =
|
||||
new System.Net.Security.RemoteCertificateValidationCallback((sender, certificate, chain, policyErrors) => { return true; });
|
||||
|
||||
// Create a request using a URL that can receive a post.
|
||||
WebRequest request = WebRequest.Create(url);
|
||||
|
@ -385,9 +385,9 @@ namespace ArdupilotMega
|
||||
|
||||
mode = "Unknown";
|
||||
|
||||
if ((hb.base_mode & (byte)MAVLink.MAV_MODE_FLAG.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED) != 0)
|
||||
if ((hb.base_mode & (byte)MAVLink.MAV_MODE_FLAG.CUSTOM_MODE_ENABLED) != 0)
|
||||
{
|
||||
if (hb.type == (byte)MAVLink.MAV_TYPE.MAV_TYPE_FIXED_WING)
|
||||
if (hb.type == (byte)MAVLink.MAV_TYPE.FIXED_WING)
|
||||
{
|
||||
switch (hb.custom_mode)
|
||||
{
|
||||
@ -423,7 +423,7 @@ namespace ArdupilotMega
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (hb.type == (byte)MAVLink.MAV_TYPE.MAV_TYPE_QUADROTOR)
|
||||
else if (hb.type == (byte)MAVLink.MAV_TYPE.QUADROTOR)
|
||||
{
|
||||
switch (hb.custom_mode)
|
||||
{
|
||||
@ -461,9 +461,9 @@ namespace ArdupilotMega
|
||||
}
|
||||
}
|
||||
|
||||
if (oldmode != mode && MainV2.speechenable && MainV2.getConfig("speechmodeenabled") == "True")
|
||||
if (oldmode != mode && MainV2.speechEnable && MainV2.getConfig("speechmodeenabled") == "True")
|
||||
{
|
||||
MainV2.talk.SpeakAsync(Common.speechConversion(MainV2.getConfig("speechmode")));
|
||||
MainV2.speechEngine.SpeakAsync(Common.speechConversion(MainV2.getConfig("speechmode")));
|
||||
}
|
||||
}
|
||||
|
||||
@ -726,9 +726,9 @@ namespace ArdupilotMega
|
||||
|
||||
wpno = wpcur.seq;
|
||||
|
||||
if (oldwp != wpno && MainV2.speechenable && MainV2.getConfig("speechwaypointenabled") == "True")
|
||||
if (oldwp != wpno && MainV2.speechEnable && MainV2.getConfig("speechwaypointenabled") == "True")
|
||||
{
|
||||
MainV2.talk.SpeakAsync(Common.speechConversion(MainV2.getConfig("speechwaypoint")));
|
||||
MainV2.speechEngine.SpeakAsync(Common.speechConversion(MainV2.getConfig("speechwaypoint")));
|
||||
}
|
||||
|
||||
//MAVLink.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_WAYPOINT_CURRENT] = null;
|
||||
|
@ -579,7 +579,6 @@ namespace ArdupilotMega.GCSViews
|
||||
}
|
||||
}
|
||||
catch { ((Control)text[0]).BackColor = Color.Red; }
|
||||
|
||||
Params.Focus();
|
||||
}
|
||||
|
||||
@ -712,13 +711,6 @@ namespace ArdupilotMega.GCSViews
|
||||
{
|
||||
if (ConfigTabs.SelectedTab == TabSetup)
|
||||
{
|
||||
if (!MainV2.comPort.BaseStream.IsOpen)
|
||||
{
|
||||
CustomMessageBox.Show("Please Connect First");
|
||||
ConfigTabs.SelectedIndex = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
GCSViews.ConfigurationView.Setup temp = new GCSViews.ConfigurationView.Setup();
|
||||
|
||||
@ -729,7 +721,6 @@ namespace ArdupilotMega.GCSViews
|
||||
startup = true;
|
||||
processToScreen();
|
||||
startup = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1106,7 +1097,7 @@ namespace ArdupilotMega.GCSViews
|
||||
{
|
||||
param2 = loadParamFile(ofd.FileName);
|
||||
|
||||
ParamCompare temp = new ParamCompare(this, param, param2);
|
||||
ParamCompare temp = new ParamCompare(Params, param, param2);
|
||||
ThemeManager.ApplyThemeTo(temp);
|
||||
temp.ShowDialog();
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.myLabel3 = new ArdupilotMega.MyLabel();
|
||||
this.TUNE_LOW = new System.Windows.Forms.NumericUpDown();
|
||||
this.TUNE_HIGH = new System.Windows.Forms.NumericUpDown();
|
||||
@ -123,6 +124,7 @@
|
||||
this.label90 = new System.Windows.Forms.Label();
|
||||
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);
|
||||
((System.ComponentModel.ISupportInitialize)(this.TUNE_LOW)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.TUNE_HIGH)).BeginInit();
|
||||
this.groupBox5.SuspendLayout();
|
||||
@ -1090,6 +1092,7 @@
|
||||
this.Controls.Add(this.groupBox25);
|
||||
this.Name = "ConfigArducopter";
|
||||
this.Size = new System.Drawing.Size(728, 393);
|
||||
this.Load += new System.EventHandler(this.ConfigArducopter_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.TUNE_LOW)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.TUNE_HIGH)).EndInit();
|
||||
this.groupBox5.ResumeLayout(false);
|
||||
@ -1243,5 +1246,6 @@
|
||||
private System.Windows.Forms.Label label90;
|
||||
private System.Windows.Forms.NumericUpDown RATE_RLL_P;
|
||||
private System.Windows.Forms.Label label91;
|
||||
private System.Windows.Forms.ToolTip toolTip1;
|
||||
}
|
||||
}
|
||||
|
@ -7,14 +7,343 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using ArdupilotMega.Controls.BackstageView;
|
||||
using System.Collections;
|
||||
|
||||
namespace ArdupilotMega.GCSViews.ConfigurationView
|
||||
{
|
||||
public partial class ConfigArducopter : BackStageViewContentPanel
|
||||
{
|
||||
Hashtable changes = new Hashtable();
|
||||
static Hashtable tooltips = new Hashtable();
|
||||
internal bool startup = true;
|
||||
|
||||
|
||||
public ConfigArducopter()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public struct paramsettings // hk's
|
||||
{
|
||||
public string name;
|
||||
public float minvalue;
|
||||
public float maxvalue;
|
||||
public float normalvalue;
|
||||
public float scale;
|
||||
public string desc;
|
||||
}
|
||||
|
||||
private void ConfigArducopter_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!MainV2.comPort.BaseStream.IsOpen)
|
||||
{
|
||||
this.Enabled = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2)
|
||||
{
|
||||
this.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Enabled = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
startup = true;
|
||||
|
||||
changes.Clear();
|
||||
|
||||
// read tooltips
|
||||
if (tooltips.Count == 0)
|
||||
readToolTips();
|
||||
|
||||
// ensure the fields are populated before setting them
|
||||
CH7_OPT.DataSource = Enum.GetNames(typeof(Common.ac2ch7modes));
|
||||
TUNE.DataSource = Enum.GetNames(typeof(Common.ac2ch6modes));
|
||||
|
||||
// prefill all fields
|
||||
processToScreen();
|
||||
|
||||
startup = false;
|
||||
}
|
||||
|
||||
void readToolTips()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Configuration));
|
||||
|
||||
string data = resources.GetString("MAVParam");
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = global::ArdupilotMega.Properties.Resources.MAVParam;
|
||||
}
|
||||
|
||||
string[] tips = data.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
foreach (var tip in tips)
|
||||
{
|
||||
if (!tip.StartsWith("||"))
|
||||
continue;
|
||||
|
||||
string[] cols = tip.Split(new string[] { "||" }, 9, StringSplitOptions.None);
|
||||
|
||||
if (cols.Length >= 8)
|
||||
{
|
||||
paramsettings param = new paramsettings();
|
||||
try
|
||||
{
|
||||
param.name = cols[1];
|
||||
param.desc = AddNewLinesForTooltip(cols[7]);
|
||||
param.scale = float.Parse(cols[5]);
|
||||
param.minvalue = float.Parse(cols[2]);
|
||||
param.maxvalue = float.Parse(cols[3]);
|
||||
param.normalvalue = float.Parse(cols[4]);
|
||||
}
|
||||
catch { }
|
||||
tooltips[cols[1]] = param;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// from http://stackoverflow.com/questions/2512781/winforms-big-paragraph-tooltip/2512895#2512895
|
||||
private const int maximumSingleLineTooltipLength = 50;
|
||||
|
||||
private static string AddNewLinesForTooltip(string text)
|
||||
{
|
||||
if (text.Length < maximumSingleLineTooltipLength)
|
||||
return text;
|
||||
int lineLength = (int)Math.Sqrt((double)text.Length) * 2;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int currentLinePosition = 0;
|
||||
for (int textIndex = 0; textIndex < text.Length; textIndex++)
|
||||
{
|
||||
// If we have reached the target line length and the next
|
||||
// character is whitespace then begin a new line.
|
||||
if (currentLinePosition >= lineLength &&
|
||||
char.IsWhiteSpace(text[textIndex]))
|
||||
{
|
||||
sb.Append(Environment.NewLine);
|
||||
currentLinePosition = 0;
|
||||
}
|
||||
// If we have just started a new line, skip all the whitespace.
|
||||
if (currentLinePosition == 0)
|
||||
while (textIndex < text.Length && char.IsWhiteSpace(text[textIndex]))
|
||||
textIndex++;
|
||||
// Append the next character.
|
||||
if (textIndex < text.Length) sb.Append(text[textIndex]);
|
||||
currentLinePosition++;
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
void disableNumericUpDownControls(Control inctl)
|
||||
{
|
||||
foreach (Control ctl in inctl.Controls)
|
||||
{
|
||||
if (ctl.Controls.Count > 0)
|
||||
{
|
||||
disableNumericUpDownControls(ctl);
|
||||
}
|
||||
if (ctl.GetType() == typeof(NumericUpDown))
|
||||
{
|
||||
ctl.Enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void processToScreen()
|
||||
{
|
||||
toolTip1.RemoveAll();
|
||||
|
||||
disableNumericUpDownControls(this);
|
||||
|
||||
|
||||
// process hashdefines and update display
|
||||
foreach (string value in MainV2.comPort.param.Keys)
|
||||
{
|
||||
if (value == null || value == "")
|
||||
continue;
|
||||
|
||||
//System.Diagnostics.Debug.WriteLine("Doing: " + value);
|
||||
|
||||
|
||||
string name = value;
|
||||
Control[] text = this.Controls.Find(name, true);
|
||||
foreach (Control ctl in text)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ctl.GetType() == typeof(NumericUpDown))
|
||||
{
|
||||
|
||||
NumericUpDown thisctl = ((NumericUpDown)ctl);
|
||||
thisctl.Maximum = 9000;
|
||||
thisctl.Minimum = -9000;
|
||||
thisctl.Value = (decimal)(float)MainV2.comPort.param[value];
|
||||
thisctl.Increment = (decimal)0.001;
|
||||
if (thisctl.Name.EndsWith("_P") || thisctl.Name.EndsWith("_I") || thisctl.Name.EndsWith("_D")
|
||||
|| thisctl.Name.EndsWith("_LOW") || thisctl.Name.EndsWith("_HIGH") || thisctl.Value == 0
|
||||
|| thisctl.Value.ToString("0.###", new System.Globalization.CultureInfo("en-US")).Contains("."))
|
||||
{
|
||||
thisctl.DecimalPlaces = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
thisctl.Increment = (decimal)1;
|
||||
thisctl.DecimalPlaces = 1;
|
||||
}
|
||||
|
||||
if (thisctl.Name.EndsWith("_IMAX"))
|
||||
{
|
||||
thisctl.Maximum = 180;
|
||||
thisctl.Minimum = -180;
|
||||
}
|
||||
|
||||
thisctl.Enabled = true;
|
||||
|
||||
thisctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
|
||||
thisctl.Validated += null;
|
||||
if (tooltips[value] != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
toolTip1.SetToolTip(ctl, ((paramsettings)tooltips[value]).desc);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
thisctl.Validated += new EventHandler(EEPROM_View_float_TextChanged);
|
||||
|
||||
}
|
||||
else if (ctl.GetType() == typeof(ComboBox))
|
||||
{
|
||||
|
||||
ComboBox thisctl = ((ComboBox)ctl);
|
||||
|
||||
thisctl.SelectedIndex = (int)(float)MainV2.comPort.param[value];
|
||||
|
||||
thisctl.Validated += new EventHandler(ComboBox_Validated);
|
||||
|
||||
thisctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
}
|
||||
if (text.Length == 0)
|
||||
{
|
||||
//Console.WriteLine(name + " not found");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void ComboBox_Validated(object sender, EventArgs e)
|
||||
{
|
||||
EEPROM_View_float_TextChanged(sender, e);
|
||||
}
|
||||
|
||||
void Configuration_Validating(object sender, CancelEventArgs e)
|
||||
{
|
||||
EEPROM_View_float_TextChanged(sender, e);
|
||||
}
|
||||
|
||||
internal void EEPROM_View_float_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (startup == true)
|
||||
return;
|
||||
|
||||
float value = 0;
|
||||
string name = ((Control)sender).Name;
|
||||
|
||||
// do domainupdown state check
|
||||
try
|
||||
{
|
||||
if (sender.GetType() == typeof(NumericUpDown))
|
||||
{
|
||||
value = float.Parse(((Control)sender).Text);
|
||||
changes[name] = value;
|
||||
}
|
||||
else if (sender.GetType() == typeof(ComboBox))
|
||||
{
|
||||
value = ((ComboBox)sender).SelectedIndex;
|
||||
changes[name] = value;
|
||||
}
|
||||
((Control)sender).BackColor = Color.Green;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
((Control)sender).BackColor = Color.Red;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// enable roll and pitch pairing for ac2
|
||||
if (CHK_lockrollpitch.Checked)
|
||||
{
|
||||
if (name.StartsWith("RATE_") || name.StartsWith("STB_") || name.StartsWith("ACRO_"))
|
||||
{
|
||||
if (name.Contains("_RLL_"))
|
||||
{
|
||||
string newname = name.Replace("_RLL_", "_PIT_");
|
||||
Control[] arr = this.Controls.Find(newname, true);
|
||||
changes[newname] = float.Parse(((Control)sender).Text);
|
||||
|
||||
if (arr.Length > 0)
|
||||
{
|
||||
arr[0].Text = ((Control)sender).Text;
|
||||
arr[0].BackColor = Color.Green;
|
||||
}
|
||||
|
||||
}
|
||||
else if (name.Contains("_PIT_"))
|
||||
{
|
||||
string newname = name.Replace("_PIT_", "_RLL_");
|
||||
Control[] arr = this.Controls.Find(newname, true);
|
||||
changes[newname] = float.Parse(((Control)sender).Text);
|
||||
|
||||
if (arr.Length > 0)
|
||||
{
|
||||
arr[0].Text = ((Control)sender).Text;
|
||||
arr[0].BackColor = Color.Green;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// keep nav_lat and nav_lon paired
|
||||
if (name.Contains("NAV_LAT_"))
|
||||
{
|
||||
string newname = name.Replace("NAV_LAT_", "NAV_LON_");
|
||||
Control[] arr = this.Controls.Find(newname, true);
|
||||
changes[newname] = float.Parse(((Control)sender).Text);
|
||||
|
||||
if (arr.Length > 0)
|
||||
{
|
||||
arr[0].Text = ((Control)sender).Text;
|
||||
arr[0].BackColor = Color.Green;
|
||||
}
|
||||
}
|
||||
// keep nav_lat and nav_lon paired
|
||||
if (name.Contains("HLD_LAT_"))
|
||||
{
|
||||
string newname = name.Replace("HLD_LAT_", "HLD_LON_");
|
||||
Control[] arr = this.Controls.Find(newname, true);
|
||||
changes[newname] = float.Parse(((Control)sender).Text);
|
||||
|
||||
if (arr.Length > 0)
|
||||
{
|
||||
arr[0].Text = ((Control)sender).Text;
|
||||
arr[0].BackColor = Color.Green;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -117,4 +117,7 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
@ -28,6 +28,7 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.THR_FS_VALUE = new System.Windows.Forms.NumericUpDown();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
@ -128,6 +129,7 @@
|
||||
this.label51 = new System.Windows.Forms.Label();
|
||||
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.groupBox3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.THR_FS_VALUE)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.THR_MAX)).BeginInit();
|
||||
@ -1104,6 +1106,7 @@
|
||||
this.Controls.Add(this.groupBox8);
|
||||
this.Name = "ConfigArduplane";
|
||||
this.Size = new System.Drawing.Size(621, 456);
|
||||
this.Load += new System.EventHandler(this.ConfigArduplane_Load);
|
||||
this.groupBox3.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.THR_FS_VALUE)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.THR_MAX)).EndInit();
|
||||
@ -1266,5 +1269,6 @@
|
||||
private System.Windows.Forms.Label label51;
|
||||
private System.Windows.Forms.NumericUpDown RLL2SRV_P;
|
||||
private System.Windows.Forms.Label label52;
|
||||
private System.Windows.Forms.ToolTip toolTip1;
|
||||
}
|
||||
}
|
||||
|
@ -7,14 +7,265 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using ArdupilotMega.Controls.BackstageView;
|
||||
using System.Collections;
|
||||
|
||||
namespace ArdupilotMega.GCSViews.ConfigurationView
|
||||
{
|
||||
public partial class ConfigArduplane : BackStageViewContentPanel
|
||||
{
|
||||
Hashtable changes = new Hashtable();
|
||||
static Hashtable tooltips = new Hashtable();
|
||||
internal bool startup = true;
|
||||
|
||||
public ConfigArduplane()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ConfigArduplane_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!MainV2.comPort.BaseStream.IsOpen)
|
||||
{
|
||||
this.Enabled = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane)
|
||||
{
|
||||
this.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Enabled = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
startup = true;
|
||||
|
||||
changes.Clear();
|
||||
|
||||
// read tooltips
|
||||
if (tooltips.Count == 0)
|
||||
readToolTips();
|
||||
|
||||
processToScreen();
|
||||
|
||||
startup = false;
|
||||
}
|
||||
|
||||
public struct paramsettings // hk's
|
||||
{
|
||||
public string name;
|
||||
public float minvalue;
|
||||
public float maxvalue;
|
||||
public float normalvalue;
|
||||
public float scale;
|
||||
public string desc;
|
||||
}
|
||||
|
||||
void readToolTips()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Configuration));
|
||||
|
||||
string data = resources.GetString("MAVParam");
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = global::ArdupilotMega.Properties.Resources.MAVParam;
|
||||
}
|
||||
|
||||
string[] tips = data.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
foreach (var tip in tips)
|
||||
{
|
||||
if (!tip.StartsWith("||"))
|
||||
continue;
|
||||
|
||||
string[] cols = tip.Split(new string[] { "||" }, 9, StringSplitOptions.None);
|
||||
|
||||
if (cols.Length >= 8)
|
||||
{
|
||||
paramsettings param = new paramsettings();
|
||||
try
|
||||
{
|
||||
param.name = cols[1];
|
||||
param.desc = AddNewLinesForTooltip(cols[7]);
|
||||
param.scale = float.Parse(cols[5]);
|
||||
param.minvalue = float.Parse(cols[2]);
|
||||
param.maxvalue = float.Parse(cols[3]);
|
||||
param.normalvalue = float.Parse(cols[4]);
|
||||
}
|
||||
catch { }
|
||||
tooltips[cols[1]] = param;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// from http://stackoverflow.com/questions/2512781/winforms-big-paragraph-tooltip/2512895#2512895
|
||||
private const int maximumSingleLineTooltipLength = 50;
|
||||
|
||||
private static string AddNewLinesForTooltip(string text)
|
||||
{
|
||||
if (text.Length < maximumSingleLineTooltipLength)
|
||||
return text;
|
||||
int lineLength = (int)Math.Sqrt((double)text.Length) * 2;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int currentLinePosition = 0;
|
||||
for (int textIndex = 0; textIndex < text.Length; textIndex++)
|
||||
{
|
||||
// If we have reached the target line length and the next
|
||||
// character is whitespace then begin a new line.
|
||||
if (currentLinePosition >= lineLength &&
|
||||
char.IsWhiteSpace(text[textIndex]))
|
||||
{
|
||||
sb.Append(Environment.NewLine);
|
||||
currentLinePosition = 0;
|
||||
}
|
||||
// If we have just started a new line, skip all the whitespace.
|
||||
if (currentLinePosition == 0)
|
||||
while (textIndex < text.Length && char.IsWhiteSpace(text[textIndex]))
|
||||
textIndex++;
|
||||
// Append the next character.
|
||||
if (textIndex < text.Length) sb.Append(text[textIndex]);
|
||||
currentLinePosition++;
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
void disableNumericUpDownControls(Control inctl)
|
||||
{
|
||||
foreach (Control ctl in inctl.Controls)
|
||||
{
|
||||
if (ctl.Controls.Count > 0)
|
||||
{
|
||||
disableNumericUpDownControls(ctl);
|
||||
}
|
||||
if (ctl.GetType() == typeof(NumericUpDown))
|
||||
{
|
||||
ctl.Enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void processToScreen()
|
||||
{
|
||||
toolTip1.RemoveAll();
|
||||
|
||||
disableNumericUpDownControls(this);
|
||||
|
||||
// process hashdefines and update display
|
||||
foreach (string value in MainV2.comPort.param.Keys)
|
||||
{
|
||||
if (value == null || value == "")
|
||||
continue;
|
||||
|
||||
string name = value;
|
||||
Control[] text = this.Controls.Find(name, true);
|
||||
foreach (Control ctl in text)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ctl.GetType() == typeof(NumericUpDown))
|
||||
{
|
||||
|
||||
NumericUpDown thisctl = ((NumericUpDown)ctl);
|
||||
thisctl.Maximum = 9000;
|
||||
thisctl.Minimum = -9000;
|
||||
thisctl.Value = (decimal)(float)MainV2.comPort.param[value];
|
||||
thisctl.Increment = (decimal)0.001;
|
||||
if (thisctl.Name.EndsWith("_P") || thisctl.Name.EndsWith("_I") || thisctl.Name.EndsWith("_D")
|
||||
|| thisctl.Name.EndsWith("_LOW") || thisctl.Name.EndsWith("_HIGH") || thisctl.Value == 0
|
||||
|| thisctl.Value.ToString("0.###", new System.Globalization.CultureInfo("en-US")).Contains("."))
|
||||
{
|
||||
thisctl.DecimalPlaces = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
thisctl.Increment = (decimal)1;
|
||||
thisctl.DecimalPlaces = 1;
|
||||
}
|
||||
|
||||
if (thisctl.Name.EndsWith("_IMAX"))
|
||||
{
|
||||
thisctl.Maximum = 180;
|
||||
thisctl.Minimum = -180;
|
||||
}
|
||||
|
||||
thisctl.Enabled = true;
|
||||
|
||||
thisctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
|
||||
thisctl.Validated += null;
|
||||
if (tooltips[value] != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
toolTip1.SetToolTip(ctl, ((paramsettings)tooltips[value]).desc);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
thisctl.Validated += new EventHandler(EEPROM_View_float_TextChanged);
|
||||
|
||||
}
|
||||
else if (ctl.GetType() == typeof(ComboBox))
|
||||
{
|
||||
|
||||
ComboBox thisctl = ((ComboBox)ctl);
|
||||
|
||||
thisctl.SelectedIndex = (int)(float)MainV2.comPort.param[value];
|
||||
|
||||
thisctl.Validated += new EventHandler(ComboBox_Validated);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
}
|
||||
if (text.Length == 0)
|
||||
{
|
||||
//Console.WriteLine(name + " not found");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void ComboBox_Validated(object sender, EventArgs e)
|
||||
{
|
||||
EEPROM_View_float_TextChanged(sender, e);
|
||||
}
|
||||
|
||||
void Configuration_Validating(object sender, CancelEventArgs e)
|
||||
{
|
||||
EEPROM_View_float_TextChanged(sender, e);
|
||||
}
|
||||
|
||||
internal void EEPROM_View_float_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
float value = 0;
|
||||
string name = ((Control)sender).Name;
|
||||
|
||||
// do domainupdown state check
|
||||
try
|
||||
{
|
||||
if (sender.GetType() == typeof(NumericUpDown))
|
||||
{
|
||||
value = float.Parse(((Control)sender).Text);
|
||||
changes[name] = value;
|
||||
}
|
||||
else if (sender.GetType() == typeof(ComboBox))
|
||||
{
|
||||
value = ((ComboBox)sender).SelectedIndex;
|
||||
changes[name] = value;
|
||||
}
|
||||
((Control)sender).BackColor = Color.Green;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
((Control)sender).BackColor = Color.Red;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -117,4 +117,7 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
@ -32,7 +32,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
|
||||
|
||||
MainV2.cs.ratesensors = 10;
|
||||
|
||||
MainV2.comPort.requestDatastream((byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_SENSORS, MainV2.cs.ratesensors); // mag captures at 10 hz
|
||||
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");
|
||||
|
||||
|
@ -115,7 +115,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
|
||||
try
|
||||
{
|
||||
|
||||
MainV2.comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RC_CHANNELS, 10);
|
||||
MainV2.comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RC_CHANNELS, 10);
|
||||
|
||||
}
|
||||
catch { }
|
||||
@ -229,7 +229,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
|
||||
try
|
||||
{
|
||||
|
||||
MainV2.comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RC_CHANNELS, oldrc);
|
||||
MainV2.comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RC_CHANNELS, oldrc);
|
||||
|
||||
}
|
||||
catch { }
|
||||
|
@ -28,6 +28,7 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.BUT_compare = new ArdupilotMega.MyButton();
|
||||
@ -41,11 +42,13 @@
|
||||
this.Default = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.mavScale = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.RawValue = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||
((System.ComponentModel.ISupportInitialize)(this.Params)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// BUT_compare
|
||||
//
|
||||
this.BUT_compare.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.BUT_compare.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.BUT_compare.Location = new System.Drawing.Point(341, 119);
|
||||
this.BUT_compare.Name = "BUT_compare";
|
||||
@ -57,6 +60,7 @@
|
||||
//
|
||||
// BUT_rerequestparams
|
||||
//
|
||||
this.BUT_rerequestparams.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.BUT_rerequestparams.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.BUT_rerequestparams.Location = new System.Drawing.Point(341, 94);
|
||||
this.BUT_rerequestparams.Name = "BUT_rerequestparams";
|
||||
@ -68,6 +72,7 @@
|
||||
//
|
||||
// BUT_writePIDS
|
||||
//
|
||||
this.BUT_writePIDS.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.BUT_writePIDS.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.BUT_writePIDS.Location = new System.Drawing.Point(341, 69);
|
||||
this.BUT_writePIDS.Name = "BUT_writePIDS";
|
||||
@ -79,6 +84,7 @@
|
||||
//
|
||||
// BUT_save
|
||||
//
|
||||
this.BUT_save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.BUT_save.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.BUT_save.Location = new System.Drawing.Point(341, 35);
|
||||
this.BUT_save.Margin = new System.Windows.Forms.Padding(0);
|
||||
@ -91,6 +97,7 @@
|
||||
//
|
||||
// BUT_load
|
||||
//
|
||||
this.BUT_load.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.BUT_load.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.BUT_load.Location = new System.Drawing.Point(341, 7);
|
||||
this.BUT_load.Margin = new System.Windows.Forms.Padding(0);
|
||||
@ -105,8 +112,9 @@
|
||||
//
|
||||
this.Params.AllowUserToAddRows = false;
|
||||
this.Params.AllowUserToDeleteRows = false;
|
||||
this.Params.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.Params.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle1.BackColor = System.Drawing.Color.Maroon;
|
||||
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
@ -136,6 +144,7 @@
|
||||
this.Params.RowHeadersWidth = 150;
|
||||
this.Params.Size = new System.Drawing.Size(321, 302);
|
||||
this.Params.TabIndex = 68;
|
||||
this.Params.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.Params_CellValueChanged);
|
||||
//
|
||||
// Command
|
||||
//
|
||||
@ -181,8 +190,6 @@
|
||||
this.Name = "ConfigRawParams";
|
||||
this.Size = new System.Drawing.Size(460, 305);
|
||||
this.Load += new System.EventHandler(this.ConfigRawParams_Load);
|
||||
this.ControlAdded += new System.Windows.Forms.ControlEventHandler(this.ConfigRawParams_ControlAdded);
|
||||
this.ControlRemoved += new System.Windows.Forms.ControlEventHandler(this.ConfigRawParams_ControlRemoved);
|
||||
((System.ComponentModel.ISupportInitialize)(this.Params)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
@ -201,5 +208,6 @@
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Default;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn mavScale;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn RawValue;
|
||||
private System.Windows.Forms.ToolTip toolTip1;
|
||||
}
|
||||
}
|
||||
|
@ -21,9 +21,21 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
|
||||
// Changes made to the params between writing to the copter
|
||||
readonly Hashtable _changes = new Hashtable();
|
||||
|
||||
static Hashtable tooltips = new Hashtable();
|
||||
|
||||
// ?
|
||||
internal bool startup = true;
|
||||
|
||||
public struct paramsettings // hk's
|
||||
{
|
||||
public string name;
|
||||
public float minvalue;
|
||||
public float maxvalue;
|
||||
public float normalvalue;
|
||||
public float scale;
|
||||
public string desc;
|
||||
}
|
||||
|
||||
|
||||
public ConfigRawParams()
|
||||
{
|
||||
@ -234,11 +246,10 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
|
||||
{
|
||||
param2 = loadParamFile(ofd.FileName);
|
||||
|
||||
int fixme;
|
||||
//var paramCompareForm = new ParamCompare((Form)this, MainV2.comPort.param, param2);
|
||||
Form paramCompareForm = new ParamCompare(Params, MainV2.comPort.param, param2);
|
||||
|
||||
//ThemeManager.ApplyThemeTo(paramCompareForm);
|
||||
//paramCompareForm.ShowDialog();
|
||||
ThemeManager.ApplyThemeTo(paramCompareForm);
|
||||
paramCompareForm.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
@ -264,25 +275,155 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
|
||||
((Control)sender).Enabled = true;
|
||||
|
||||
startup = true;
|
||||
|
||||
processToScreen();
|
||||
|
||||
startup = false;
|
||||
|
||||
// Todo: this populates or the combos etc and what not. This shoudl prob be a bsv button
|
||||
|
||||
}
|
||||
|
||||
void Params_CellValueChanged(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.RowIndex == -1 || e.ColumnIndex == -1 || startup == true || e.ColumnIndex != 1)
|
||||
return;
|
||||
try
|
||||
{
|
||||
if (Params[Command.Index, e.RowIndex].Value.ToString().EndsWith("_REV") && (Params[Command.Index, e.RowIndex].Value.ToString().StartsWith("RC") || Params[Command.Index, e.RowIndex].Value.ToString().StartsWith("HS")))
|
||||
{
|
||||
if (Params[e.ColumnIndex, e.RowIndex].Value.ToString() == "0")
|
||||
Params[e.ColumnIndex, e.RowIndex].Value = "-1";
|
||||
}
|
||||
|
||||
Params[e.ColumnIndex, e.RowIndex].Style.BackColor = Color.Green;
|
||||
_changes[Params[0, e.RowIndex].Value] = float.Parse(Params[e.ColumnIndex, e.RowIndex].Value.ToString());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Params[e.ColumnIndex, e.RowIndex].Style.BackColor = Color.Red;
|
||||
}
|
||||
|
||||
|
||||
Params.Focus();
|
||||
}
|
||||
|
||||
void readToolTips()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Configuration));
|
||||
|
||||
string data = resources.GetString("MAVParam");
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
data = global::ArdupilotMega.Properties.Resources.MAVParam;
|
||||
}
|
||||
|
||||
string[] tips = data.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
foreach (var tip in tips)
|
||||
{
|
||||
if (!tip.StartsWith("||"))
|
||||
continue;
|
||||
|
||||
string[] cols = tip.Split(new string[] { "||" }, 9, StringSplitOptions.None);
|
||||
|
||||
if (cols.Length >= 8)
|
||||
{
|
||||
paramsettings param = new paramsettings();
|
||||
try
|
||||
{
|
||||
param.name = cols[1];
|
||||
param.desc = AddNewLinesForTooltip(cols[7]);
|
||||
param.scale = float.Parse(cols[5]);
|
||||
param.minvalue = float.Parse(cols[2]);
|
||||
param.maxvalue = float.Parse(cols[3]);
|
||||
param.normalvalue = float.Parse(cols[4]);
|
||||
}
|
||||
catch { }
|
||||
tooltips[cols[1]] = param;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// from http://stackoverflow.com/questions/2512781/winforms-big-paragraph-tooltip/2512895#2512895
|
||||
private const int maximumSingleLineTooltipLength = 50;
|
||||
|
||||
private static string AddNewLinesForTooltip(string text)
|
||||
{
|
||||
if (text.Length < maximumSingleLineTooltipLength)
|
||||
return text;
|
||||
int lineLength = (int)Math.Sqrt((double)text.Length) * 2;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int currentLinePosition = 0;
|
||||
for (int textIndex = 0; textIndex < text.Length; textIndex++)
|
||||
{
|
||||
// If we have reached the target line length and the next
|
||||
// character is whitespace then begin a new line.
|
||||
if (currentLinePosition >= lineLength &&
|
||||
char.IsWhiteSpace(text[textIndex]))
|
||||
{
|
||||
sb.Append(Environment.NewLine);
|
||||
currentLinePosition = 0;
|
||||
}
|
||||
// If we have just started a new line, skip all the whitespace.
|
||||
if (currentLinePosition == 0)
|
||||
while (textIndex < text.Length && char.IsWhiteSpace(text[textIndex]))
|
||||
textIndex++;
|
||||
// Append the next character.
|
||||
if (textIndex < text.Length) sb.Append(text[textIndex]);
|
||||
currentLinePosition++;
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
internal void processToScreen()
|
||||
{
|
||||
toolTip1.RemoveAll();
|
||||
Params.Rows.Clear();
|
||||
|
||||
// process hashdefines and update display
|
||||
foreach (string value in MainV2.comPort.param.Keys)
|
||||
{
|
||||
if (value == null || value == "")
|
||||
continue;
|
||||
|
||||
//System.Diagnostics.Debug.WriteLine("Doing: " + value);
|
||||
|
||||
Params.Rows.Add();
|
||||
Params.Rows[Params.RowCount - 1].Cells[Command.Index].Value = value;
|
||||
Params.Rows[Params.RowCount - 1].Cells[Value.Index].Value = ((float)MainV2.comPort.param[value]).ToString("0.###");
|
||||
try
|
||||
{
|
||||
if (tooltips[value] != null)
|
||||
{
|
||||
Params.Rows[Params.RowCount - 1].Cells[Command.Index].ToolTipText = ((paramsettings)tooltips[value]).desc;
|
||||
//Params.Rows[Params.RowCount - 1].Cells[RawValue.Index].ToolTipText = ((paramsettings)tooltips[value]).desc;
|
||||
Params.Rows[Params.RowCount - 1].Cells[Value.Index].ToolTipText = ((paramsettings)tooltips[value]).desc;
|
||||
|
||||
//Params.Rows[Params.RowCount - 1].Cells[Default.Index].Value = ((paramsettings)tooltips[value]).normalvalue;
|
||||
//Params.Rows[Params.RowCount - 1].Cells[mavScale.Index].Value = ((paramsettings)tooltips[value]).scale;
|
||||
//Params.Rows[Params.RowCount - 1].Cells[Value.Index].Value = float.Parse(Params.Rows[Params.RowCount - 1].Cells[RawValue.Index].Value.ToString()) / float.Parse(Params.Rows[Params.RowCount - 1].Cells[mavScale.Index].Value.ToString());
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
}
|
||||
Params.Sort(Params.Columns[0], ListSortDirection.Ascending);
|
||||
}
|
||||
|
||||
private void ConfigRawParams_Load(object sender, EventArgs e)
|
||||
{
|
||||
// read tooltips
|
||||
if (tooltips.Count == 0)
|
||||
readToolTips();
|
||||
|
||||
startup = true;
|
||||
|
||||
processToScreen();
|
||||
|
||||
startup = false;
|
||||
}
|
||||
|
||||
private void ConfigRawParams_ControlRemoved(object sender, ControlEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void ConfigRawParams_ControlAdded(object sender, ControlEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -129,4 +129,7 @@
|
||||
<metadata name="RawValue.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
@ -47,6 +47,7 @@
|
||||
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();
|
||||
|
||||
|
@ -23,9 +23,14 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
|
||||
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigAccelerometerCalibration(), "Level Calibration"));
|
||||
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 ConfigArduplane(), "Heli 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,20 +29,9 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Setup));
|
||||
this.lbl_pleaseconnect = new System.Windows.Forms.Label();
|
||||
this.backstageView = new ArdupilotMega.Controls.BackstageView.BackstageView();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lbl_pleaseconnect
|
||||
//
|
||||
this.lbl_pleaseconnect.AutoSize = true;
|
||||
this.lbl_pleaseconnect.Location = new System.Drawing.Point(297, 284);
|
||||
this.lbl_pleaseconnect.Name = "lbl_pleaseconnect";
|
||||
this.lbl_pleaseconnect.Size = new System.Drawing.Size(104, 13);
|
||||
this.lbl_pleaseconnect.TabIndex = 1;
|
||||
this.lbl_pleaseconnect.Text = "Please Connect First";
|
||||
this.lbl_pleaseconnect.Visible = false;
|
||||
//
|
||||
// backstageView
|
||||
//
|
||||
this.backstageView.AutoSize = true;
|
||||
@ -55,7 +44,6 @@
|
||||
// Setup
|
||||
//
|
||||
this.ClientSize = new System.Drawing.Size(823, 468);
|
||||
this.Controls.Add(this.lbl_pleaseconnect);
|
||||
this.Controls.Add(this.backstageView);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MinimumSize = new System.Drawing.Size(839, 506);
|
||||
@ -71,6 +59,5 @@
|
||||
#endregion
|
||||
|
||||
private Controls.BackstageView.BackstageView backstageView;
|
||||
private System.Windows.Forms.Label lbl_pleaseconnect;
|
||||
}
|
||||
}
|
||||
|
@ -276,14 +276,14 @@ namespace ArdupilotMega.GCSViews
|
||||
{
|
||||
//System.Threading.Thread.Sleep(1000);
|
||||
|
||||
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_CONTROLLER, 0); // request servoout
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTENDED_STATUS, MainV2.cs.ratestatus); // mode
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_POSITION, MainV2.cs.rateposition); // request gps
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTRA1, MainV2.cs.rateattitude); // request attitude
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTRA2, MainV2.cs.rateattitude); // request vfr
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTRA3, MainV2.cs.ratesensors); // request extra stuff - tridge
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_SENSORS, MainV2.cs.ratesensors); // request raw sensor
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RC_CHANNELS, MainV2.cs.raterc); // request rc info
|
||||
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RAW_CONTROLLER, 0); // request servoout
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.EXTENDED_STATUS, MainV2.cs.ratestatus); // mode
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.POSITION, MainV2.cs.rateposition); // request gps
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.EXTRA1, MainV2.cs.rateattitude); // request attitude
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.EXTRA2, MainV2.cs.rateattitude); // request vfr
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.EXTRA3, MainV2.cs.ratesensors); // request extra stuff - tridge
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RAW_SENSORS, MainV2.cs.ratesensors); // request raw sensor
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RC_CHANNELS, MainV2.cs.raterc); // request rc info
|
||||
}
|
||||
catch { }
|
||||
lastdata = DateTime.Now.AddSeconds(12); // prevent flooding
|
||||
@ -927,7 +927,7 @@ namespace ArdupilotMega.GCSViews
|
||||
{
|
||||
MainV2.giveComport = true;
|
||||
|
||||
MainV2.comPort.setWP(gotohere, 0, MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT, (byte)2);
|
||||
MainV2.comPort.setWP(gotohere, 0, MAVLink.MAV_FRAME.GLOBAL_RELATIVE_ALT, (byte)2);
|
||||
|
||||
GuidedModeWP = new PointLatLngAlt(gotohere.lat, gotohere.lng, gotohere.alt,"Guided Mode");
|
||||
|
||||
|
@ -1164,7 +1164,7 @@ namespace ArdupilotMega.GCSViews
|
||||
|
||||
sw.Write((a + 1)); // seq
|
||||
sw.Write("\t" + 0); // current
|
||||
sw.Write("\t" + (CHK_altmode.Checked == true ? (byte)MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL : (byte)MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT)); //frame
|
||||
sw.Write("\t" + (CHK_altmode.Checked == true ? (byte)MAVLink.MAV_FRAME.GLOBAL : (byte)MAVLink.MAV_FRAME.GLOBAL_RELATIVE_ALT)); //frame
|
||||
sw.Write("\t" + mode);
|
||||
sw.Write("\t" + double.Parse(Commands.Rows[a].Cells[Param1.Index].Value.ToString()).ToString("0.000000", new System.Globalization.CultureInfo("en-US")));
|
||||
sw.Write("\t" + double.Parse(Commands.Rows[a].Cells[Param2.Index].Value.ToString()).ToString("0.000000", new System.Globalization.CultureInfo("en-US")));
|
||||
@ -1352,9 +1352,9 @@ namespace ArdupilotMega.GCSViews
|
||||
|
||||
((Controls.ProgressReporterDialogue)sender).UpdateProgressAndStatus(0, "Set Home");
|
||||
|
||||
port.setWP(home, (ushort)0, MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL, 0);
|
||||
port.setWP(home, (ushort)0, MAVLink.MAV_FRAME.GLOBAL, 0);
|
||||
|
||||
MAVLink.MAV_FRAME frame = MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT;
|
||||
MAVLink.MAV_FRAME frame = MAVLink.MAV_FRAME.GLOBAL_RELATIVE_ALT;
|
||||
|
||||
// process grid to memory eeprom
|
||||
for (int a = 0; a < Commands.Rows.Count - 0; a++)
|
||||
@ -1368,11 +1368,11 @@ namespace ArdupilotMega.GCSViews
|
||||
{
|
||||
if (CHK_altmode.Checked)
|
||||
{
|
||||
frame = MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL;
|
||||
frame = MAVLink.MAV_FRAME.GLOBAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
frame = MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT;
|
||||
frame = MAVLink.MAV_FRAME.GLOBAL_RELATIVE_ALT;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,11 @@ namespace ArdupilotMega.GCSViews
|
||||
|
||||
// gps buffer
|
||||
int gpsbufferindex = 0;
|
||||
#if !MAVLINK10
|
||||
ArdupilotMega.MAVLink.mavlink_gps_raw_t[] gpsbuffer = new MAVLink.mavlink_gps_raw_t[5];
|
||||
#else
|
||||
ArdupilotMega.MAVLink.mavlink_gps_raw_int_t[] gpsbuffer = new MAVLink.mavlink_gps_raw_int_t[5];
|
||||
#endif
|
||||
|
||||
// set defaults
|
||||
int rollgain = 10000;
|
||||
@ -374,7 +378,6 @@ namespace ArdupilotMega.GCSViews
|
||||
/// <param name="write">true/false</param>
|
||||
private void xmlconfig(bool write)
|
||||
{
|
||||
int fixme; // add profiles?
|
||||
if (write)
|
||||
{
|
||||
ArdupilotMega.MainV2.config["REV_roll"] = CHKREV_roll.Checked.ToString();
|
||||
@ -576,11 +579,11 @@ namespace ArdupilotMega.GCSViews
|
||||
{
|
||||
if (CHK_quad.Checked && !RAD_aerosimrc.Checked)// || chkSensor.Checked && RAD_JSBSim.Checked)
|
||||
{
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_CONTROLLER, 0); // request servoout
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RAW_CONTROLLER, 0); // request servoout
|
||||
}
|
||||
else
|
||||
{
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_CONTROLLER, 50); // request servoout
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RAW_CONTROLLER, 50); // request servoout
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
@ -834,11 +837,11 @@ namespace ArdupilotMega.GCSViews
|
||||
gps.fix_type = 3;
|
||||
if (xplane9)
|
||||
{
|
||||
gps.cog = ((float)DATA[19][2]);
|
||||
gps.cog = (ushort)((float)DATA[19][2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
gps.cog = ((float)DATA[18][2]);
|
||||
gps.cog = (ushort)((float)DATA[18][2]);
|
||||
}
|
||||
gps.lat = (int)(DATA[20][0] * 1.0e7);
|
||||
gps.lon = (int)(DATA[20][1] * 1.0e7);
|
||||
@ -1167,7 +1170,11 @@ namespace ArdupilotMega.GCSViews
|
||||
sitlout.alt = gps.alt;
|
||||
sitlout.lat = gps.lat;
|
||||
sitlout.lon = gps.lon;
|
||||
#if !MAVLINK10
|
||||
sitlout.heading = gps.hdg;
|
||||
#else
|
||||
sitlout.heading = gps.cog;
|
||||
#endif
|
||||
|
||||
sitlout.v_north = DATA[21][4];
|
||||
sitlout.v_east = DATA[21][5];
|
||||
|
@ -799,7 +799,7 @@ namespace ArdupilotMega
|
||||
public bool setWPCurrent(ushort index)
|
||||
{
|
||||
#if MAVLINK10
|
||||
MainV2.givecomport = true;
|
||||
MainV2.giveComport = true;
|
||||
byte[] buffer;
|
||||
|
||||
mavlink_mission_set_current_t req = new mavlink_mission_set_current_t();
|
||||
@ -825,7 +825,7 @@ namespace ArdupilotMega
|
||||
retrys--;
|
||||
continue;
|
||||
}
|
||||
MainV2.givecomport = false;
|
||||
MainV2.giveComport = false;
|
||||
throw new Exception("Timeout on read - setWPCurrent");
|
||||
}
|
||||
|
||||
@ -834,7 +834,7 @@ namespace ArdupilotMega
|
||||
{
|
||||
if (buffer[5] == MAVLINK_MSG_ID_MISSION_CURRENT)
|
||||
{
|
||||
MainV2.givecomport = false;
|
||||
MainV2.giveComport = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -844,7 +844,7 @@ namespace ArdupilotMega
|
||||
public bool doCommand(MAV_CMD actionid, float p1, float p2, float p3, float p4, float p5, float p6, float p7)
|
||||
{
|
||||
|
||||
MainV2.givecomport = true;
|
||||
MainV2.giveComport = true;
|
||||
byte[] buffer;
|
||||
|
||||
mavlink_command_long_t req = new mavlink_command_long_t();
|
||||
@ -888,7 +888,7 @@ namespace ArdupilotMega
|
||||
retrys--;
|
||||
continue;
|
||||
}
|
||||
MainV2.givecomport = false;
|
||||
MainV2.giveComport = false;
|
||||
throw new Exception("Timeout on read - doAction");
|
||||
}
|
||||
|
||||
@ -902,14 +902,14 @@ namespace ArdupilotMega
|
||||
var ack = buffer.ByteArrayToStructure<mavlink_command_ack_t>(6);
|
||||
|
||||
|
||||
if (ack.result == (byte)MAV_RESULT.MAV_RESULT_ACCEPTED)
|
||||
if (ack.result == (byte)MAV_RESULT.ACCEPTED)
|
||||
{
|
||||
MainV2.givecomport = false;
|
||||
MainV2.giveComport = false;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainV2.givecomport = false;
|
||||
MainV2.giveComport = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1032,10 +1032,10 @@ namespace ArdupilotMega
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case (byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_ALL:
|
||||
case (byte)MAVLink.MAV_DATA_STREAM.ALL:
|
||||
|
||||
break;
|
||||
case (byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTENDED_STATUS:
|
||||
case (byte)MAVLink.MAV_DATA_STREAM.EXTENDED_STATUS:
|
||||
if (packetspersecondbuild[MAVLINK_MSG_ID_SYS_STATUS] < DateTime.Now.AddSeconds(-2))
|
||||
break;
|
||||
pps = packetspersecond[MAVLINK_MSG_ID_SYS_STATUS];
|
||||
@ -1044,7 +1044,7 @@ namespace ArdupilotMega
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case (byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTRA1:
|
||||
case (byte)MAVLink.MAV_DATA_STREAM.EXTRA1:
|
||||
if (packetspersecondbuild[MAVLINK_MSG_ID_ATTITUDE] < DateTime.Now.AddSeconds(-2))
|
||||
break;
|
||||
pps = packetspersecond[MAVLINK_MSG_ID_ATTITUDE];
|
||||
@ -1053,7 +1053,7 @@ namespace ArdupilotMega
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case (byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTRA2:
|
||||
case (byte)MAVLink.MAV_DATA_STREAM.EXTRA2:
|
||||
if (packetspersecondbuild[MAVLINK_MSG_ID_VFR_HUD] < DateTime.Now.AddSeconds(-2))
|
||||
break;
|
||||
pps = packetspersecond[MAVLINK_MSG_ID_VFR_HUD];
|
||||
@ -1062,7 +1062,7 @@ namespace ArdupilotMega
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case (byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTRA3:
|
||||
case (byte)MAVLink.MAV_DATA_STREAM.EXTRA3:
|
||||
if (packetspersecondbuild[MAVLINK_MSG_ID_AHRS] < DateTime.Now.AddSeconds(-2))
|
||||
break;
|
||||
pps = packetspersecond[MAVLINK_MSG_ID_AHRS];
|
||||
@ -1071,7 +1071,7 @@ namespace ArdupilotMega
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case (byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_POSITION:
|
||||
case (byte)MAVLink.MAV_DATA_STREAM.POSITION:
|
||||
// ac2 does not send rate position
|
||||
if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2)
|
||||
return;
|
||||
@ -1083,7 +1083,7 @@ namespace ArdupilotMega
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case (byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_CONTROLLER:
|
||||
case (byte)MAVLink.MAV_DATA_STREAM.RAW_CONTROLLER:
|
||||
if (packetspersecondbuild[MAVLINK_MSG_ID_RC_CHANNELS_SCALED] < DateTime.Now.AddSeconds(-2))
|
||||
break;
|
||||
pps = packetspersecond[MAVLINK_MSG_ID_RC_CHANNELS_SCALED];
|
||||
@ -1092,7 +1092,7 @@ namespace ArdupilotMega
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case (byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_SENSORS:
|
||||
case (byte)MAVLink.MAV_DATA_STREAM.RAW_SENSORS:
|
||||
if (packetspersecondbuild[MAVLINK_MSG_ID_RAW_IMU] < DateTime.Now.AddSeconds(-2))
|
||||
break;
|
||||
pps = packetspersecond[MAVLINK_MSG_ID_RAW_IMU];
|
||||
@ -1101,7 +1101,7 @@ namespace ArdupilotMega
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case (byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RC_CHANNELS:
|
||||
case (byte)MAVLink.MAV_DATA_STREAM.RC_CHANNELS:
|
||||
if (packetspersecondbuild[MAVLINK_MSG_ID_RC_CHANNELS_RAW] < DateTime.Now.AddSeconds(-2))
|
||||
break;
|
||||
pps = packetspersecond[MAVLINK_MSG_ID_RC_CHANNELS_RAW];
|
||||
@ -1193,13 +1193,13 @@ namespace ArdupilotMega
|
||||
{
|
||||
if (retrys > 0)
|
||||
{
|
||||
log.Info("getWPCount Retry " + retrys + " - giv com " + MainV2.givecomport);
|
||||
log.Info("getWPCount Retry " + retrys + " - giv com " + MainV2.giveComport);
|
||||
generatePacket(MAVLINK_MSG_ID_MISSION_REQUEST_LIST, req);
|
||||
start = DateTime.Now;
|
||||
retrys--;
|
||||
continue;
|
||||
}
|
||||
MainV2.givecomport = false;
|
||||
MainV2.giveComport = false;
|
||||
//return (byte)int.Parse(param["WP_TOTAL"].ToString());
|
||||
throw new Exception("Timeout on read - getWPCount");
|
||||
}
|
||||
@ -1216,7 +1216,7 @@ namespace ArdupilotMega
|
||||
|
||||
|
||||
log.Info("wpcount: " + count.count);
|
||||
MainV2.givecomport = false;
|
||||
MainV2.giveComport = false;
|
||||
return (byte)count.count; // should be ushort, but apm has limited wp count < byte
|
||||
}
|
||||
else
|
||||
@ -1311,7 +1311,7 @@ namespace ArdupilotMega
|
||||
retrys--;
|
||||
continue;
|
||||
}
|
||||
MainV2.givecomport = false;
|
||||
MainV2.giveComport = false;
|
||||
throw new Exception("Timeout on read - getWP");
|
||||
}
|
||||
//Console.WriteLine("getwp read " + DateTime.Now.Millisecond);
|
||||
@ -1561,7 +1561,7 @@ namespace ArdupilotMega
|
||||
public void setWPTotal(ushort wp_total)
|
||||
{
|
||||
#if MAVLINK10
|
||||
MainV2.givecomport = true;
|
||||
MainV2.giveComport = true;
|
||||
mavlink_mission_count_t req = new mavlink_mission_count_t();
|
||||
|
||||
req.target_system = sysid;
|
||||
@ -1586,7 +1586,7 @@ namespace ArdupilotMega
|
||||
retrys--;
|
||||
continue;
|
||||
}
|
||||
MainV2.givecomport = false;
|
||||
MainV2.giveComport = false;
|
||||
throw new Exception("Timeout on read - setWPTotal");
|
||||
}
|
||||
byte[] buffer = readPacket();
|
||||
@ -1605,7 +1605,7 @@ namespace ArdupilotMega
|
||||
param["WP_TOTAL"] = (float)wp_total - 1;
|
||||
if (param["CMD_TOTAL"] != null)
|
||||
param["CMD_TOTAL"] = (float)wp_total - 1;
|
||||
MainV2.givecomport = false;
|
||||
MainV2.giveComport = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1813,12 +1813,12 @@ namespace ArdupilotMega
|
||||
if (ans.seq == (index + 1))
|
||||
{
|
||||
log.Info("set wp doing " + index + " req " + ans.seq + " REQ 40 : " + buffer[5]);
|
||||
MainV2.givecomport = false;
|
||||
MainV2.giveComport = false;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
log.Info("set wp fail doing " + index + " req " + ans.seq + " ACK 47 or REQ 40 : " + buffer[5] + " seq {0} ts {1} tc {2}", req.seq, req.target_system, req.target_component);
|
||||
log.InfoFormat("set wp fail doing " + index + " req " + ans.seq + " ACK 47 or REQ 40 : " + buffer[5] + " seq {0} ts {1} tc {2}", req.seq, req.target_system, req.target_component);
|
||||
//break;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,10 +5,10 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace ArdupilotMega
|
||||
{
|
||||
#if !MAVLINK10
|
||||
#if !MAVLINK10
|
||||
partial class MAVLink
|
||||
{
|
||||
public const string MAVLINK_BUILD_DATE = "Wed Apr 4 18:13:05 2012";
|
||||
public const string MAVLINK_BUILD_DATE = "Fri Apr 6 21:10:55 2012";
|
||||
public const string MAVLINK_WIRE_PROTOCOL_VERSION = "0.9";
|
||||
public const int MAVLINK_MAX_DIALECT_PAYLOAD_SIZE = 42;
|
||||
|
||||
@ -155,6 +155,51 @@ namespace ArdupilotMega
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** @brief Data stream IDs. A data stream is not a fixed set of messages, but rather a recommendation to the autopilot software. Individual autopilots may or may not obey the recommended messages. */
|
||||
public enum MAV_DATA_STREAM
|
||||
{
|
||||
///<summary> Enable all data streams | </summary>
|
||||
ALL=0,
|
||||
///<summary> Enable IMU_RAW, GPS_RAW, GPS_STATUS packets. | </summary>
|
||||
RAW_SENSORS=1,
|
||||
///<summary> Enable GPS_STATUS, CONTROL_STATUS, AUX_STATUS | </summary>
|
||||
EXTENDED_STATUS=2,
|
||||
///<summary> Enable RC_CHANNELS_SCALED, RC_CHANNELS_RAW, SERVO_OUTPUT_RAW | </summary>
|
||||
RC_CHANNELS=3,
|
||||
///<summary> Enable ATTITUDE_CONTROLLER_OUTPUT, POSITION_CONTROLLER_OUTPUT, NAV_CONTROLLER_OUTPUT. | </summary>
|
||||
RAW_CONTROLLER=4,
|
||||
///<summary> Enable LOCAL_POSITION, GLOBAL_POSITION/GLOBAL_POSITION_INT messages. | </summary>
|
||||
POSITION=6,
|
||||
///<summary> Dependent on the autopilot | </summary>
|
||||
EXTRA1=10,
|
||||
///<summary> Dependent on the autopilot | </summary>
|
||||
EXTRA2=11,
|
||||
///<summary> Dependent on the autopilot | </summary>
|
||||
EXTRA3=12,
|
||||
///<summary> | </summary>
|
||||
ENUM_END=13,
|
||||
|
||||
};
|
||||
|
||||
/** @brief The ROI (region of interest) for the vehicle. This can be be used by the vehicle for camera/vehicle attitude alignment (see MAV_CMD_NAV_ROI). */
|
||||
public enum MAV_ROI
|
||||
{
|
||||
///<summary> No region of interest. | </summary>
|
||||
NONE=0,
|
||||
///<summary> Point toward next waypoint. | </summary>
|
||||
WPNEXT=1,
|
||||
///<summary> Point toward given waypoint. | </summary>
|
||||
WPINDEX=2,
|
||||
///<summary> Point toward fixed location. | </summary>
|
||||
LOCATION=3,
|
||||
///<summary> Point toward of given id. | </summary>
|
||||
TARGET=4,
|
||||
///<summary> | </summary>
|
||||
ENUM_END=5,
|
||||
|
||||
};
|
||||
|
||||
|
||||
public const byte MAVLINK_MSG_ID_SENSOR_OFFSETS = 150;
|
||||
[StructLayout(LayoutKind.Sequential,Pack=1,Size=42)]
|
||||
@ -1780,175 +1825,10 @@ namespace ArdupilotMega
|
||||
/// <summary> index of debug variable </summary>
|
||||
public byte ind;
|
||||
/// <summary> DEBUG value </summary>
|
||||
public Single value; };
|
||||
public enum MAV_CLASS
|
||||
{
|
||||
MAV_CLASS_GENERIC = 0, /// Generic autopilot, full support for everything
|
||||
MAV_CLASS_PIXHAWK = 1, /// PIXHAWK autopilot, http://pixhawk.ethz.ch
|
||||
MAV_CLASS_SLUGS = 2, /// SLUGS autopilot, http://slugsuav.soe.ucsc.edu
|
||||
MAV_CLASS_ARDUPILOTMEGA = 3, /// ArduPilotMega / ArduCopter, http://diydrones.com
|
||||
MAV_CLASS_OPENPILOT = 4, /// OpenPilot, http://openpilot.org
|
||||
MAV_CLASS_GENERIC_MISSION_WAYPOINTS_ONLY = 5, /// Generic autopilot only supporting simple waypoints
|
||||
MAV_CLASS_GENERIC_MISSION_NAVIGATION_ONLY = 6, /// Generic autopilot supporting waypoints and other simple navigation commands
|
||||
MAV_CLASS_GENERIC_MISSION_FULL = 7, /// Generic autopilot supporting the full mission command set
|
||||
MAV_CLASS_NONE = 8, /// No valid autopilot
|
||||
MAV_CLASS_NB /// Number of autopilot classes
|
||||
};
|
||||
|
||||
public enum MAV_ACTION
|
||||
{
|
||||
MAV_ACTION_HOLD = 0,
|
||||
MAV_ACTION_MOTORS_START = 1,
|
||||
MAV_ACTION_LAUNCH = 2,
|
||||
MAV_ACTION_RETURN = 3,
|
||||
MAV_ACTION_EMCY_LAND = 4,
|
||||
MAV_ACTION_EMCY_KILL = 5,
|
||||
MAV_ACTION_CONFIRM_KILL = 6,
|
||||
MAV_ACTION_CONTINUE = 7,
|
||||
MAV_ACTION_MOTORS_STOP = 8,
|
||||
MAV_ACTION_HALT = 9,
|
||||
MAV_ACTION_SHUTDOWN = 10,
|
||||
MAV_ACTION_REBOOT = 11,
|
||||
MAV_ACTION_SET_MANUAL = 12,
|
||||
MAV_ACTION_SET_AUTO = 13,
|
||||
MAV_ACTION_STORAGE_READ = 14,
|
||||
MAV_ACTION_STORAGE_WRITE = 15,
|
||||
MAV_ACTION_CALIBRATE_RC = 16,
|
||||
MAV_ACTION_CALIBRATE_GYRO = 17,
|
||||
MAV_ACTION_CALIBRATE_MAG = 18,
|
||||
MAV_ACTION_CALIBRATE_ACC = 19,
|
||||
MAV_ACTION_CALIBRATE_PRESSURE = 20,
|
||||
MAV_ACTION_REC_START = 21,
|
||||
MAV_ACTION_REC_PAUSE = 22,
|
||||
MAV_ACTION_REC_STOP = 23,
|
||||
MAV_ACTION_TAKEOFF = 24,
|
||||
MAV_ACTION_NAVIGATE = 25,
|
||||
MAV_ACTION_LAND = 26,
|
||||
MAV_ACTION_LOITER = 27,
|
||||
MAV_ACTION_SET_ORIGIN = 28,
|
||||
MAV_ACTION_RELAY_ON = 29,
|
||||
MAV_ACTION_RELAY_OFF = 30,
|
||||
MAV_ACTION_GET_IMAGE = 31,
|
||||
MAV_ACTION_VIDEO_START = 32,
|
||||
MAV_ACTION_VIDEO_STOP = 33,
|
||||
MAV_ACTION_RESET_MAP = 34,
|
||||
MAV_ACTION_RESET_PLAN = 35,
|
||||
MAV_ACTION_DELAY_BEFORE_COMMAND = 36,
|
||||
MAV_ACTION_ASCEND_AT_RATE = 37,
|
||||
MAV_ACTION_CHANGE_MODE = 38,
|
||||
MAV_ACTION_LOITER_MAX_TURNS = 39,
|
||||
MAV_ACTION_LOITER_MAX_TIME = 40,
|
||||
MAV_ACTION_START_HILSIM = 41,
|
||||
MAV_ACTION_STOP_HILSIM = 42,
|
||||
MAV_ACTION_NB /// Number of MAV actions
|
||||
};
|
||||
|
||||
public enum MAV_MODE
|
||||
{
|
||||
MAV_MODE_UNINIT = 0, /// System is in undefined state
|
||||
MAV_MODE_LOCKED = 1, /// Motors are blocked, system is safe
|
||||
MAV_MODE_MANUAL = 2, /// System is allowed to be active, under manual (RC) control
|
||||
MAV_MODE_GUIDED = 3, /// System is allowed to be active, under autonomous control, manual setpoint
|
||||
MAV_MODE_AUTO = 4, /// System is allowed to be active, under autonomous control and navigation
|
||||
MAV_MODE_TEST1 = 5, /// Generic test mode, for custom use
|
||||
MAV_MODE_TEST2 = 6, /// Generic test mode, for custom use
|
||||
MAV_MODE_TEST3 = 7, /// Generic test mode, for custom use
|
||||
MAV_MODE_READY = 8, /// System is ready, motors are unblocked, but controllers are inactive
|
||||
MAV_MODE_RC_TRAINING = 9 /// System is blocked, only RC valued are read and reported back
|
||||
};
|
||||
|
||||
public enum MAV_STATE
|
||||
{
|
||||
MAV_STATE_UNINIT = 0,
|
||||
MAV_STATE_BOOT,
|
||||
MAV_STATE_CALIBRATING,
|
||||
MAV_STATE_STANDBY,
|
||||
MAV_STATE_ACTIVE,
|
||||
MAV_STATE_CRITICAL,
|
||||
MAV_STATE_EMERGENCY,
|
||||
MAV_STATE_HILSIM,
|
||||
MAV_STATE_POWEROFF
|
||||
};
|
||||
|
||||
public enum MAV_NAV
|
||||
{
|
||||
MAV_NAV_GROUNDED = 0,
|
||||
MAV_NAV_LIFTOFF,
|
||||
MAV_NAV_HOLD,
|
||||
MAV_NAV_WAYPOINT,
|
||||
MAV_NAV_VECTOR,
|
||||
MAV_NAV_RETURNING,
|
||||
MAV_NAV_LANDING,
|
||||
MAV_NAV_LOST,
|
||||
MAV_NAV_LOITER,
|
||||
MAV_NAV_FREE_DRIFT
|
||||
};
|
||||
|
||||
public enum MAV_TYPE
|
||||
{
|
||||
MAV_GENERIC = 0,
|
||||
MAV_FIXED_WING = 1,
|
||||
MAV_QUADROTOR = 2,
|
||||
MAV_COAXIAL = 3,
|
||||
MAV_HELICOPTER = 4,
|
||||
MAV_GROUND = 5,
|
||||
OCU = 6,
|
||||
MAV_AIRSHIP = 7,
|
||||
MAV_FREE_BALLOON = 8,
|
||||
MAV_ROCKET = 9,
|
||||
UGV_GROUND_ROVER = 10,
|
||||
UGV_SURFACE_SHIP = 11
|
||||
};
|
||||
|
||||
public enum MAV_AUTOPILOT_TYPE
|
||||
{
|
||||
MAV_AUTOPILOT_GENERIC = 0,
|
||||
MAV_AUTOPILOT_PIXHAWK = 1,
|
||||
MAV_AUTOPILOT_SLUGS = 2,
|
||||
MAV_AUTOPILOT_ARDUPILOTMEGA = 3,
|
||||
MAV_AUTOPILOT_NONE = 4
|
||||
};
|
||||
|
||||
public enum MAV_COMPONENT
|
||||
{
|
||||
MAV_COMP_ID_GPS,
|
||||
MAV_COMP_ID_WAYPOINTPLANNER,
|
||||
MAV_COMP_ID_BLOBTRACKER,
|
||||
MAV_COMP_ID_PATHPLANNER,
|
||||
MAV_COMP_ID_AIRSLAM,
|
||||
MAV_COMP_ID_MAPPER,
|
||||
MAV_COMP_ID_CAMERA,
|
||||
MAV_COMP_ID_IMU = 200,
|
||||
MAV_COMP_ID_IMU_2 = 201,
|
||||
MAV_COMP_ID_IMU_3 = 202,
|
||||
MAV_COMP_ID_UDP_BRIDGE = 240,
|
||||
MAV_COMP_ID_UART_BRIDGE = 241,
|
||||
MAV_COMP_ID_SYSTEM_CONTROL = 250
|
||||
};
|
||||
|
||||
public enum MAV_FRAME
|
||||
{
|
||||
MAV_FRAME_GLOBAL = 0,
|
||||
MAV_FRAME_LOCAL = 1,
|
||||
MAV_FRAME_MISSION = 2,
|
||||
MAV_FRAME_GLOBAL_RELATIVE_ALT = 3,
|
||||
MAV_FRAME_LOCAL_ENU = 4
|
||||
};
|
||||
|
||||
public enum MAV_DATA_STREAM
|
||||
{
|
||||
MAV_DATA_STREAM_ALL=0, /* Enable all data streams | */
|
||||
MAV_DATA_STREAM_RAW_SENSORS=1, /* Enable IMU_RAW, GPS_RAW, GPS_STATUS packets. | */
|
||||
MAV_DATA_STREAM_EXTENDED_STATUS=2, /* Enable GPS_STATUS, CONTROL_STATUS, AUX_STATUS | */
|
||||
MAV_DATA_STREAM_RC_CHANNELS=3, /* Enable RC_CHANNELS_SCALED, RC_CHANNELS_RAW, SERVO_OUTPUT_RAW | */
|
||||
MAV_DATA_STREAM_RAW_CONTROLLER=4, /* Enable ATTITUDE_CONTROLLER_OUTPUT, POSITION_CONTROLLER_OUTPUT, NAV_CONTROLLER_OUTPUT. | */
|
||||
MAV_DATA_STREAM_POSITION=6, /* Enable LOCAL_POSITION, GLOBAL_POSITION/GLOBAL_POSITION_INT messages. | */
|
||||
MAV_DATA_STREAM_EXTRA1=10, /* Dependent on the autopilot | */
|
||||
MAV_DATA_STREAM_EXTRA2=11, /* Dependent on the autopilot | */
|
||||
MAV_DATA_STREAM_EXTRA3=12, /* Dependent on the autopilot | */
|
||||
MAV_DATA_STREAM_ENUM_END=13, /* | */
|
||||
};
|
||||
public Single value;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -993,8 +993,8 @@ namespace ArdupilotMega
|
||||
MAVLink.mavlink_heartbeat_t htb = new MAVLink.mavlink_heartbeat_t();
|
||||
|
||||
#if MAVLINK10
|
||||
htb.type = (byte)MAVLink.MAV_TYPE.MAV_TYPE_GCS;
|
||||
htb.autopilot = (byte)MAVLink.MAV_AUTOPILOT.MAV_AUTOPILOT_ARDUPILOTMEGA;
|
||||
htb.type = (byte)MAVLink.MAV_TYPE.GCS;
|
||||
htb.autopilot = (byte)MAVLink.MAV_AUTOPILOT.ARDUPILOTMEGA;
|
||||
htb.mavlink_version = 3;
|
||||
#else
|
||||
htb.type = (byte)MAVLink.MAV_TYPE.MAV_GENERIC;
|
||||
@ -1896,7 +1896,7 @@ namespace ArdupilotMega
|
||||
}
|
||||
if (keyData == (Keys.Control | Keys.W)) // test
|
||||
{
|
||||
Form frm = new GCSViews.ConfigurationView.Setup();
|
||||
Form frm = new GCSViews.ConfigurationView.Configuration();
|
||||
ThemeManager.ApplyThemeTo(frm);
|
||||
frm.Show();
|
||||
return true;
|
||||
|
Binary file not shown.
@ -34,5 +34,5 @@ using System.Resources;
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.61")]
|
||||
[assembly: AssemblyFileVersion("1.1.62")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("")]
|
||||
|
@ -217,7 +217,7 @@ namespace ArdupilotMega
|
||||
|
||||
MainV2.cs.ratesensors = 3; // hardcode 3 hz
|
||||
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_SENSORS, MainV2.cs.ratesensors); // request raw sensor
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RAW_SENSORS, MainV2.cs.ratesensors); // request raw sensor
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
@ -242,12 +242,12 @@ namespace ArdupilotMega
|
||||
//comPort.stopall(true); // ensure off
|
||||
|
||||
Console.WriteLine("Req streams {0} {1}", comPort.bps, DateTime.Now);
|
||||
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTENDED_STATUS, 0); // mode gps raw
|
||||
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_POSITION, 3); // request location
|
||||
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTRA1, 3); // request attitude
|
||||
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTRA2, 3); // request vfr
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_SENSORS, MainV2.cs.ratesensors); // request raw sensor
|
||||
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RC_CHANNELS, 3); // request rc info
|
||||
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.EXTENDED_STATUS, 0); // mode gps raw
|
||||
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.POSITION, 3); // request location
|
||||
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.EXTRA1, 3); // request attitude
|
||||
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.EXTRA2, 3); // request vfr
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RAW_SENSORS, MainV2.cs.ratesensors); // request raw sensor
|
||||
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RC_CHANNELS, 3); // request rc info
|
||||
}
|
||||
catch
|
||||
{
|
||||
@ -260,7 +260,7 @@ namespace ArdupilotMega
|
||||
private void CMB_rawupdaterate_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
MainV2.cs.ratesensors = (byte)int.Parse(CMB_rawupdaterate.Text);
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_SENSORS, (byte)int.Parse(CMB_rawupdaterate.Text)); // request raw sensor
|
||||
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RAW_SENSORS, (byte)int.Parse(CMB_rawupdaterate.Text)); // request raw sensor
|
||||
}
|
||||
|
||||
System.IO.StreamWriter sw = null;
|
||||
|
@ -159,7 +159,7 @@ namespace ArdupilotMega
|
||||
{
|
||||
MainV2.giveComport = true;
|
||||
|
||||
MainV2.comPort.setWP(gotohere, 0, MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT, (byte)2);
|
||||
MainV2.comPort.setWP(gotohere, 0, MAVLink.MAV_FRAME.GLOBAL_RELATIVE_ALT, (byte)2);
|
||||
|
||||
GCSViews.FlightData.GuidedModeWP = new PointLatLngAlt(gotohere);
|
||||
|
||||
|
Binary file not shown.
@ -11,16 +11,16 @@ namespace ArdupilotMega
|
||||
{
|
||||
public partial class ParamCompare : Form
|
||||
{
|
||||
GCSViews.Configuration config;
|
||||
DataGridView dgv;
|
||||
Hashtable param = new Hashtable();
|
||||
Hashtable param2 = new Hashtable();
|
||||
|
||||
public ParamCompare(GCSViews.Configuration config, Hashtable param, Hashtable param2)
|
||||
public ParamCompare(DataGridView dgv, Hashtable param, Hashtable param2)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.param = param;
|
||||
this.param2 = param2;
|
||||
this.config = config;
|
||||
this.dgv = dgv;
|
||||
|
||||
processToScreen();
|
||||
}
|
||||
@ -61,7 +61,14 @@ namespace ArdupilotMega
|
||||
{
|
||||
if ((bool)row.Cells[Use.Index].Value == true)
|
||||
{
|
||||
config.EEPROM_View_float_TextChanged(new Control() { Name = row.Cells[Command.Index].Value.ToString(), Text = row.Cells[newvalue.Index].Value.ToString() }, null);
|
||||
foreach (DataGridViewRow dgvr in dgv.Rows)
|
||||
{
|
||||
if (dgvr.Cells[0].Value.ToString() == row.Cells[Command.Index].Value.ToString())
|
||||
{
|
||||
dgvr.Cells[1].Value = row.Cells[newvalue.Index].Value.ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.Close();
|
||||
|
Loading…
Reference in New Issue
Block a user