APM Planner 1.0.94

scripting/command restructure - testing
heli interface update
firmware size checker
Non meter wp file fix
This commit is contained in:
Michael Oborne 2011-11-18 22:33:44 +08:00
parent 927c2dbd67
commit daa564e9c9
17 changed files with 3662 additions and 2139 deletions

View File

@ -540,6 +540,9 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<SubType>Designer</SubType>
</Content>
<Content Include="mavcmd.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Resources\MAVCmd.zh-Hans.txt" />
<Content Include="Resources\MAVParam.zh-Hans.txt" />
<None Include="Resources\MAVCmd.txt">

View File

@ -32,11 +32,14 @@ namespace ArdupilotMega
public struct Locationwp
{
public byte id; // command id
public byte options; ///< options bitmask (1<<0 = relative altitude)
public byte p1; // param 1
public int lat; // Lattitude * 10**7
public int lng; // Longitude * 10**7
public int alt; // Altitude in centimeters (meters * 100)
public byte options;
public float p1; // param 1
public float p2; // param 2
public float p3; // param 3
public float p4; // param 4
public float lat; // Lattitude * 10**7
public float lng; // Longitude * 10**7
public float alt; // Altitude in centimeters (meters * 100)
};
@ -796,6 +799,7 @@ System.ComponentModel.Description("Text under Bar")]
base.OnPaint(e);
drawlbl(e.Graphics);
}
}
public class HorizontalProgressBar : ProgressBar

View File

@ -597,6 +597,11 @@ namespace ArdupilotMega.GCSViews
if (board == "1280")
{
if (FLASH.Length > 126976)
{
MessageBox.Show("Firmware is to big for a 1280, Please upgrade!!");
return;
}
//port = new ArduinoSTK();
port.BaudRate = 57600;
}

View File

@ -31,14 +31,14 @@
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FlightPlanner));
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
this.CHK_altmode = new System.Windows.Forms.CheckBox();
this.CHK_holdalt = new System.Windows.Forms.CheckBox();
this.Commands = new System.Windows.Forms.DataGridView();
@ -47,6 +47,9 @@
this.Param2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Param3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Param4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Lat = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Lon = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Alt = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Delete = new System.Windows.Forms.DataGridViewButtonColumn();
this.Up = new System.Windows.Forms.DataGridViewImageColumn();
this.Down = new System.Windows.Forms.DataGridViewImageColumn();
@ -86,6 +89,7 @@
this.textBox1 = new System.Windows.Forms.TextBox();
this.panelWaypoints = new BSE.Windows.Forms.Panel();
this.splitter1 = new BSE.Windows.Forms.Splitter();
this.BUT_Camera = new ArdupilotMega.MyButton();
this.BUT_grid = new ArdupilotMega.MyButton();
this.BUT_Prefetch = new ArdupilotMega.MyButton();
this.button1 = new ArdupilotMega.MyButton();
@ -116,7 +120,6 @@
this.label11 = new System.Windows.Forms.Label();
this.panelBASE = new System.Windows.Forms.Panel();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.BUT_Camera = new ArdupilotMega.MyButton();
((System.ComponentModel.ISupportInitialize)(this.Commands)).BeginInit();
this.panel5.SuspendLayout();
this.panel1.SuspendLayout();
@ -148,37 +151,41 @@
//
this.Commands.AllowUserToAddRows = false;
resources.ApplyResources(this.Commands, "Commands");
dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle9.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.Commands.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle9;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.Commands.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.Commands.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Command,
this.Param1,
this.Param2,
this.Param3,
this.Param4,
this.Lat,
this.Lon,
this.Alt,
this.Delete,
this.Up,
this.Down});
this.Commands.Name = "Commands";
dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle13.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle13.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle13.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle13.Format = "N0";
dataGridViewCellStyle13.NullValue = "0";
dataGridViewCellStyle13.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle13.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
this.Commands.RowHeadersDefaultCellStyle = dataGridViewCellStyle13;
dataGridViewCellStyle14.ForeColor = System.Drawing.Color.Black;
this.Commands.RowsDefaultCellStyle = dataGridViewCellStyle14;
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle5.Format = "N0";
dataGridViewCellStyle5.NullValue = "0";
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
this.Commands.RowHeadersDefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle6.ForeColor = System.Drawing.Color.Black;
this.Commands.RowsDefaultCellStyle = dataGridViewCellStyle6;
this.Commands.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.Commands_CellContentClick);
this.Commands.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.Commands_CellEndEdit);
this.Commands.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.Commands_DataError);
this.Commands.DefaultValuesNeeded += new System.Windows.Forms.DataGridViewRowEventHandler(this.Commands_DefaultValuesNeeded);
this.Commands.EditingControlShowing += new System.Windows.Forms.DataGridViewEditingControlShowingEventHandler(this.Commands_EditingControlShowing);
this.Commands.RowEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.Commands_RowEnter);
@ -187,15 +194,16 @@
//
// Command
//
dataGridViewCellStyle10.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(67)))), ((int)(((byte)(68)))), ((int)(((byte)(69)))));
dataGridViewCellStyle10.ForeColor = System.Drawing.Color.White;
this.Command.DefaultCellStyle = dataGridViewCellStyle10;
dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(67)))), ((int)(((byte)(68)))), ((int)(((byte)(69)))));
dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White;
this.Command.DefaultCellStyle = dataGridViewCellStyle2;
this.Command.DisplayStyle = System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox;
resources.ApplyResources(this.Command, "Command");
this.Command.Name = "Command";
//
// Param1
//
this.Param1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
resources.ApplyResources(this.Param1, "Param1");
this.Param1.Name = "Param1";
this.Param1.Resizable = System.Windows.Forms.DataGridViewTriState.True;
@ -203,6 +211,7 @@
//
// Param2
//
this.Param2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
resources.ApplyResources(this.Param2, "Param2");
this.Param2.Name = "Param2";
this.Param2.Resizable = System.Windows.Forms.DataGridViewTriState.True;
@ -210,6 +219,7 @@
//
// Param3
//
this.Param3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
resources.ApplyResources(this.Param3, "Param3");
this.Param3.Name = "Param3";
this.Param3.Resizable = System.Windows.Forms.DataGridViewTriState.True;
@ -217,9 +227,32 @@
//
// Param4
//
this.Param4.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
resources.ApplyResources(this.Param4, "Param4");
this.Param4.Name = "Param4";
this.Param4.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.Param4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// Lat
//
this.Lat.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
resources.ApplyResources(this.Lat, "Lat");
this.Lat.Name = "Lat";
this.Lat.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// Lon
//
this.Lon.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
resources.ApplyResources(this.Lon, "Lon");
this.Lon.Name = "Lon";
this.Lon.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// Alt
//
this.Alt.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
resources.ApplyResources(this.Alt, "Alt");
this.Alt.Name = "Alt";
this.Alt.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// Delete
//
@ -229,7 +262,7 @@
//
// Up
//
this.Up.DefaultCellStyle = dataGridViewCellStyle11;
this.Up.DefaultCellStyle = dataGridViewCellStyle3;
resources.ApplyResources(this.Up, "Up");
this.Up.Image = global::ArdupilotMega.Properties.Resources.up;
this.Up.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Stretch;
@ -237,8 +270,8 @@
//
// Down
//
dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.Down.DefaultCellStyle = dataGridViewCellStyle12;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.Down.DefaultCellStyle = dataGridViewCellStyle4;
resources.ApplyResources(this.Down, "Down");
this.Down.Image = global::ArdupilotMega.Properties.Resources.down;
this.Down.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Stretch;
@ -382,8 +415,8 @@
//
// dataGridViewImageColumn1
//
dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.dataGridViewImageColumn1.DefaultCellStyle = dataGridViewCellStyle15;
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.dataGridViewImageColumn1.DefaultCellStyle = dataGridViewCellStyle7;
resources.ApplyResources(this.dataGridViewImageColumn1, "dataGridViewImageColumn1");
this.dataGridViewImageColumn1.Image = global::ArdupilotMega.Properties.Resources.up;
this.dataGridViewImageColumn1.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Stretch;
@ -391,8 +424,8 @@
//
// dataGridViewImageColumn2
//
dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.dataGridViewImageColumn2.DefaultCellStyle = dataGridViewCellStyle16;
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.dataGridViewImageColumn2.DefaultCellStyle = dataGridViewCellStyle8;
resources.ApplyResources(this.dataGridViewImageColumn2, "dataGridViewImageColumn2");
this.dataGridViewImageColumn2.Image = global::ArdupilotMega.Properties.Resources.down;
this.dataGridViewImageColumn2.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Stretch;
@ -522,6 +555,14 @@
this.splitter1.Name = "splitter1";
this.splitter1.TabStop = false;
//
// BUT_Camera
//
resources.ApplyResources(this.BUT_Camera, "BUT_Camera");
this.BUT_Camera.Name = "BUT_Camera";
this.toolTip1.SetToolTip(this.BUT_Camera, resources.GetString("BUT_Camera.ToolTip"));
this.BUT_Camera.UseVisualStyleBackColor = true;
this.BUT_Camera.Click += new System.EventHandler(this.BUT_Camera_Click);
//
// BUT_grid
//
resources.ApplyResources(this.BUT_grid, "BUT_grid");
@ -790,14 +831,6 @@
resources.ApplyResources(this.panelBASE, "panelBASE");
this.panelBASE.Name = "panelBASE";
//
// BUT_Camera
//
resources.ApplyResources(this.BUT_Camera, "BUT_Camera");
this.BUT_Camera.Name = "BUT_Camera";
this.toolTip1.SetToolTip(this.BUT_Camera, resources.GetString("BUT_Camera.ToolTip"));
this.BUT_Camera.UseVisualStyleBackColor = true;
this.BUT_Camera.Click += new System.EventHandler(this.BUT_Camera_Click);
//
// FlightPlanner
//
resources.ApplyResources(this, "$this");
@ -878,14 +911,6 @@
private BSE.Windows.Forms.Splitter splitter1;
private System.Windows.Forms.Panel panelBASE;
private System.Windows.Forms.Label lbl_homedist;
private System.Windows.Forms.DataGridViewComboBoxColumn Command;
private System.Windows.Forms.DataGridViewTextBoxColumn Param1;
private System.Windows.Forms.DataGridViewTextBoxColumn Param2;
private System.Windows.Forms.DataGridViewTextBoxColumn Param3;
private System.Windows.Forms.DataGridViewTextBoxColumn Param4;
private System.Windows.Forms.DataGridViewButtonColumn Delete;
private System.Windows.Forms.DataGridViewImageColumn Up;
private System.Windows.Forms.DataGridViewImageColumn Down;
private MyButton BUT_Prefetch;
private MyButton BUT_grid;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
@ -906,5 +931,16 @@
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem deleteWPToolStripMenuItem;
private MyButton BUT_Camera;
private System.Windows.Forms.DataGridViewComboBoxColumn Command;
private System.Windows.Forms.DataGridViewTextBoxColumn Param1;
private System.Windows.Forms.DataGridViewTextBoxColumn Param2;
private System.Windows.Forms.DataGridViewTextBoxColumn Param3;
private System.Windows.Forms.DataGridViewTextBoxColumn Param4;
private System.Windows.Forms.DataGridViewTextBoxColumn Lat;
private System.Windows.Forms.DataGridViewTextBoxColumn Lon;
private System.Windows.Forms.DataGridViewTextBoxColumn Alt;
private System.Windows.Forms.DataGridViewButtonColumn Delete;
private System.Windows.Forms.DataGridViewImageColumn Up;
private System.Windows.Forms.DataGridViewImageColumn Down;
}
}

View File

@ -25,7 +25,6 @@ namespace ArdupilotMega.GCSViews
partial class FlightPlanner : MyUserControl
{
int selectedrow = 0;
int t7 = 10000000;
bool quickadd = false;
bool isonline = true;
bool sethome = false;
@ -37,8 +36,7 @@ namespace ArdupilotMega.GCSViews
private TextBox textBox1;
private ComponentResourceManager rm = new ComponentResourceManager(typeof(FlightPlanner));
private Dictionary<MAVLink.MAV_CMD, string> cmdNames = new Dictionary<MAVLink.MAV_CMD, string>();
private Dictionary<MAVLink.MAV_CMD, string[]> cmdParamNames = new Dictionary<MAVLink.MAV_CMD, string[]>();
private Dictionary<string, string[]> cmdParamNames = new Dictionary<string, string[]>();
/// <summary>
@ -160,15 +158,15 @@ namespace ArdupilotMega.GCSViews
if (temp.id < (byte)MAVLink.MAV_CMD.LAST)
{
temp.alt = (int)(double.Parse(matchs[i].Groups[3].Value.ToString(), new System.Globalization.CultureInfo("en-US")) * 100);
temp.lat = (int)(double.Parse(matchs[i].Groups[4].Value.ToString(), new System.Globalization.CultureInfo("en-US")) * 10000000);
temp.lng = (int)(double.Parse(matchs[i].Groups[5].Value.ToString(), new System.Globalization.CultureInfo("en-US")) * 10000000);
temp.alt = (float)(double.Parse(matchs[i].Groups[3].Value.ToString(), new System.Globalization.CultureInfo("en-US")));
temp.lat = (float)(double.Parse(matchs[i].Groups[4].Value.ToString(), new System.Globalization.CultureInfo("en-US")));
temp.lng = (float)(double.Parse(matchs[i].Groups[5].Value.ToString(), new System.Globalization.CultureInfo("en-US")));
}
else
{
temp.alt = (int)(double.Parse(matchs[i].Groups[3].Value.ToString(), new System.Globalization.CultureInfo("en-US")));
temp.lat = (int)(double.Parse(matchs[i].Groups[4].Value.ToString(), new System.Globalization.CultureInfo("en-US")));
temp.lng = (int)(double.Parse(matchs[i].Groups[5].Value.ToString(), new System.Globalization.CultureInfo("en-US")));
temp.alt = (float)(double.Parse(matchs[i].Groups[3].Value.ToString(), new System.Globalization.CultureInfo("en-US")));
temp.lat = (float)(double.Parse(matchs[i].Groups[4].Value.ToString(), new System.Globalization.CultureInfo("en-US")));
temp.lng = (float)(double.Parse(matchs[i].Groups[5].Value.ToString(), new System.Globalization.CultureInfo("en-US")));
}
cmds.Add(temp);
@ -262,26 +260,26 @@ namespace ArdupilotMega.GCSViews
return;
}
DataGridViewTextBoxCell cell;
if (Commands.Columns[Param3.Index].HeaderText.Equals(cmdParamNames[MAVLink.MAV_CMD.WAYPOINT][2]/*"Lat"*/))
if (Commands.Columns[Lat.Index].HeaderText.Equals(cmdParamNames["WAYPOINT"][4]/*"Lat"*/))
{
cell = Commands.Rows[selectedrow].Cells[3] as DataGridViewTextBoxCell;
cell = Commands.Rows[selectedrow].Cells[Lat.Index] as DataGridViewTextBoxCell;
cell.Value = lat.ToString("0.0000000");
cell.DataGridView.EndEdit();
}
if (Commands.Columns[Param4.Index].HeaderText.Equals(cmdParamNames[MAVLink.MAV_CMD.WAYPOINT][3]/*"Long"*/))
if (Commands.Columns[Lon.Index].HeaderText.Equals(cmdParamNames["WAYPOINT"][5]/*"Long"*/))
{
cell = Commands.Rows[selectedrow].Cells[4] as DataGridViewTextBoxCell;
cell = Commands.Rows[selectedrow].Cells[Lon.Index] as DataGridViewTextBoxCell;
cell.Value = lng.ToString("0.0000000");
cell.DataGridView.EndEdit();
}
if (Commands.Columns[Param1.Index].HeaderText.Equals(cmdParamNames[MAVLink.MAV_CMD.WAYPOINT][0]/*"Delay"*/))
if (Commands.Columns[Param1.Index].HeaderText.Equals(cmdParamNames["WAYPOINT"][0]/*"Delay"*/))
{
cell = Commands.Rows[selectedrow].Cells[1] as DataGridViewTextBoxCell;
cell = Commands.Rows[selectedrow].Cells[Param1.Index] as DataGridViewTextBoxCell;
cell.Value = 0;
}
if (alt != -1 && Commands.Columns[Param2.Index].HeaderText.Equals(cmdParamNames[MAVLink.MAV_CMD.WAYPOINT][1]/*"Alt"*/))
if (alt != -1 && Commands.Columns[Alt.Index].HeaderText.Equals(cmdParamNames["WAYPOINT"][6]/*"Alt"*/))
{
cell = Commands.Rows[selectedrow].Cells[2] as DataGridViewTextBoxCell;
cell = Commands.Rows[selectedrow].Cells[Alt.Index] as DataGridViewTextBoxCell;
cell.Value = TXT_DefaultAlt.Text;
@ -494,46 +492,7 @@ namespace ArdupilotMega.GCSViews
catch { }
}
// add first to keep order
foreach (object cmd in Enum.GetValues(typeof(MAVLink.MAV_CMD)))
{
string str = cmd.ToString();
if (!str.EndsWith("LAST") && !str.EndsWith("END"))
{
cmdNames[(MAVLink.MAV_CMD)cmd] = str;
cmdParamNames[(MAVLink.MAV_CMD)cmd] = new string[] { "setme", "setme", "setme", "setme" };
}
}
// replace with localizied text
// the command name and param names are stored in TXT_MAV_CMD, one comand per line, in following format:
// COMMAND_TYPE;COMMAND_NAME;PARAM_1_HEAD;PARAM_2_HEAD;PARAM_3_HEAD;PARAM_4_HEAD;
string[] cmds = rm.GetString("MAVCmd").Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
rm.ReleaseAllResources();
foreach (string cmd in cmds)
{
string[] field = cmd.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
if (field.Length >= 2)
{
MAVLink.MAV_CMD type = (MAVLink.MAV_CMD)Enum.Parse(typeof(MAVLink.MAV_CMD), field[0]);
cmdNames[type] = field[1];
if (field.Length == 6)
{
string[] param = new string[4];
Array.Copy(field, 2, param, 0, 4);
cmdParamNames[type] = param;
}
}
}
Command.DataSource = new List<KeyValuePair<MAVLink.MAV_CMD, string>>(cmdNames as ICollection<KeyValuePair<MAVLink.MAV_CMD, string>>)/*)*/;
Command.ValueMember = "Key";
Command.DisplayMember = "Value";
updateCMDParams();
Up.Image = global::ArdupilotMega.Properties.Resources.up;
Down.Image = global::ArdupilotMega.Properties.Resources.down;
@ -545,6 +504,80 @@ namespace ArdupilotMega.GCSViews
}
}
void updateCMDParams()
{
cmdParamNames = readCMDXML();
List<string> cmds = new List<string>();
foreach (string item in cmdParamNames.Keys)
{
cmds.Add(item);
}
Command.DataSource = cmds;
}
Dictionary<string, string[]> readCMDXML()
{
Dictionary<string, string[]> cmd = new Dictionary<string, string[]>();
// do lang stuff here
string file = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + "mavcmd.xml";
using (XmlReader reader = XmlReader.Create(file))
{
reader.Read();
reader.ReadStartElement("CMD");
if (MainV2.APMFirmware == MainV2.Firmwares.ArduPlane)
{
reader.ReadToFollowing("APM");
}
else
{
reader.ReadToFollowing("AC2");
}
XmlReader inner = reader.ReadSubtree();
inner.Read();
inner.MoveToElement();
inner.Read();
while (inner.Read())
{
inner.MoveToElement();
if (inner.IsStartElement())
{
string cmdname = inner.Name;
string[] cmdarray = new string[7];
int b = 0;
XmlReader inner2 = inner.ReadSubtree();
inner2.Read();
while (inner2.Read())
{
inner2.MoveToElement();
if (inner2.IsStartElement())
{
cmdarray[b] = inner2.ReadString();
b++;
}
}
cmd[cmdname] = cmdarray;
}
}
}
return cmd;
}
void Commands_DataError(object sender, DataGridViewDataErrorEventArgs e)
{
Console.WriteLine(e.Exception.ToString() + " " + e.Context + " col " + e.ColumnIndex);
@ -607,40 +640,21 @@ namespace ArdupilotMega.GCSViews
isonline = false;
}
updateCMDParams();
writeKML();
}
private void ChangeColumnHeader(MAVLink.MAV_CMD command)
private void ChangeColumnHeader(string command)
{
try
{
if (cmdParamNames.ContainsKey(command))
for (int i = 1; i <= 4; i++)
for (int i = 1; i <= 7; i++)
Commands.Columns[i].HeaderText = cmdParamNames[command][i - 1];
else
for (int i = 1; i <= 4; i++)
for (int i = 1; i <= 7; i++)
Commands.Columns[i].HeaderText = "setme";
switch (command)
{
case MAVLink.MAV_CMD.WAYPOINT:
if (MainV2.APMFirmware == MainV2.Firmwares.ArduPlane)
Commands.Columns[1].HeaderText = "N/A";
break;
case MAVLink.MAV_CMD.LAND:
Commands.Columns[1].HeaderText = "N/A";
if (MainV2.APMFirmware != MainV2.Firmwares.ArduPlane)
{
Commands.Columns[2].HeaderText = "N/A";
Commands.Columns[3].HeaderText = "N/A";
Commands.Columns[4].HeaderText = "N/A";
}
break;
case MAVLink.MAV_CMD.TAKEOFF:
if (MainV2.APMFirmware != MainV2.Firmwares.ArduPlane)
Commands.Columns[1].HeaderText = "N/A";
break;
}
}
catch (Exception ex) { MessageBox.Show(ex.ToString()); }
}
@ -657,8 +671,9 @@ namespace ArdupilotMega.GCSViews
try
{
selectedrow = e.RowIndex;
/*string option = Commands[Command.Index, selectedrow].EditedFormattedValue.ToString();*/
MAVLink.MAV_CMD cmd = (MAVLink.MAV_CMD)Commands[0, selectedrow].Value;
string option = Commands[Command.Index, selectedrow].EditedFormattedValue.ToString();
string cmd = Commands[0, selectedrow].Value.ToString();
Console.WriteLine("editformat " + option + " value " + cmd);
ChangeColumnHeader(cmd);
}
catch (Exception ex) { MessageBox.Show(ex.ToString()); }
@ -669,7 +684,7 @@ namespace ArdupilotMega.GCSViews
DataGridViewComboBoxCell cell = Commands.Rows[e.RowIndex].Cells[Command.Index] as DataGridViewComboBoxCell;
if (cell.Value == null)
{
cell.Value = MAVLink.MAV_CMD.WAYPOINT/*"WAYPOINT"*/;
cell.Value = "WAYPOINT";
Commands.Rows[e.RowIndex].Cells[Delete.Index].Value = "X";
if (!quickadd)
{
@ -685,7 +700,7 @@ namespace ArdupilotMega.GCSViews
{
Commands.CurrentCell = Commands.Rows[e.RowIndex].Cells[0];
if ((MAVLink.MAV_CMD)Commands.Rows[e.RowIndex - 1].Cells[Command.Index].Value/*.ToString()*/ == MAVLink.MAV_CMD.WAYPOINT/*"WAYPOINT"*/)
if (Commands.Rows[e.RowIndex - 1].Cells[Command.Index].Value.ToString() == "WAYPOINT")
{
Commands.Rows[e.RowIndex].Selected = true; // highlight row
}
@ -707,7 +722,8 @@ namespace ArdupilotMega.GCSViews
{
DataGridViewTextBoxCell cell;
cell = Commands.Rows[selectedrow].Cells[a] as DataGridViewTextBoxCell;
if (Commands.Columns[a].HeaderText.Equals("N/A"))
if (Commands.Columns[a].HeaderText.Equals("") && cell != null && cell.Value == null)
{
cell.Value = "0";
}
@ -715,10 +731,11 @@ namespace ArdupilotMega.GCSViews
{
if (cell != null && (cell.Value == null || cell.Value.ToString() == ""))
{
cell.Value = "I need Data";
cell.Value = "?";
}
else
{
// not a text box
}
}
}
@ -741,30 +758,6 @@ namespace ArdupilotMega.GCSViews
}
}
/// <summary>
/// copy of ardupilot code for getting distance between WP's
/// </summary>
/// <param name="loc1"></param>
/// <param name="loc2"></param>
/// <returns></returns>
double getDistance(Locationwp loc1, Locationwp loc2)
{
if (loc1.lat == 0 || loc1.lng == 0)
return -1;
if (loc2.lat == 0 || loc2.lng == 0)
return -1;
// this is used to offset the shrinking longitude as we go towards the poles
double rads = (double)((Math.Abs(loc2.lat) / t7) * 0.0174532925);
//377,173,810 / 10,000,000 = 37.717381 * 0.0174532925 = 0.658292482926943
double scaleLongDown = Math.Cos(rads);
double scaleLongUp = 1.0f / Math.Cos(rads);
float dlat = (float)(loc2.lat - loc1.lat);
float dlong = (float)(((float)(loc2.lng - loc1.lng)) * scaleLongDown);
return Math.Sqrt(Math.Pow(dlat, 2) + Math.Pow(dlong, 2)) * .01113195;
}
/// <summary>
/// used to add a marker to the map display
@ -912,17 +905,16 @@ namespace ArdupilotMega.GCSViews
{
try
{
//int command = (byte)(int)Enum.Parse(typeof(MAVLink.MAV_CMD), Commands.Rows[a].Cells[Command.Index].Value.ToString(), false);
int command = (byte)(MAVLink.MAV_CMD)Commands.Rows[a].Cells[0].Value;
int command = (byte)(int)Enum.Parse(typeof(MAVLink.MAV_CMD), Commands.Rows[a].Cells[Command.Index].Value.ToString(), false);
if (command < (byte)MAVLink.MAV_CMD.LAST && command != (byte)MAVLink.MAV_CMD.TAKEOFF)
{
string cell2 = Commands.Rows[a].Cells[Param2.Index].Value.ToString(); // alt
string cell3 = Commands.Rows[a].Cells[Param3.Index].Value.ToString(); // lat
string cell4 = Commands.Rows[a].Cells[Param4.Index].Value.ToString(); // lng
string cell2 = Commands.Rows[a].Cells[Alt.Index].Value.ToString(); // alt
string cell3 = Commands.Rows[a].Cells[Lat.Index].Value.ToString(); // lat
string cell4 = Commands.Rows[a].Cells[Lon.Index].Value.ToString(); // lng
if (cell4 == "0" || cell3 == "0")
continue;
if (cell4 == "I need Data" || cell3 == "I need Data")
if (cell4 == "?" || cell3 == "?")
continue;
pointlist.Add(new PointLatLngAlt(double.Parse(cell3), double.Parse(cell4), (int)double.Parse(cell2) + homealt, (a + 1).ToString()));
@ -952,11 +944,11 @@ namespace ArdupilotMega.GCSViews
float range = 4000;
Locationwp loc1 = new Locationwp();
loc1.lat = (int)(minlat * t7);
loc1.lng = (int)(minlong * t7);
loc1.lat = (float)(minlat);
loc1.lng = (float)(minlong);
Locationwp loc2 = new Locationwp();
loc2.lat = (int)(maxlat * t7);
loc2.lng = (int)(maxlong * t7);
loc2.lat = (float)(maxlat);
loc2.lng = (float)(maxlong);
//double distance = getDistance(loc1, loc2); // same code as ardupilot
double distance = 2000;
@ -1042,23 +1034,17 @@ namespace ArdupilotMega.GCSViews
{
byte mode = (byte)(MAVLink.MAV_CMD)Enum.Parse(typeof(MAVLink.MAV_CMD), Commands.Rows[a].Cells[0].Value.ToString());
sw.Write((a+1)); // seq
sw.Write("\t" +0); // current
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" + mode);
sw.Write("\t" + double.Parse(Commands.Rows[a].Cells[1].Value.ToString()).ToString("0.000000",new System.Globalization.CultureInfo("en-US")));
if (mode >= (byte)MAVLink.MAV_CMD.LAST) {
sw.Write("\t" + double.Parse(Commands.Rows[a].Cells[2].Value.ToString()).ToString("0.000000", new System.Globalization.CultureInfo("en-US")));
sw.Write("\t" + double.Parse(Commands.Rows[a].Cells[3].Value.ToString()).ToString("0.000000", new System.Globalization.CultureInfo("en-US")));
sw.Write("\t" + double.Parse(Commands.Rows[a].Cells[4].Value.ToString()).ToString("0.000000", new System.Globalization.CultureInfo("en-US")));
} else {
sw.Write("\t" + "0.000000");
sw.Write("\t" + "0.000000");
sw.Write("\t" + "0.000000");
}
sw.Write("\t" + double.Parse(Commands.Rows[a].Cells[3].Value.ToString()).ToString("0.000000", new System.Globalization.CultureInfo("en-US")));
sw.Write("\t" + double.Parse(Commands.Rows[a].Cells[4].Value.ToString()).ToString("0.000000", new System.Globalization.CultureInfo("en-US")));
sw.Write("\t" + double.Parse(Commands.Rows[a].Cells[2].Value.ToString()).ToString("0.000000", new System.Globalization.CultureInfo("en-US")));
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")));
sw.Write("\t" + double.Parse(Commands.Rows[a].Cells[Param3.Index].Value.ToString()).ToString("0.000000", new System.Globalization.CultureInfo("en-US")));
sw.Write("\t" + double.Parse(Commands.Rows[a].Cells[Param4.Index].Value.ToString()).ToString("0.000000", new System.Globalization.CultureInfo("en-US")));
sw.Write("\t" + double.Parse(Commands.Rows[a].Cells[Lat.Index].Value.ToString()).ToString("0.000000", new System.Globalization.CultureInfo("en-US")));
sw.Write("\t" + double.Parse(Commands.Rows[a].Cells[Lon.Index].Value.ToString()).ToString("0.000000", new System.Globalization.CultureInfo("en-US")));
sw.Write("\t" + (double.Parse(Commands.Rows[a].Cells[Alt.Index].Value.ToString()) / MainV2.cs.multiplierdist).ToString("0.000000", new System.Globalization.CultureInfo("en-US")));
sw.Write("\t" + 1);
sw.WriteLine("");
}
@ -1197,9 +1183,9 @@ namespace ArdupilotMega.GCSViews
try
{
home.id = (byte)MAVLink.MAV_CMD.WAYPOINT;
home.lat = (int)(float.Parse(TXT_homelat.Text) * 10000000);
home.lng = (int)(float.Parse(TXT_homelng.Text) * 10000000);
home.alt = (int)(float.Parse(TXT_homealt.Text) / MainV2.cs.multiplierdist * 100); // use saved home
home.lat = (float.Parse(TXT_homelat.Text));
home.lng = (float.Parse(TXT_homelng.Text));
home.alt = (float.Parse(TXT_homealt.Text) / MainV2.cs.multiplierdist); // use saved home
}
catch { throw new Exception("Your home location is invalid"); }
@ -1213,8 +1199,8 @@ namespace ArdupilotMega.GCSViews
for (int a = 0; a < Commands.Rows.Count - 0; a++)
{
Locationwp temp = new Locationwp();
temp.id = (byte)(MAVLink.MAV_CMD)Commands.Rows[a].Cells[0].Value;// (int)Enum.Parse(typeof(MAVLink.MAV_CMD), Commands.Rows[a].Cells[0].Value.ToString(), false);
temp.p1 = byte.Parse(Commands.Rows[a].Cells[1].Value.ToString());
temp.id = (byte)(int)Enum.Parse(typeof(MAVLink.MAV_CMD), Commands.Rows[a].Cells[Command.Index].Value.ToString(), false);
temp.p1 = float.Parse(Commands.Rows[a].Cells[Param1.Index].Value.ToString());
if (temp.id < (byte)MAVLink.MAV_CMD.LAST || temp.id == (byte)MAVLink.MAV_CMD.DO_SET_HOME)
{
if (CHK_altmode.Checked)
@ -1225,25 +1211,15 @@ namespace ArdupilotMega.GCSViews
{
frame = MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT;
}
temp.alt = (int)(double.Parse(Commands.Rows[a].Cells[2].Value.ToString()) / MainV2.cs.multiplierdist * 100);
temp.lat = (int)(double.Parse(Commands.Rows[a].Cells[3].Value.ToString()) * 10000000);
temp.lng = (int)(double.Parse(Commands.Rows[a].Cells[4].Value.ToString()) * 10000000);
}
else
{
frame = MAVLink.MAV_FRAME.MAV_FRAME_MISSION;
temp.alt = (int)(double.Parse(Commands.Rows[a].Cells[2].Value.ToString()));
temp.lat = (int)(double.Parse(Commands.Rows[a].Cells[3].Value.ToString()));
temp.lng = (int)(double.Parse(Commands.Rows[a].Cells[4].Value.ToString()));
if (temp.id == (byte)MAVLink.MAV_CMD.CONDITION_CHANGE_ALT && !CHK_altmode.Checked)
{
frame = MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT;
temp.alt = (int)(double.Parse(Commands.Rows[a].Cells[2].Value.ToString()) / MainV2.cs.multiplierdist);
}
}
temp.alt = (float)(double.Parse(Commands.Rows[a].Cells[Alt.Index].Value.ToString()) / MainV2.cs.multiplierdist);
temp.lat = (float)(double.Parse(Commands.Rows[a].Cells[Lat.Index].Value.ToString()));
temp.lng = (float)(double.Parse(Commands.Rows[a].Cells[Lon.Index].Value.ToString()));
temp.p2 = (float)(double.Parse(Commands.Rows[a].Cells[Param2.Index].Value.ToString()));
temp.p3 = (float)(double.Parse(Commands.Rows[a].Cells[Param3.Index].Value.ToString()));
temp.p4 = (float)(double.Parse(Commands.Rows[a].Cells[Param4.Index].Value.ToString()));
port.setWP(temp, (ushort)(a + 1), frame, 0);
}
@ -1308,6 +1284,7 @@ namespace ArdupilotMega.GCSViews
foreach (Locationwp temp in cmds)
{
i++;
//Console.WriteLine("FP processToScreen " + i);
if (temp.id == 0 && i != 0) // 0 and not home
break;
if (temp.id == 255 && i != 0) // bad record - never loaded any WP's - but have started the board up.
@ -1321,19 +1298,19 @@ namespace ArdupilotMega.GCSViews
DataGridViewTextBoxCell cell;
DataGridViewComboBoxCell cellcmd;
cellcmd = Commands.Rows[i].Cells[Command.Index] as DataGridViewComboBoxCell;
cellcmd.Value = temp.id == 0 ? MAVLink.MAV_CMD.WAYPOINT : (MAVLink.MAV_CMD)temp.id; // treat home as a waypoint to avoid data error.
/*foreach (object value in Enum.GetValues(typeof(MAVLink.MAV_CMD)))
cellcmd.Value = "WAYPOINT";
foreach (object value in Enum.GetValues(typeof(MAVLink.MAV_CMD)))
{
if ((int)value == temp.id)
{
cellcmd.Value = value.ToString();
break;
}
}*/
}
if (temp.id < (byte)MAVLink.MAV_CMD.LAST || temp.id == (byte)MAVLink.MAV_CMD.DO_SET_HOME)
{
int alt = temp.alt;
if ((temp.options & 0x1) == 0 && i != 0) // home is always abs
{
CHK_altmode.Checked = true;
@ -1343,31 +1320,32 @@ namespace ArdupilotMega.GCSViews
CHK_altmode.Checked = false;
}
cell = Commands.Rows[i].Cells[Param1.Index] as DataGridViewTextBoxCell;
cell.Value = temp.p1;
cell = Commands.Rows[i].Cells[Param2.Index] as DataGridViewTextBoxCell;
cell.Value = (int)((double)alt * MainV2.cs.multiplierdist / 100);
cell = Commands.Rows[i].Cells[Param3.Index] as DataGridViewTextBoxCell;
cell.Value = (double)temp.lat / 10000000;
cell = Commands.Rows[i].Cells[Param4.Index] as DataGridViewTextBoxCell;
cell.Value = (double)temp.lng / 10000000;
}
else
{
cell = Commands.Rows[i].Cells[Param1.Index] as DataGridViewTextBoxCell;
cell.Value = temp.p1;
cell = Commands.Rows[i].Cells[Param2.Index] as DataGridViewTextBoxCell;
cell.Value = temp.alt;
cell = Commands.Rows[i].Cells[Param3.Index] as DataGridViewTextBoxCell;
cell.Value = temp.lat;
cell = Commands.Rows[i].Cells[Param4.Index] as DataGridViewTextBoxCell;
cell.Value = temp.lng;
}
int alt = (int)temp.alt;
cell = Commands.Rows[i].Cells[Alt.Index] as DataGridViewTextBoxCell;
cell.Value = (int)((double)alt * MainV2.cs.multiplierdist);
cell = Commands.Rows[i].Cells[Lat.Index] as DataGridViewTextBoxCell;
cell.Value = (double)temp.lat;
cell = Commands.Rows[i].Cells[Lon.Index] as DataGridViewTextBoxCell;
cell.Value = (double)temp.lng;
cell = Commands.Rows[i].Cells[Param1.Index] as DataGridViewTextBoxCell;
cell.Value = temp.p1;
cell = Commands.Rows[i].Cells[Param2.Index] as DataGridViewTextBoxCell;
cell.Value = temp.p2;
cell = Commands.Rows[i].Cells[Param3.Index] as DataGridViewTextBoxCell;
cell.Value = temp.p3;
cell = Commands.Rows[i].Cells[Param4.Index] as DataGridViewTextBoxCell;
cell.Value = temp.p4;
}
try
{
DataGridViewTextBoxCell cellhome;
cellhome = Commands.Rows[0].Cells[Param3.Index] as DataGridViewTextBoxCell;
cellhome = Commands.Rows[0].Cells[Lat.Index] as DataGridViewTextBoxCell;
if (cellhome.Value != null)
{
if (cellhome.Value.ToString() != TXT_homelat.Text)
@ -1377,9 +1355,9 @@ namespace ArdupilotMega.GCSViews
if (dr == DialogResult.Yes)
{
TXT_homelat.Text = (double.Parse(cellhome.Value.ToString())).ToString();
cellhome = Commands.Rows[0].Cells[Param4.Index] as DataGridViewTextBoxCell;
cellhome = Commands.Rows[0].Cells[Lon.Index] as DataGridViewTextBoxCell;
TXT_homelng.Text = (double.Parse(cellhome.Value.ToString())).ToString();
cellhome = Commands.Rows[0].Cells[Param2.Index] as DataGridViewTextBoxCell;
cellhome = Commands.Rows[0].Cells[Alt.Index] as DataGridViewTextBoxCell;
TXT_homealt.Text = (double.Parse(cellhome.Value.ToString()) * MainV2.cs.multiplierdist).ToString();
}
}
@ -1652,7 +1630,7 @@ namespace ArdupilotMega.GCSViews
if (line.StartsWith("#"))
continue;
string[] items = line.Split(new char[] {(char)'\t',' '}, StringSplitOptions.RemoveEmptyEntries);
string[] items = line.Split(new char[] { (char)'\t', ' ' }, StringSplitOptions.RemoveEmptyEntries);
if (items.Length <= 9)
continue;
@ -1664,41 +1642,38 @@ namespace ArdupilotMega.GCSViews
if (items[2] == "3")
{ // abs MAV_FRAME_GLOBAL_RELATIVE_ALT=3
temp.options = 1;
} else
}
else
{
temp.options = 0;
}
temp.id = (byte)(int)Enum.Parse(typeof(MAVLink.MAV_CMD), items[3], false);
temp.p1 = (byte)float.Parse(items[4], new System.Globalization.CultureInfo("en-US"));
temp.p1 = float.Parse(items[4], new System.Globalization.CultureInfo("en-US"));
if (temp.id == 99)
temp.id = 0;
if (temp.id < (byte)MAVLink.MAV_CMD.LAST || wp_count == 0)
{
temp.alt = (int)(double.Parse(items[10], new System.Globalization.CultureInfo("en-US")) * 100);
temp.lat = (int)(double.Parse(items[8], new System.Globalization.CultureInfo("en-US")) * 10000000);
temp.lng = (int)(double.Parse(items[9], new System.Globalization.CultureInfo("en-US")) * 10000000);
}
else
{
temp.alt = (int)(double.Parse(items[5], new System.Globalization.CultureInfo("en-US")));
temp.lat = (int)(double.Parse(items[6], new System.Globalization.CultureInfo("en-US")));
temp.lng = (int)(double.Parse(items[7], new System.Globalization.CultureInfo("en-US")));
}
temp.alt = (float)(double.Parse(items[10], new System.Globalization.CultureInfo("en-US")));
temp.lat = (float)(double.Parse(items[8], new System.Globalization.CultureInfo("en-US")));
temp.lng = (float)(double.Parse(items[9], new System.Globalization.CultureInfo("en-US")));
temp.p2 = (float)(double.Parse(items[5], new System.Globalization.CultureInfo("en-US")));
temp.p3 = (float)(double.Parse(items[6], new System.Globalization.CultureInfo("en-US")));
temp.p4 = (float)(double.Parse(items[7], new System.Globalization.CultureInfo("en-US")));
cmds.Add(temp);
wp_count++;
}
catch { MessageBox.Show("Line invalid\n" + line); }
if (wp_count == byte.MaxValue)
{
MessageBox.Show("To many Waypoints!!!");
break;
}
if (wp_count == byte.MaxValue)
{
MessageBox.Show("To many Waypoints!!!");
break;
}
}
sr.Close();
@ -1828,7 +1803,7 @@ namespace ArdupilotMega.GCSViews
{
if (CurentRectMarker.InnerMarker.Tag.ToString().Contains("grid"))
{
drawnpolygon.Points[int.Parse(CurentRectMarker.InnerMarker.Tag.ToString().Replace("grid","")) - 1] = new PointLatLng(end.Lat,end.Lng);
drawnpolygon.Points[int.Parse(CurentRectMarker.InnerMarker.Tag.ToString().Replace("grid", "")) - 1] = new PointLatLng(end.Lat, end.Lng);
MainMap.UpdatePolygonLocalPosition(drawnpolygon);
}
else
@ -2097,7 +2072,7 @@ namespace ArdupilotMega.GCSViews
{
// update row headers
((ComboBox)sender).ForeColor = Color.White;
ChangeColumnHeader((MAVLink.MAV_CMD)((ComboBox)sender).SelectedValue);
ChangeColumnHeader(((ComboBox)sender).Text);
}
/// <summary>
/// Get the Google earth ALT for a given coord
@ -2241,19 +2216,19 @@ namespace ArdupilotMega.GCSViews
{
double denom = ((end1.Lng - start1.Lng) * (end2.Lat - start2.Lat)) - ((end1.Lat - start1.Lat) * (end2.Lng - start2.Lng));
// AB & CD are parallel
if (denom == 0)
if (denom == 0)
return PointLatLng.Zero;
double numer = ((start1.Lat - start2.Lat) * (end2.Lng - start2.Lng)) - ((start1.Lng - start2.Lng) * (end2.Lat - start2.Lat));
double r = numer / denom;
double r = numer / denom;
double numer2 = ((start1.Lat - start2.Lat) * (end1.Lng - start1.Lng)) - ((start1.Lng - start2.Lng) * (end1.Lat - start1.Lat));
double s = numer2 / denom;
if ((r < 0 || r > 1) || (s < 0 || s > 1))
return PointLatLng.Zero;
double s = numer2 / denom;
if ((r < 0 || r > 1) || (s < 0 || s > 1))
return PointLatLng.Zero;
// Find intersection point
PointLatLng result = new PointLatLng();
result.Lng = start1.Lng + (r * (end1.Lng - start1.Lng));
result.Lat = start1.Lat + (r * (end1.Lat - start1.Lat));
return result;
result.Lat = start1.Lat + (r * (end1.Lat - start1.Lat));
return result;
}
RectLatLng getPolyMinMax(GMapPolygon poly)
@ -2351,7 +2326,7 @@ namespace ArdupilotMega.GCSViews
double x = bottomleft.Lat - Math.Abs(fulllatdiff);
double y = bottomleft.Lng - Math.Abs(fulllngdiff);
Console.WriteLine("{0} < {1} {2} < {3}", x , (topright.Lat) ,y , (topright.Lng));
Console.WriteLine("{0} < {1} {2} < {3}", x, (topright.Lat), y, (topright.Lng));
while (x < (topright.Lat + Math.Abs(fulllatdiff)) && y < (topright.Lng + Math.Abs(fulllngdiff)))
{
@ -2420,12 +2395,12 @@ namespace ArdupilotMega.GCSViews
}
}
}
if (!farestlatlong.IsZero)
callMe(farestlatlong.Lat, farestlatlong.Lng, altitude);
if (!closestlatlong.IsZero)
callMe(closestlatlong.Lat, closestlatlong.Lng - overshootdistlng, altitude);
//callMe(x, topright.Lng, altitude);
//callMe(x, bottomleft.Lng - overshootdistlng, altitude);
}
@ -2448,7 +2423,7 @@ namespace ArdupilotMega.GCSViews
newlatlong = FindLineIntersection(area.Points[a - 1], area.Points[a], new PointLatLng(ax, ay), new PointLatLng(bx, by));
if (!newlatlong.IsZero)
{
if (noc > MainMap.Manager.GetDistance(new PointLatLng(ax, ay),newlatlong))
if (noc > MainMap.Manager.GetDistance(new PointLatLng(ax, ay), newlatlong))
{
closestlatlong.Lat = newlatlong.Lat;
closestlatlong.Lng = newlatlong.Lng;
@ -2540,7 +2515,7 @@ namespace ArdupilotMega.GCSViews
if (startmeasure.IsZero)
{
startmeasure = start;
polygons.Markers.Add( new GMapMarkerGoogleRed(start));
polygons.Markers.Add(new GMapMarkerGoogleRed(start));
MainMap.Invalidate();
}
else
@ -2549,14 +2524,14 @@ namespace ArdupilotMega.GCSViews
polygonPoints.Add(startmeasure);
polygonPoints.Add(start);
GMapPolygon line = new GMapPolygon(polygonPoints,"measure dist");
GMapPolygon line = new GMapPolygon(polygonPoints, "measure dist");
line.Stroke.Color = Color.Green;
polygons.Polygons.Add(line);
polygons.Markers.Add(new GMapMarkerGoogleRed(start));
MainMap.Invalidate();
MessageBox.Show("Distance: " + FormatDistance(MainMap.Manager.GetDistance(startmeasure, start),true) + " AZ: " + (MainMap.Manager.GetBearing(startmeasure, start).ToString("0")));
MessageBox.Show("Distance: " + FormatDistance(MainMap.Manager.GetDistance(startmeasure, start), true) + " AZ: " + (MainMap.Manager.GetBearing(startmeasure, start).ToString("0")));
polygons.Polygons.Remove(line);
polygons.Markers.Clear();
startmeasure = new PointLatLng();
@ -2566,9 +2541,10 @@ namespace ArdupilotMega.GCSViews
private void rotateMapToolStripMenuItem_Click(object sender, EventArgs e)
{
string heading = "0";
Common.InputBox("Rotate map to heading","Enter new UP heading",ref heading);
Common.InputBox("Rotate map to heading", "Enter new UP heading", ref heading);
float ans = 0;
if (float.TryParse(heading,out ans)) {
if (float.TryParse(heading, out ans))
{
MainMap.Bearing = ans;
}
}
@ -2582,14 +2558,14 @@ namespace ArdupilotMega.GCSViews
polygongridmode = true;
List < PointLatLng > polygonPoints = new List<PointLatLng>();
List<PointLatLng> polygonPoints = new List<PointLatLng>();
if (drawnpolygons.Polygons.Count == 0)
{
drawnpolygon = new GMapPolygon(polygonPoints, "drawnpoly");
drawnpolygon.Stroke = new Pen(Color.Red,2);
drawnpolygon.Stroke = new Pen(Color.Red, 2);
drawnpolygons.Polygons.Add(drawnpolygon);
}
drawnpolygon.Points.Add(new PointLatLng(start.Lat,start.Lng));
drawnpolygon.Points.Add(new PointLatLng(start.Lat, start.Lng));
addpolygonmarkergrid(drawnpolygon.Points.Count.ToString(), start.Lng, start.Lat, 0);
@ -2621,7 +2597,7 @@ namespace ArdupilotMega.GCSViews
Commands.Rows[selectedrow].Cells[Command.Index].Value = MAVLink.MAV_CMD.LOITER_UNLIM;
setfromGE(end.Lat,end.Lng,(int)float.Parse(TXT_DefaultAlt.Text));
setfromGE(end.Lat, end.Lng, (int)float.Parse(TXT_DefaultAlt.Text));
}
private void jumpstartToolStripMenuItem_Click(object sender, EventArgs e)
@ -2641,7 +2617,7 @@ namespace ArdupilotMega.GCSViews
private void jumpwPToolStripMenuItem_Click(object sender, EventArgs e)
{
string wp = "1";
Common.InputBox("WP No", "Jump to WP no?",ref wp);
Common.InputBox("WP No", "Jump to WP no?", ref wp);
string repeat = "5";
Common.InputBox("Jump repeat", "Number of times to Repeat", ref repeat);

File diff suppressed because it is too large Load Diff

View File

@ -362,7 +362,7 @@ namespace ArdupilotMega
}
if (!run)
{
Console.WriteLine("Mavlink : NOT VALID PACKET sendPacket() "+indata.GetType().ToString());
Console.WriteLine("Mavlink : NOT VALID PACKET sendPacket() " + indata.GetType().ToString());
}
}
@ -401,7 +401,7 @@ namespace ArdupilotMega
#if MAVLINK10
packet[4] = (byte)MAV_COMPONENT.MAV_COMP_ID_MISSIONPLANNER;
#else
packet[4] = (byte)MAV_COMPONENT.MAV_COMP_ID_WAYPOINTPLANNER;
packet[4] = (byte)MAV_COMPONENT.MAV_COMP_ID_WAYPOINTPLANNER;
#endif
packet[5] = messageType;
@ -497,7 +497,7 @@ namespace ArdupilotMega
#if MAVLINK10
Array.Resize(ref temp, 16);
#else
Array.Resize(ref temp, 15);
Array.Resize(ref temp, 15);
#endif
req.param_id = temp;
req.param_value = (value);
@ -756,7 +756,7 @@ Array.Resize(ref temp, 15);
req.target_component = compid;
req.type = 0;
generatePacket(MAVLINK_MSG_ID_WAYPOINT_ACK, req);
generatePacket(MAVLINK_MSG_ID_WAYPOINT_ACK, req);
#endif
}
@ -981,7 +981,7 @@ Array.Resize(ref temp, 15);
}
}
}
#endif
}
@ -1182,7 +1182,7 @@ Array.Resize(ref temp, 15);
}
}
}
#else
#else
__mavlink_waypoint_request_list_t req = new __mavlink_waypoint_request_list_t();
@ -1228,8 +1228,8 @@ Array.Resize(ref temp, 15);
}
}
}
#endif
#endif
}
/// <summary>
/// Gets specfied WP
@ -1343,30 +1343,27 @@ Array.Resize(ref temp, 15);
loc.options = (byte)(wp.frame & 0x1);
loc.id = (byte)(wp.command);
loc.p1 = (byte)(wp.param1);
if (loc.id < (byte)MAV_CMD.LAST)
{
loc.alt = (int)((wp.z) * 100);
loc.lat = (int)((wp.x) * 10000000);
loc.lng = (int)((wp.y) * 10000000);
}
else
{
loc.alt = (int)((wp.z));
loc.lat = (int)((wp.x));
loc.lng = (int)((wp.y));
loc.p1 = (wp.param1);
loc.p2 = (wp.param2);
loc.p3 = (wp.param3);
loc.p4 = (wp.param4);
loc.alt = ((wp.z));
loc.lat = ((wp.x));
loc.lng = ((wp.y));
/*
if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane)
{
switch (loc.id)
{ // Switch to map APM command fields inot MAVLink command fields
case (byte)MAV_CMD.LOITER_TURNS:
case (byte)MAV_CMD.TAKEOFF:
case (byte)MAV_CMD.DO_SET_HOME:
//case (byte)MAV_CMD.DO_SET_ROI:
loc.alt = (int)((wp.z) * 100);
loc.lat = (int)((wp.x) * 10000000);
loc.lng = (int)((wp.y) * 10000000);
loc.p1 = (byte)wp.param1;
loc.alt = (float)((wp.z));
loc.lat = (float)((wp.x));
loc.lng = (float)((wp.y));
loc.p1 = (float)wp.param1;
break;
case (byte)MAV_CMD.CONDITION_CHANGE_ALT:
@ -1417,7 +1414,7 @@ Array.Resize(ref temp, 15);
break;
}
}
*/
Console.WriteLine("getWP {0} {1} {2} {3} {4} opt {5}", loc.id, loc.p1, loc.alt, loc.lat, loc.lng, loc.options);
break;
@ -1625,7 +1622,7 @@ Array.Resize(ref temp, 15);
}
}
#endif
#endif
}
/// <summary>
@ -1638,11 +1635,11 @@ Array.Resize(ref temp, 15);
public void setWP(Locationwp loc, ushort index, MAV_FRAME frame, byte current)
{
MainV2.givecomport = true;
#if MAVLINK10
#if MAVLINK10
__mavlink_mission_item_t req = new __mavlink_mission_item_t();
#else
__mavlink_waypoint_t req = new __mavlink_waypoint_t();
#endif
#else
__mavlink_waypoint_t req = new __mavlink_waypoint_t();
#endif
req.target_system = sysid;
req.target_component = compid; // MAVLINK_MSG_ID_MISSION_ITEM
@ -1652,20 +1649,18 @@ Array.Resize(ref temp, 15);
req.current = current;
if (loc.id < (byte)MAV_CMD.LAST)
{
req.frame = (byte)frame;
req.y = (float)(loc.lng / 10000000.0);
req.x = (float)(loc.lat / 10000000.0);
req.z = (float)(loc.alt / 100.0);
}
else
{
req.frame = (byte)MAVLink.MAV_FRAME.MAV_FRAME_MISSION; // mission
req.y = (float)(loc.lng);
req.x = (float)(loc.lat);
req.z = (float)(loc.alt);
req.frame = (byte)frame;
req.y = (float)(loc.lng);
req.x = (float)(loc.lat);
req.z = (float)(loc.alt);
req.param1 = loc.p1;
req.param2 = loc.p2;
req.param3 = loc.p3;
req.param4 = loc.p4;
/*
if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane)
{
switch (loc.id)
{ // Switch to map APM command fields inot MAVLink command fields
case (byte)MAV_CMD.LOITER_TURNS:
@ -1673,9 +1668,6 @@ Array.Resize(ref temp, 15);
req.param1 = loc.p1;
break;
case (byte)MAV_CMD.DO_SET_HOME:
req.y = (float)(loc.lng / 10000000.0);
req.x = (float)(loc.lat / 10000000.0);
req.z = (float)(loc.alt / 100.0);
req.param1 = loc.p1;
break;
@ -1717,16 +1709,17 @@ Array.Resize(ref temp, 15);
break;
}
}
*/
req.seq = index;
Console.WriteLine("setWP {6} frame {0} cmd {1} p1 {2} x {3} y {4} z {5}", req.frame, req.command, req.param1, req.x, req.y, req.z, index);
// request
#if MAVLINK10
#if MAVLINK10
generatePacket(MAVLINK_MSG_ID_MISSION_ITEM, req);
#else
generatePacket(MAVLINK_MSG_ID_WAYPOINT, req);
#endif
#else
generatePacket(MAVLINK_MSG_ID_WAYPOINT, req);
#endif
DateTime start = DateTime.Now;
int retrys = 6;
@ -1738,11 +1731,11 @@ Array.Resize(ref temp, 15);
if (retrys > 0)
{
Console.WriteLine("setWP Retry " + retrys);
#if MAVLINK10
#if MAVLINK10
generatePacket(MAVLINK_MSG_ID_MISSION_ITEM, req);
#else
generatePacket(MAVLINK_MSG_ID_WAYPOINT, req);
#endif
#else
generatePacket(MAVLINK_MSG_ID_WAYPOINT, req);
#endif
start = DateTime.Now;
retrys--;
continue;
@ -1753,7 +1746,7 @@ Array.Resize(ref temp, 15);
byte[] buffer = readPacket();
if (buffer.Length > 5)
{
#if MAVLINK10
#if MAVLINK10
if (buffer[5] == MAVLINK_MSG_ID_MISSION_ACK)
{
__mavlink_mission_ack_t ans = new __mavlink_mission_ack_t();
@ -1793,8 +1786,8 @@ Array.Resize(ref temp, 15);
{
//Console.WriteLine(DateTime.Now + " PC setwp " + buffer[5]);
}
#else
if (buffer[5] == MAVLINK_MSG_ID_WAYPOINT_ACK)
#else
if (buffer[5] == MAVLINK_MSG_ID_WAYPOINT_ACK)
{ //__mavlink_waypoint_request_t
Console.WriteLine("set wp " + index + " ACK 47 : " + buffer[5]);
break;
@ -1827,7 +1820,7 @@ Array.Resize(ref temp, 15);
{
//Console.WriteLine(DateTime.Now + " PC setwp " + buffer[5]);
}
#endif
#endif
}
}
}

View File

@ -24,9 +24,10 @@ namespace ArdupilotMega
Application.Idle += new EventHandler(Application_Idle);
MessageBox.Show("NOTE: This version may break advanced mission scripting");
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//Application.Run(new Camera());
Application.Run(new MainV2());
}

View File

@ -34,5 +34,5 @@ using System.Resources;
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.93")]
[assembly: AssemblyFileVersion("1.0.94")]
[assembly: NeutralResourcesLanguageAttribute("")]

View File

@ -113,18 +113,42 @@
this.pictureBoxQuad = new System.Windows.Forms.PictureBox();
this.BUT_levelac2 = new ArdupilotMega.MyButton();
this.tabHeli = new System.Windows.Forms.TabPage();
this.label27 = new System.Windows.Forms.Label();
this.GYR_GAIN_ = new System.Windows.Forms.TextBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label46 = new System.Windows.Forms.Label();
this.label45 = new System.Windows.Forms.Label();
this.GYR_ENABLE_ = new System.Windows.Forms.CheckBox();
this.GYR_GAIN_ = new System.Windows.Forms.TextBox();
this.label44 = new System.Windows.Forms.Label();
this.label43 = new System.Windows.Forms.Label();
this.label42 = new System.Windows.Forms.Label();
this.BUT_HS4save = new ArdupilotMega.MyButton();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.label24 = new System.Windows.Forms.Label();
this.HS4_MIN = new System.Windows.Forms.TextBox();
this.HS4_MAX = new System.Windows.Forms.TextBox();
this.label40 = new System.Windows.Forms.Label();
this.BUT_swash_manual = new ArdupilotMega.MyButton();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label41 = new System.Windows.Forms.Label();
this.label21 = new System.Windows.Forms.Label();
this.COL_MIN_ = new System.Windows.Forms.TextBox();
this.COL_MID_ = new System.Windows.Forms.TextBox();
this.COL_MAX_ = new System.Windows.Forms.TextBox();
this.BUT_0collective = new ArdupilotMega.MyButton();
this.HS4_TRIM = new System.Windows.Forms.NumericUpDown();
this.HS3_TRIM = new System.Windows.Forms.NumericUpDown();
this.HS2_TRIM = new System.Windows.Forms.NumericUpDown();
this.HS1_TRIM = new System.Windows.Forms.NumericUpDown();
this.label39 = new System.Windows.Forms.Label();
this.label38 = new System.Windows.Forms.Label();
this.label37 = new System.Windows.Forms.Label();
this.label36 = new System.Windows.Forms.Label();
this.label26 = new System.Windows.Forms.Label();
this.PIT_MAX_ = new System.Windows.Forms.TextBox();
this.label25 = new System.Windows.Forms.Label();
this.ROL_MAX_ = new System.Windows.Forms.TextBox();
this.label24 = new System.Windows.Forms.Label();
this.COL_MID_ = new System.Windows.Forms.Label();
this.label23 = new System.Windows.Forms.Label();
this.label22 = new System.Windows.Forms.Label();
this.label21 = new System.Windows.Forms.Label();
this.HS4_REV = new System.Windows.Forms.CheckBox();
this.label20 = new System.Windows.Forms.Label();
this.label19 = new System.Windows.Forms.Label();
@ -136,14 +160,8 @@
this.HS2_REV = new System.Windows.Forms.CheckBox();
this.HS1_REV = new System.Windows.Forms.CheckBox();
this.label17 = new System.Windows.Forms.Label();
this.BUT_saveheliconfig = new ArdupilotMega.MyButton();
this.BUT_0collective = new ArdupilotMega.MyButton();
this.HS4 = new ArdupilotMega.VerticalProgressBar2();
this.HS4 = new ArdupilotMega.HorizontalProgressBar2();
this.HS3 = new ArdupilotMega.VerticalProgressBar2();
this.HS4_TRIM = new ArdupilotMega.MyTrackBar();
this.HS3_TRIM = new ArdupilotMega.MyTrackBar();
this.HS2_TRIM = new ArdupilotMega.MyTrackBar();
this.HS1_TRIM = new ArdupilotMega.MyTrackBar();
this.Gservoloc = new AGaugeApp.AGauge();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.tabControl1.SuspendLayout();
@ -161,6 +179,9 @@
((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuadX)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuad)).BeginInit();
this.tabHeli.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.HS4_TRIM)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.HS3_TRIM)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.HS2_TRIM)).BeginInit();
@ -849,18 +870,28 @@
//
// tabHeli
//
this.tabHeli.Controls.Add(this.label27);
this.tabHeli.Controls.Add(this.GYR_GAIN_);
this.tabHeli.Controls.Add(this.GYR_ENABLE_);
this.tabHeli.Controls.Add(this.groupBox3);
this.tabHeli.Controls.Add(this.label44);
this.tabHeli.Controls.Add(this.label43);
this.tabHeli.Controls.Add(this.label42);
this.tabHeli.Controls.Add(this.BUT_HS4save);
this.tabHeli.Controls.Add(this.groupBox2);
this.tabHeli.Controls.Add(this.BUT_swash_manual);
this.tabHeli.Controls.Add(this.groupBox1);
this.tabHeli.Controls.Add(this.HS4_TRIM);
this.tabHeli.Controls.Add(this.HS3_TRIM);
this.tabHeli.Controls.Add(this.HS2_TRIM);
this.tabHeli.Controls.Add(this.HS1_TRIM);
this.tabHeli.Controls.Add(this.label39);
this.tabHeli.Controls.Add(this.label38);
this.tabHeli.Controls.Add(this.label37);
this.tabHeli.Controls.Add(this.label36);
this.tabHeli.Controls.Add(this.label26);
this.tabHeli.Controls.Add(this.PIT_MAX_);
this.tabHeli.Controls.Add(this.label25);
this.tabHeli.Controls.Add(this.ROL_MAX_);
this.tabHeli.Controls.Add(this.label24);
this.tabHeli.Controls.Add(this.COL_MID_);
this.tabHeli.Controls.Add(this.label23);
this.tabHeli.Controls.Add(this.label22);
this.tabHeli.Controls.Add(this.label21);
this.tabHeli.Controls.Add(this.HS4_REV);
this.tabHeli.Controls.Add(this.label20);
this.tabHeli.Controls.Add(this.label19);
@ -872,29 +903,33 @@
this.tabHeli.Controls.Add(this.HS2_REV);
this.tabHeli.Controls.Add(this.HS1_REV);
this.tabHeli.Controls.Add(this.label17);
this.tabHeli.Controls.Add(this.BUT_saveheliconfig);
this.tabHeli.Controls.Add(this.BUT_0collective);
this.tabHeli.Controls.Add(this.HS4);
this.tabHeli.Controls.Add(this.HS3);
this.tabHeli.Controls.Add(this.HS4_TRIM);
this.tabHeli.Controls.Add(this.HS3_TRIM);
this.tabHeli.Controls.Add(this.HS2_TRIM);
this.tabHeli.Controls.Add(this.HS1_TRIM);
this.tabHeli.Controls.Add(this.Gservoloc);
resources.ApplyResources(this.tabHeli, "tabHeli");
this.tabHeli.Name = "tabHeli";
this.tabHeli.UseVisualStyleBackColor = true;
this.tabHeli.Click += new System.EventHandler(this.tabHeli_Click);
//
// label27
// groupBox3
//
resources.ApplyResources(this.label27, "label27");
this.label27.Name = "label27";
this.groupBox3.Controls.Add(this.label46);
this.groupBox3.Controls.Add(this.label45);
this.groupBox3.Controls.Add(this.GYR_ENABLE_);
this.groupBox3.Controls.Add(this.GYR_GAIN_);
resources.ApplyResources(this.groupBox3, "groupBox3");
this.groupBox3.Name = "groupBox3";
this.groupBox3.TabStop = false;
//
// GYR_GAIN_
// label46
//
resources.ApplyResources(this.GYR_GAIN_, "GYR_GAIN_");
this.GYR_GAIN_.Name = "GYR_GAIN_";
this.GYR_GAIN_.Validating += new System.ComponentModel.CancelEventHandler(this.GYR_GAIN__Validating);
resources.ApplyResources(this.label46, "label46");
this.label46.Name = "label46";
//
// label45
//
resources.ApplyResources(this.label45, "label45");
this.label45.Name = "label45";
//
// GYR_ENABLE_
//
@ -903,6 +938,232 @@
this.GYR_ENABLE_.UseVisualStyleBackColor = true;
this.GYR_ENABLE_.CheckedChanged += new System.EventHandler(this.GYR_ENABLE__CheckedChanged);
//
// GYR_GAIN_
//
resources.ApplyResources(this.GYR_GAIN_, "GYR_GAIN_");
this.GYR_GAIN_.Name = "GYR_GAIN_";
this.GYR_GAIN_.Validating += new System.ComponentModel.CancelEventHandler(this.GYR_GAIN__Validating);
//
// label44
//
resources.ApplyResources(this.label44, "label44");
this.label44.Name = "label44";
//
// label43
//
resources.ApplyResources(this.label43, "label43");
this.label43.Name = "label43";
//
// label42
//
resources.ApplyResources(this.label42, "label42");
this.label42.Name = "label42";
//
// BUT_HS4save
//
resources.ApplyResources(this.BUT_HS4save, "BUT_HS4save");
this.BUT_HS4save.Name = "BUT_HS4save";
this.BUT_HS4save.UseVisualStyleBackColor = true;
this.BUT_HS4save.Click += new System.EventHandler(this.BUT_HS4save_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.label24);
this.groupBox2.Controls.Add(this.HS4_MIN);
this.groupBox2.Controls.Add(this.HS4_MAX);
this.groupBox2.Controls.Add(this.label40);
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Name = "groupBox2";
this.groupBox2.TabStop = false;
//
// label24
//
resources.ApplyResources(this.label24, "label24");
this.label24.Name = "label24";
//
// HS4_MIN
//
resources.ApplyResources(this.HS4_MIN, "HS4_MIN");
this.HS4_MIN.Name = "HS4_MIN";
this.HS4_MIN.Enter += new System.EventHandler(this.HS4_MIN_Enter);
this.HS4_MIN.Leave += new System.EventHandler(this.HS4_MIN_Leave);
this.HS4_MIN.Validating += new System.ComponentModel.CancelEventHandler(this.PWM_Validating);
//
// HS4_MAX
//
resources.ApplyResources(this.HS4_MAX, "HS4_MAX");
this.HS4_MAX.Name = "HS4_MAX";
this.HS4_MAX.Enter += new System.EventHandler(this.HS4_MAX_Enter);
this.HS4_MAX.Leave += new System.EventHandler(this.HS4_MAX_Leave);
this.HS4_MAX.Validating += new System.ComponentModel.CancelEventHandler(this.PWM_Validating);
//
// label40
//
resources.ApplyResources(this.label40, "label40");
this.label40.Name = "label40";
//
// BUT_swash_manual
//
resources.ApplyResources(this.BUT_swash_manual, "BUT_swash_manual");
this.BUT_swash_manual.Name = "BUT_swash_manual";
this.BUT_swash_manual.UseVisualStyleBackColor = true;
this.BUT_swash_manual.Click += new System.EventHandler(this.BUT_swash_manual_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label41);
this.groupBox1.Controls.Add(this.label21);
this.groupBox1.Controls.Add(this.COL_MIN_);
this.groupBox1.Controls.Add(this.COL_MID_);
this.groupBox1.Controls.Add(this.COL_MAX_);
this.groupBox1.Controls.Add(this.BUT_0collective);
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Name = "groupBox1";
this.groupBox1.TabStop = false;
//
// label41
//
resources.ApplyResources(this.label41, "label41");
this.label41.Name = "label41";
//
// label21
//
resources.ApplyResources(this.label21, "label21");
this.label21.Name = "label21";
//
// COL_MIN_
//
resources.ApplyResources(this.COL_MIN_, "COL_MIN_");
this.COL_MIN_.Name = "COL_MIN_";
this.COL_MIN_.Enter += new System.EventHandler(this.COL_MIN__Enter);
this.COL_MIN_.Leave += new System.EventHandler(this.COL_MIN__Leave);
this.COL_MIN_.Validating += new System.ComponentModel.CancelEventHandler(this.PWM_Validating);
//
// COL_MID_
//
resources.ApplyResources(this.COL_MID_, "COL_MID_");
this.COL_MID_.Name = "COL_MID_";
this.COL_MID_.Validating += new System.ComponentModel.CancelEventHandler(this.PWM_Validating);
//
// COL_MAX_
//
resources.ApplyResources(this.COL_MAX_, "COL_MAX_");
this.COL_MAX_.Name = "COL_MAX_";
this.COL_MAX_.Enter += new System.EventHandler(this.COL_MAX__Enter);
this.COL_MAX_.Leave += new System.EventHandler(this.COL_MAX__Leave);
this.COL_MAX_.Validating += new System.ComponentModel.CancelEventHandler(this.PWM_Validating);
//
// BUT_0collective
//
resources.ApplyResources(this.BUT_0collective, "BUT_0collective");
this.BUT_0collective.Name = "BUT_0collective";
this.BUT_0collective.UseVisualStyleBackColor = true;
this.BUT_0collective.Click += new System.EventHandler(this.BUT_0collective_Click);
//
// HS4_TRIM
//
resources.ApplyResources(this.HS4_TRIM, "HS4_TRIM");
this.HS4_TRIM.Maximum = new decimal(new int[] {
2000,
0,
0,
0});
this.HS4_TRIM.Minimum = new decimal(new int[] {
1000,
0,
0,
0});
this.HS4_TRIM.Name = "HS4_TRIM";
this.HS4_TRIM.Value = new decimal(new int[] {
1500,
0,
0,
0});
this.HS4_TRIM.ValueChanged += new System.EventHandler(this.HS4_TRIM_ValueChanged);
//
// HS3_TRIM
//
resources.ApplyResources(this.HS3_TRIM, "HS3_TRIM");
this.HS3_TRIM.Maximum = new decimal(new int[] {
2000,
0,
0,
0});
this.HS3_TRIM.Minimum = new decimal(new int[] {
1000,
0,
0,
0});
this.HS3_TRIM.Name = "HS3_TRIM";
this.HS3_TRIM.Value = new decimal(new int[] {
1500,
0,
0,
0});
this.HS3_TRIM.ValueChanged += new System.EventHandler(this.HS3_TRIM_ValueChanged);
//
// HS2_TRIM
//
resources.ApplyResources(this.HS2_TRIM, "HS2_TRIM");
this.HS2_TRIM.Maximum = new decimal(new int[] {
2000,
0,
0,
0});
this.HS2_TRIM.Minimum = new decimal(new int[] {
1000,
0,
0,
0});
this.HS2_TRIM.Name = "HS2_TRIM";
this.HS2_TRIM.Value = new decimal(new int[] {
1500,
0,
0,
0});
this.HS2_TRIM.ValueChanged += new System.EventHandler(this.HS2_TRIM_ValueChanged);
//
// HS1_TRIM
//
resources.ApplyResources(this.HS1_TRIM, "HS1_TRIM");
this.HS1_TRIM.Maximum = new decimal(new int[] {
2000,
0,
0,
0});
this.HS1_TRIM.Minimum = new decimal(new int[] {
1000,
0,
0,
0});
this.HS1_TRIM.Name = "HS1_TRIM";
this.HS1_TRIM.Value = new decimal(new int[] {
1500,
0,
0,
0});
this.HS1_TRIM.ValueChanged += new System.EventHandler(this.HS1_TRIM_ValueChanged);
//
// label39
//
resources.ApplyResources(this.label39, "label39");
this.label39.Name = "label39";
//
// label38
//
resources.ApplyResources(this.label38, "label38");
this.label38.Name = "label38";
//
// label37
//
resources.ApplyResources(this.label37, "label37");
this.label37.Name = "label37";
//
// label36
//
resources.ApplyResources(this.label36, "label36");
this.label36.Name = "label36";
//
// label26
//
resources.ApplyResources(this.label26, "label26");
@ -925,16 +1186,6 @@
this.ROL_MAX_.Name = "ROL_MAX_";
this.ROL_MAX_.Validating += new System.ComponentModel.CancelEventHandler(this.ROL_MAX__Validating);
//
// label24
//
resources.ApplyResources(this.label24, "label24");
this.label24.Name = "label24";
//
// COL_MID_
//
resources.ApplyResources(this.COL_MID_, "COL_MID_");
this.COL_MID_.Name = "COL_MID_";
//
// label23
//
resources.ApplyResources(this.label23, "label23");
@ -945,11 +1196,6 @@
resources.ApplyResources(this.label22, "label22");
this.label22.Name = "label22";
//
// label21
//
resources.ApplyResources(this.label21, "label21");
this.label21.Name = "label21";
//
// HS4_REV
//
resources.ApplyResources(this.HS4_REV, "HS4_REV");
@ -1016,20 +1262,6 @@
resources.ApplyResources(this.label17, "label17");
this.label17.Name = "label17";
//
// BUT_saveheliconfig
//
resources.ApplyResources(this.BUT_saveheliconfig, "BUT_saveheliconfig");
this.BUT_saveheliconfig.Name = "BUT_saveheliconfig";
this.BUT_saveheliconfig.UseVisualStyleBackColor = true;
this.BUT_saveheliconfig.Click += new System.EventHandler(this.BUT_saveheliconfig_Click);
//
// BUT_0collective
//
resources.ApplyResources(this.BUT_0collective, "BUT_0collective");
this.BUT_0collective.Name = "BUT_0collective";
this.BUT_0collective.UseVisualStyleBackColor = true;
this.BUT_0collective.Click += new System.EventHandler(this.BUT_0collective_Click);
//
// HS4
//
this.HS4.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(67)))), ((int)(((byte)(68)))), ((int)(((byte)(69)))));
@ -1044,6 +1276,7 @@
this.HS4.Name = "HS4";
this.HS4.Value = 1500;
this.HS4.ValueColor = System.Drawing.Color.FromArgb(((int)(((byte)(148)))), ((int)(((byte)(193)))), ((int)(((byte)(31)))));
this.HS4.Paint += new System.Windows.Forms.PaintEventHandler(this.HS4_Paint);
//
// HS3
//
@ -1059,54 +1292,7 @@
this.HS3.Name = "HS3";
this.HS3.Value = 1500;
this.HS3.ValueColor = System.Drawing.Color.FromArgb(((int)(((byte)(148)))), ((int)(((byte)(193)))), ((int)(((byte)(31)))));
//
// HS4_TRIM
//
resources.ApplyResources(this.HS4_TRIM, "HS4_TRIM");
this.HS4_TRIM.LargeChange = 1000;
this.HS4_TRIM.Maximum = 2000D;
this.HS4_TRIM.Minimum = 1000D;
this.HS4_TRIM.Name = "HS4_TRIM";
this.HS4_TRIM.SmallChange = 1000;
this.HS4_TRIM.TickFrequency = 2000;
this.HS4_TRIM.Value = 1500D;
this.HS4_TRIM.Scroll += new System.EventHandler(this.HS4_TRIM_Scroll);
//
// HS3_TRIM
//
resources.ApplyResources(this.HS3_TRIM, "HS3_TRIM");
this.HS3_TRIM.LargeChange = 1000;
this.HS3_TRIM.Maximum = 2000D;
this.HS3_TRIM.Minimum = 1000D;
this.HS3_TRIM.Name = "HS3_TRIM";
this.HS3_TRIM.SmallChange = 1000;
this.HS3_TRIM.TickFrequency = 2000;
this.HS3_TRIM.Value = 1500D;
this.HS3_TRIM.Scroll += new System.EventHandler(this.HS3_TRIM_Scroll);
//
// HS2_TRIM
//
resources.ApplyResources(this.HS2_TRIM, "HS2_TRIM");
this.HS2_TRIM.LargeChange = 1000;
this.HS2_TRIM.Maximum = 2000D;
this.HS2_TRIM.Minimum = 1000D;
this.HS2_TRIM.Name = "HS2_TRIM";
this.HS2_TRIM.SmallChange = 1000;
this.HS2_TRIM.TickFrequency = 2000;
this.HS2_TRIM.Value = 1500D;
this.HS2_TRIM.Scroll += new System.EventHandler(this.HS2_TRIM_Scroll);
//
// HS1_TRIM
//
resources.ApplyResources(this.HS1_TRIM, "HS1_TRIM");
this.HS1_TRIM.LargeChange = 1000;
this.HS1_TRIM.Maximum = 2000D;
this.HS1_TRIM.Minimum = 1000D;
this.HS1_TRIM.Name = "HS1_TRIM";
this.HS1_TRIM.SmallChange = 1000;
this.HS1_TRIM.TickFrequency = 2000;
this.HS1_TRIM.Value = 1500D;
this.HS1_TRIM.Scroll += new System.EventHandler(this.HS1_TRIM_Scroll);
this.HS3.Paint += new System.Windows.Forms.PaintEventHandler(this.HS3_Paint);
//
// Gservoloc
//
@ -1280,6 +1466,12 @@
((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuad)).EndInit();
this.tabHeli.ResumeLayout(false);
this.tabHeli.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.HS4_TRIM)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.HS3_TRIM)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.HS2_TRIM)).EndInit();
@ -1355,26 +1547,17 @@
private System.Windows.Forms.TextBox SV2_POS_;
private System.Windows.Forms.TextBox SV1_POS_;
private System.Windows.Forms.CheckBox HS4_REV;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.Label label22;
private MyTrackBar HS1_TRIM;
private MyTrackBar HS4_TRIM;
private MyTrackBar HS3_TRIM;
private MyTrackBar HS2_TRIM;
private System.Windows.Forms.Label label23;
private VerticalProgressBar2 HS4;
private HorizontalProgressBar2 HS4;
private VerticalProgressBar2 HS3;
private MyButton BUT_0collective;
private MyButton BUT_saveheliconfig;
private System.Windows.Forms.Label label24;
private System.Windows.Forms.Label COL_MID_;
private System.Windows.Forms.Label label25;
private System.Windows.Forms.TextBox ROL_MAX_;
private System.Windows.Forms.Label label26;
private System.Windows.Forms.TextBox PIT_MAX_;
private System.Windows.Forms.TextBox GYR_GAIN_;
private System.Windows.Forms.CheckBox GYR_ENABLE_;
private System.Windows.Forms.Label label27;
private System.Windows.Forms.Label label28;
private MyButton BUT_levelac2;
private System.Windows.Forms.ToolTip toolTip1;
@ -1406,6 +1589,33 @@
private System.Windows.Forms.Label label34;
private System.Windows.Forms.Label label33;
private System.Windows.Forms.Label label32;
private System.Windows.Forms.NumericUpDown HS1_TRIM;
private System.Windows.Forms.Label label39;
private System.Windows.Forms.Label label38;
private System.Windows.Forms.Label label37;
private System.Windows.Forms.Label label36;
private System.Windows.Forms.NumericUpDown HS3_TRIM;
private System.Windows.Forms.NumericUpDown HS2_TRIM;
private System.Windows.Forms.NumericUpDown HS4_TRIM;
private System.Windows.Forms.GroupBox groupBox1;
private MyButton BUT_swash_manual;
private System.Windows.Forms.TextBox COL_MIN_;
private System.Windows.Forms.TextBox COL_MID_;
private System.Windows.Forms.TextBox COL_MAX_;
private System.Windows.Forms.Label label41;
private System.Windows.Forms.Label label21;
private MyButton BUT_HS4save;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label24;
private System.Windows.Forms.TextBox HS4_MIN;
private System.Windows.Forms.TextBox HS4_MAX;
private System.Windows.Forms.Label label40;
private System.Windows.Forms.Label label42;
private System.Windows.Forms.Label label44;
private System.Windows.Forms.Label label43;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Label label46;
private System.Windows.Forms.Label label45;
}
}

View File

@ -15,6 +15,8 @@ namespace ArdupilotMega.Setup
bool run = false;
bool startup = false;
bool inpwmdetect = false;
const float rad2deg = (float)(180 / Math.PI);
const float deg2rad = (float)(1.0 / rad2deg);
@ -73,6 +75,9 @@ namespace ArdupilotMega.Setup
if (tabControl1.SelectedTab == tabHeli)
{
if (MainV2.comPort.param["HSV_MAN"].ToString() == "0")
return;
if (HS3.minline == 0)
HS3.minline = 2200;
@ -84,6 +89,23 @@ namespace ArdupilotMega.Setup
HS4.minline = Math.Min(HS4.minline, (int)MainV2.cs.ch4in);
HS4.maxline = Math.Max(HS4.maxline, (int)MainV2.cs.ch4in);
if (!inpwmdetect)
{
HS3_Paint(null, null);
HS4_Paint(null, null);
}
else
{
try
{
HS3.minline = int.Parse(COL_MIN_.Text);
HS3.maxline = int.Parse(COL_MAX_.Text);
HS4.maxline = int.Parse(HS4_MIN.Text);
HS4.minline = int.Parse(HS4_MAX.Text);
}
catch { }
}
}
}
@ -854,7 +876,10 @@ namespace ArdupilotMega.Setup
try
{
MainV2.comPort.setParam("HSV_MAN", 1); // randy request
MainV2.comPort.setParam(((TextBox)sender).Name, test);
System.Threading.Thread.Sleep(100);
MainV2.comPort.setParam("HSV_MAN", 0); // randy request - last
}
catch { MessageBox.Show("Set " + ((TextBox)sender).Name + " failed"); }
@ -874,7 +899,10 @@ namespace ArdupilotMega.Setup
try
{
MainV2.comPort.setParam("HSV_MAN", 1); // randy request
MainV2.comPort.setParam(((TextBox)sender).Name, test);
System.Threading.Thread.Sleep(100);
MainV2.comPort.setParam("HSV_MAN", 0); // randy request - last
}
catch { MessageBox.Show("Set " + ((TextBox)sender).Name + " failed"); }
}
@ -893,7 +921,10 @@ namespace ArdupilotMega.Setup
try
{
MainV2.comPort.setParam("HSV_MAN", 1); // randy request
MainV2.comPort.setParam(((TextBox)sender).Name, test);
System.Threading.Thread.Sleep(100);
MainV2.comPort.setParam("HSV_MAN", 0); // randy request - last
}
catch { MessageBox.Show("Set " + ((TextBox)sender).Name + " failed"); }
}
@ -938,34 +969,35 @@ namespace ArdupilotMega.Setup
if (startup)
return;
MainV2.comPort.setParam(((CheckBox)sender).Name, ((CheckBox)sender).Checked == false ? 1.0f : -1.0f);
HS4.reverse = !HS4.reverse;
}
private void HS1_TRIM_Scroll(object sender, EventArgs e)
private void HS1_TRIM_ValueChanged(object sender, EventArgs e)
{
if (startup)
return;
MainV2.comPort.setParam(((MyTrackBar)sender).Name, (float)((MyTrackBar)sender).Value);
MainV2.comPort.setParam(((NumericUpDown)sender).Name, (float)((NumericUpDown)sender).Value);
}
private void HS2_TRIM_Scroll(object sender, EventArgs e)
private void HS2_TRIM_ValueChanged(object sender, EventArgs e)
{
if (startup)
return;
MainV2.comPort.setParam(((MyTrackBar)sender).Name, (float)((MyTrackBar)sender).Value);
MainV2.comPort.setParam(((NumericUpDown)sender).Name, (float)((NumericUpDown)sender).Value);
}
private void HS3_TRIM_Scroll(object sender, EventArgs e)
private void HS3_TRIM_ValueChanged(object sender, EventArgs e)
{
if (startup)
return;
MainV2.comPort.setParam(((MyTrackBar)sender).Name, (float)((MyTrackBar)sender).Value);
MainV2.comPort.setParam(((NumericUpDown)sender).Name, (float)((NumericUpDown)sender).Value);
}
private void HS4_TRIM_Scroll(object sender, EventArgs e)
private void HS4_TRIM_ValueChanged(object sender, EventArgs e)
{
if (startup)
return;
MainV2.comPort.setParam(((MyTrackBar)sender).Name, (float)((MyTrackBar)sender).Value);
MainV2.comPort.setParam(((NumericUpDown)sender).Name, (float)((NumericUpDown)sender).Value);
}
private void ROL_MAX__Validating(object sender, CancelEventArgs e)
@ -1018,33 +1050,6 @@ namespace ArdupilotMega.Setup
MainV2.comPort.setParam(((CheckBox)sender).Name, ((CheckBox)sender).Checked == true ? 1.0f : 0.0f);
}
private void BUT_saveheliconfig_Click(object sender, EventArgs e)
{
try
{
try
{
if (MainV2.comPort.param["HSV_MAN"].ToString() == "1")
{
MainV2.comPort.setParam("HSV_MAN", 0); // randy request
}
else
{
MainV2.comPort.setParam("HSV_MAN", 1); // randy request
return;
}
}
catch { MessageBox.Show("Failed to set HSV_MAN"); }
MainV2.comPort.setParam("COL_MIN_", HS3.minline);
MainV2.comPort.setParam("COL_MAX_", HS3.maxline);
MainV2.comPort.setParam("HS4_MIN", HS4.minline);
MainV2.comPort.setParam("HS4_MAX", HS4.maxline);
}
catch { MessageBox.Show("Failed to set min/max"); }
}
private void BUT_levelac2_Click(object sender, EventArgs e)
{
try
@ -1127,5 +1132,127 @@ namespace ArdupilotMega.Setup
{
reverseChannel("RC4_REV", ((CheckBox)sender).Checked, BARyaw);
}
private void BUT_swash_manual_Click(object sender, EventArgs e)
{
try
{
if (MainV2.comPort.param["HSV_MAN"].ToString() == "1")
{
MainV2.comPort.setParam("COL_MIN_", int.Parse(COL_MIN_.Text));
MainV2.comPort.setParam("COL_MAX_", int.Parse(COL_MAX_.Text));
MainV2.comPort.setParam("HSV_MAN", 0); // randy request - last
BUT_swash_manual.Text = "Manual";
}
else
{
COL_MAX_.Text = "1500";
COL_MIN_.Text = "1500";
MainV2.comPort.setParam("HSV_MAN", 1); // randy request
BUT_swash_manual.Text = "Save";
}
}
catch { MessageBox.Show("Failed to set HSV_MAN"); }
}
private void BUT_HS4save_Click(object sender, EventArgs e)
{
try
{
if (MainV2.comPort.param["HSV_MAN"].ToString() == "1")
{
MainV2.comPort.setParam("HS4_MIN", int.Parse(HS4_MIN.Text));
MainV2.comPort.setParam("HS4_MAX", int.Parse(HS4_MAX.Text));
MainV2.comPort.setParam("HSV_MAN", 0); // randy request - last
BUT_HS4save.Text = "Manual";
}
else
{
HS4_MIN.Text = "1500";
HS4_MAX.Text = "1500";
MainV2.comPort.setParam("HSV_MAN", 1); // randy request
BUT_HS4save.Text = "Save";
}
}
catch { MessageBox.Show("Failed to set HSV_MAN"); }
}
private void tabHeli_Click(object sender, EventArgs e)
{
}
private void HS4_Paint(object sender, PaintEventArgs e)
{
try
{
if (int.Parse(HS4_MIN.Text) > HS4.minline)
HS4_MIN.Text = HS4.minline.ToString();
if (int.Parse(HS4_MAX.Text) < HS4.maxline)
HS4_MAX.Text = HS4.maxline.ToString();
} catch {}
}
private void HS3_Paint(object sender, PaintEventArgs e)
{
try
{
if (int.Parse(COL_MIN_.Text) > HS3.minline)
COL_MIN_.Text = HS3.minline.ToString();
if (int.Parse(COL_MAX_.Text) < HS3.maxline)
COL_MAX_.Text = HS3.maxline.ToString();
}
catch { }
}
private void COL_MAX__Enter(object sender, EventArgs e)
{
inpwmdetect = true;
}
private void COL_MIN__Enter(object sender, EventArgs e)
{
inpwmdetect = true;
}
private void COL_MAX__Leave(object sender, EventArgs e)
{
inpwmdetect = false;
}
private void COL_MIN__Leave(object sender, EventArgs e)
{
inpwmdetect = false;
}
private void HS4_MIN_Enter(object sender, EventArgs e)
{
inpwmdetect = true;
}
private void HS4_MIN_Leave(object sender, EventArgs e)
{
inpwmdetect = false;
}
private void HS4_MAX_Enter(object sender, EventArgs e)
{
inpwmdetect = true;
}
private void HS4_MAX_Leave(object sender, EventArgs e)
{
inpwmdetect = false;
}
private void PWM_Validating(object sender, CancelEventArgs e)
{
Control temp = (Control)(sender);
if (int.Parse(temp.Text) < 900)
temp.Text = "900";
if (int.Parse(temp.Text) > 2100)
temp.Text = "2100";
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -4,14 +4,14 @@
<description asmv2:publisher="Michael Oborne" asmv2:product="ArdupilotMegaPlanner" xmlns="urn:schemas-microsoft-com:asm.v1" />
<deployment install="true" />
<dependency>
<dependentAssembly dependencyType="install" codebase="ArdupilotMegaPlanner.exe.manifest" size="18145">
<dependentAssembly dependencyType="install" codebase="ArdupilotMegaPlanner.exe.manifest" size="18547">
<assemblyIdentity name="ArdupilotMegaPlanner.exe" version="0.0.0.1" publicKeyToken="0000000000000000" language="en-US" processorArchitecture="x86" type="win32" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<dsig:DigestValue>aOdOGvvGucYFaUhittfTQbVF+gA=</dsig:DigestValue>
<dsig:DigestValue>N43U7y77mNy6nfkD9v5DNdwNLps=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,62 @@
<?xml version="1.0"?>
<!-- TAGS ARE CASE SENSATIVE -->
<CMD>
<AC2>
<WAYPOINT><P1>Delay</P1><P2>Hit Rad</P2><P3></P3><P4>Yaw Ang</P4><X>Lat</X><Y>Long</Y><Z>Alt</Z></WAYPOINT>
<LOITER_UNLIM><P1></P1><P2></P2><P3></P3><P4></P4><X>Lat</X><Y>Long</Y><Z>Alt</Z></LOITER_UNLIM>
<LOITER_TURNS><P1>Turns</P1><P2></P2><P3></P3><P4></P4><X>Lat</X><Y>Long</Y><Z>Alt</Z></LOITER_TURNS>
<LOITER_TIME><P1>Time s</P1><P2></P2><P3>rad</P3><P4>yaw per</P4><X></X><Y></Y><Z></Z></LOITER_TIME>
<RETURN_TO_LAUNCH><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z>Alt</Z></RETURN_TO_LAUNCH>
<LAND><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></LAND>
<TAKEOFF><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z>Alt</Z></TAKEOFF>
<ROI><P1>MAV_ROI</P1><P2>WP#</P2><P3>ROI#</P3><P4></P4><X></X><Y></Y><Z></Z></ROI>
<PATHPLANNING><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></PATHPLANNING>
<CONDITION_DELAY><P1>Time (sec)</P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></CONDITION_DELAY>
<CONDITION_CHANGE_ALT><P1>Rate (cm/sec)</P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z>Alt</Z></CONDITION_CHANGE_ALT>
<CONDITION_DISTANCE><P1>Dist (m)</P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></CONDITION_DISTANCE>
<CONDITION_YAW><P1>Deg</P1><P2>Sec</P2><P3>Dir 1=CW</P3><P4>rel/abs</P4><X></X><Y></Y><Z></Z></CONDITION_YAW>
<DO_SET_MODE><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_MODE>
<DO_JUMP><P1>WP #</P1><P2>Repeat#</P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_JUMP>
<DO_CHANGE_SPEED><P1>Type (0=as 1=gs)</P1><P2>Throttle(%)</P2><P3>Speed (m/s)</P3><P4></P4><X></X><Y></Y><Z></Z></DO_CHANGE_SPEED>
<DO_SET_HOME><P1>Current(1)/Spec(0)</P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_HOME>
<DO_SET_PARAMETER><P1>#</P1><P2>Value</P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_PARAMETER>
<DO_SET_RELAY><P1>off(0)/on(1)</P1><P2>Delay (s)</P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_RELAY>
<DO_REPEAT_RELAY><P1></P1><P2>Delay (s)</P2><P3>Repeat#</P3><P4></P4><X></X><Y></Y><Z></Z></DO_REPEAT_RELAY>
<DO_SET_SERVO><P1>Ser No</P1><P2>PWM</P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_SERVO>
<DO_REPEAT_SERVO><P1>Ser No</P1><P2>Repeat#</P2><P3>Delay (s)</P3><P4>PWM</P4><X></X><Y></Y><Z></Z></DO_REPEAT_SERVO>
<DO_DIGICAM_CONFIGURE><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_DIGICAM_CONFIGURE>
<DO_DIGICAM_CONTROL><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_DIGICAM_CONTROL>
<DO_MOUNT_CONFIGURE><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_MOUNT_CONFIGURE>
<DO_MOUNT_CONTROL><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_MOUNT_CONTROL>
</AC2>
<!-- -->
<APM>
<WAYPOINT><P1></P1><P2></P2><P3></P3><P4></P4><X>Lat</X><Y>Long</Y><Z>Alt</Z></WAYPOINT>
<LOITER_UNLIM><P1></P1><P2></P2><P3></P3><P4></P4><X>Lat</X><Y>Long</Y><Z>Alt</Z></LOITER_UNLIM>
<LOITER_TURNS><P1>Turns</P1><P2></P2><P3></P3><P4></P4><X>Lat</X><Y>Long</Y><Z>Alt</Z></LOITER_TURNS>
<LOITER_TIME><P1>Time s</P1><P2></P2><P3></P3><P4></P4><X>Lat</X><Y>Long</Y><Z>Alt</Z></LOITER_TIME>
<RETURN_TO_LAUNCH><P1></P1><P2></P2><P3></P3><P4></P4><X>Lat</X><Y>Long</Y><Z>Alt</Z></RETURN_TO_LAUNCH>
<LAND><P1></P1><P2></P2><P3></P3><P4></P4><X>Lat</X><Y>Long</Y><Z>Alt</Z></LAND>
<TAKEOFF><P1>Angle</P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z>Alt</Z></TAKEOFF>
<ROI><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></ROI>
<PATHPLANNING><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></PATHPLANNING>
<CONDITION_DELAY><P1>Time (sec)</P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></CONDITION_DELAY>
<CONDITION_CHANGE_ALT><P1>Rate (cm/sec)</P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z>Alt</Z></CONDITION_CHANGE_ALT>
<CONDITION_DISTANCE><P1>Dist (m)</P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></CONDITION_DISTANCE>
<CONDITION_YAW><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></CONDITION_YAW>
<DO_SET_MODE><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_MODE>
<DO_JUMP><P1>WP #</P1><P2>Repeat#</P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_JUMP>
<DO_CHANGE_SPEED><P1>Type (0=as 1=gs)</P1><P2>Throttle(%)</P2><P3>Speed (m/s)</P3><P4></P4><X></X><Y></Y><Z></Z></DO_CHANGE_SPEED>
<DO_SET_HOME><P1>Current(1)/Spec(0)</P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_HOME>
<DO_SET_PARAMETER><P1>#</P1><P2>Value</P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_PARAMETER>
<DO_SET_RELAY><P1>off(0)/on(1)</P1><P2>Delay (s)</P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_RELAY>
<DO_REPEAT_RELAY><P1></P1><P2>Delay (s)</P2><P3>Repeat#</P3><P4></P4><X></X><Y></Y><Z></Z></DO_REPEAT_RELAY>
<DO_SET_SERVO><P1>Ser No</P1><P2>PWM</P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_SERVO>
<DO_REPEAT_SERVO><P1>Ser No</P1><P2>Repeat#</P2><P3>Delay (s)</P3><P4>PWM</P4><X></X><Y></Y><Z></Z></DO_REPEAT_SERVO>
<DO_DIGICAM_CONFIGURE><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_DIGICAM_CONFIGURE>
<DO_DIGICAM_CONTROL><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_DIGICAM_CONTROL>
<DO_MOUNT_CONFIGURE><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_MOUNT_CONFIGURE>
<DO_MOUNT_CONTROL><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_MOUNT_CONTROL>
</APM>
</CMD>

View File

@ -0,0 +1,62 @@
<?xml version="1.0"?>
<!-- TAGS ARE CASE SENSATIVE -->
<CMD>
<AC2>
<WAYPOINT><P1>Delay</P1><P2>Hit Rad</P2><P3></P3><P4>Yaw Ang</P4><X>Lat</X><Y>Long</Y><Z>Alt</Z></WAYPOINT>
<LOITER_UNLIM><P1></P1><P2></P2><P3></P3><P4></P4><X>Lat</X><Y>Long</Y><Z>Alt</Z></LOITER_UNLIM>
<LOITER_TURNS><P1>Turns</P1><P2></P2><P3></P3><P4></P4><X>Lat</X><Y>Long</Y><Z>Alt</Z></LOITER_TURNS>
<LOITER_TIME><P1>Time s</P1><P2></P2><P3>rad</P3><P4>yaw per</P4><X></X><Y></Y><Z></Z></LOITER_TIME>
<RETURN_TO_LAUNCH><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z>Alt</Z></RETURN_TO_LAUNCH>
<LAND><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></LAND>
<TAKEOFF><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z>Alt</Z></TAKEOFF>
<ROI><P1>MAV_ROI</P1><P2>WP#</P2><P3>ROI#</P3><P4></P4><X></X><Y></Y><Z></Z></ROI>
<PATHPLANNING><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></PATHPLANNING>
<CONDITION_DELAY><P1>Time (sec)</P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></CONDITION_DELAY>
<CONDITION_CHANGE_ALT><P1>Rate (cm/sec)</P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z>Alt</Z></CONDITION_CHANGE_ALT>
<CONDITION_DISTANCE><P1>Dist (m)</P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></CONDITION_DISTANCE>
<CONDITION_YAW><P1>Deg</P1><P2>Sec</P2><P3>Dir 1=CW</P3><P4>rel/abs</P4><X></X><Y></Y><Z></Z></CONDITION_YAW>
<DO_SET_MODE><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_MODE>
<DO_JUMP><P1>WP #</P1><P2>Repeat#</P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_JUMP>
<DO_CHANGE_SPEED><P1>Type (0=as 1=gs)</P1><P2>Throttle(%)</P2><P3>Speed (m/s)</P3><P4></P4><X></X><Y></Y><Z></Z></DO_CHANGE_SPEED>
<DO_SET_HOME><P1>Current(1)/Spec(0)</P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_HOME>
<DO_SET_PARAMETER><P1>#</P1><P2>Value</P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_PARAMETER>
<DO_SET_RELAY><P1>off(0)/on(1)</P1><P2>Delay (s)</P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_RELAY>
<DO_REPEAT_RELAY><P1></P1><P2>Delay (s)</P2><P3>Repeat#</P3><P4></P4><X></X><Y></Y><Z></Z></DO_REPEAT_RELAY>
<DO_SET_SERVO><P1>Ser No</P1><P2>PWM</P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_SERVO>
<DO_REPEAT_SERVO><P1>Ser No</P1><P2>Repeat#</P2><P3>Delay (s)</P3><P4>PWM</P4><X></X><Y></Y><Z></Z></DO_REPEAT_SERVO>
<DO_DIGICAM_CONFIGURE><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_DIGICAM_CONFIGURE>
<DO_DIGICAM_CONTROL><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_DIGICAM_CONTROL>
<DO_MOUNT_CONFIGURE><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_MOUNT_CONFIGURE>
<DO_MOUNT_CONTROL><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_MOUNT_CONTROL>
</AC2>
<!-- -->
<APM>
<WAYPOINT><P1></P1><P2></P2><P3></P3><P4></P4><X>Lat</X><Y>Long</Y><Z>Alt</Z></WAYPOINT>
<LOITER_UNLIM><P1></P1><P2></P2><P3></P3><P4></P4><X>Lat</X><Y>Long</Y><Z>Alt</Z></LOITER_UNLIM>
<LOITER_TURNS><P1>Turns</P1><P2></P2><P3></P3><P4></P4><X>Lat</X><Y>Long</Y><Z>Alt</Z></LOITER_TURNS>
<LOITER_TIME><P1>Time s</P1><P2></P2><P3></P3><P4></P4><X>Lat</X><Y>Long</Y><Z>Alt</Z></LOITER_TIME>
<RETURN_TO_LAUNCH><P1></P1><P2></P2><P3></P3><P4></P4><X>Lat</X><Y>Long</Y><Z>Alt</Z></RETURN_TO_LAUNCH>
<LAND><P1></P1><P2></P2><P3></P3><P4></P4><X>Lat</X><Y>Long</Y><Z>Alt</Z></LAND>
<TAKEOFF><P1>Angle</P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z>Alt</Z></TAKEOFF>
<ROI><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></ROI>
<PATHPLANNING><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></PATHPLANNING>
<CONDITION_DELAY><P1>Time (sec)</P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></CONDITION_DELAY>
<CONDITION_CHANGE_ALT><P1>Rate (cm/sec)</P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z>Alt</Z></CONDITION_CHANGE_ALT>
<CONDITION_DISTANCE><P1>Dist (m)</P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></CONDITION_DISTANCE>
<CONDITION_YAW><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></CONDITION_YAW>
<DO_SET_MODE><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_MODE>
<DO_JUMP><P1>WP #</P1><P2>Repeat#</P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_JUMP>
<DO_CHANGE_SPEED><P1>Type (0=as 1=gs)</P1><P2>Throttle(%)</P2><P3>Speed (m/s)</P3><P4></P4><X></X><Y></Y><Z></Z></DO_CHANGE_SPEED>
<DO_SET_HOME><P1>Current(1)/Spec(0)</P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_HOME>
<DO_SET_PARAMETER><P1>#</P1><P2>Value</P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_PARAMETER>
<DO_SET_RELAY><P1>off(0)/on(1)</P1><P2>Delay (s)</P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_RELAY>
<DO_REPEAT_RELAY><P1></P1><P2>Delay (s)</P2><P3>Repeat#</P3><P4></P4><X></X><Y></Y><Z></Z></DO_REPEAT_RELAY>
<DO_SET_SERVO><P1>Ser No</P1><P2>PWM</P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_SET_SERVO>
<DO_REPEAT_SERVO><P1>Ser No</P1><P2>Repeat#</P2><P3>Delay (s)</P3><P4>PWM</P4><X></X><Y></Y><Z></Z></DO_REPEAT_SERVO>
<DO_DIGICAM_CONFIGURE><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_DIGICAM_CONFIGURE>
<DO_DIGICAM_CONTROL><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_DIGICAM_CONTROL>
<DO_MOUNT_CONFIGURE><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_MOUNT_CONFIGURE>
<DO_MOUNT_CONTROL><P1></P1><P2></P2><P3></P3><P4></P4><X></X><Y></Y><Z></Z></DO_MOUNT_CONTROL>
</APM>
</CMD>