APM Planner 1.1.50

rename messagebox to custommessagebox
mag calibration now working. > hardware setup tab
This commit is contained in:
Michael Oborne 2012-03-09 23:18:12 +08:00
parent 13e9608fb8
commit f399ada86f
43 changed files with 3173 additions and 1123 deletions

View File

@ -36,13 +36,13 @@ namespace ArdupilotMega.Antenna
if ((PanStartRange - PanEndRange) == 0)
{
System.Windows.Forms.MessageBox.Show("Invalid Pan Range", "Error");
System.Windows.Forms.CustomMessageBox.Show("Invalid Pan Range", "Error");
return false;
}
if ((TiltStartRange - TiltEndRange) == 0)
{
System.Windows.Forms.MessageBox.Show("Invalid Tilt Range", "Error");
System.Windows.Forms.CustomMessageBox.Show("Invalid Tilt Range", "Error");
return false;
}
@ -50,7 +50,7 @@ namespace ArdupilotMega.Antenna
{
ComPort.Open();
}
catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Connect failed " + ex.Message,"Error"); return false; }
catch (Exception ex) { System.Windows.Forms.CustomMessageBox.Show("Connect failed " + ex.Message,"Error"); return false; }
return true;
}

View File

@ -54,7 +54,7 @@ namespace ArdupilotMega.Antenna
BaudRate = int.Parse(CMB_baudrate.Text)
};
}
catch (Exception ex) { MessageBox.Show("Bad Port settings " + ex.Message); return; }
catch (Exception ex) { CustomMessageBox.Show("Bad Port settings " + ex.Message); return; }
try
{
@ -67,7 +67,7 @@ namespace ArdupilotMega.Antenna
tracker.TrimTilt = TRK_tilttrim.Value;
}
catch (Exception ex) { MessageBox.Show("Bad User input " + ex.Message); return; }
catch (Exception ex) { CustomMessageBox.Show("Bad User input " + ex.Message); return; }
if (tracker.Init())
{

View File

@ -178,7 +178,7 @@ namespace ArdupilotMega
}
else
{
if (DialogResult.Yes == MessageBox.Show("Is this a APM 2?", "APM 2", MessageBoxButtons.YesNo))
if (DialogResult.Yes == CustomMessageBox.Show("Is this a APM 2?", "APM 2", MessageBoxButtons.YesNo))
{
return "2560-2";
}

View File

@ -166,6 +166,10 @@
<Reference Include="Microsoft.Scripting.ExtensionAttribute, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="netDxf, Version=0.1.2.0, Culture=neutral, PublicKeyToken=1c75adeaa4c98f42, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Lib\netDxf.dll</HintPath>
</Reference>
<Reference Include="OpenTK, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
@ -218,7 +222,7 @@
<DependentUpon>Tracker.cs</DependentUpon>
</Compile>
<Compile Include="CodeGen.cs" />
<Compile Include="Controls\MessageBox.cs" />
<Compile Include="Controls\CustomMessageBox.cs" />
<Compile Include="Controls\ProgressReporterDialogue.cs">
<SubType>Form</SubType>
</Compile>
@ -442,6 +446,7 @@
</Compile>
<Compile Include="Radio\Uploader.cs" />
<Compile Include="LangUtility.cs" />
<Compile Include="test.cs" />
<Compile Include="ThemeManager.cs" />
<EmbeddedResource Include="Antenna\Tracker.resx">
<DependentUpon>Tracker.cs</DependentUpon>

View File

@ -182,7 +182,7 @@ namespace ArdupilotMega
xmlwriter.Close();
}
catch (Exception ex) { MessageBox.Show(ex.ToString()); }
catch (Exception ex) { CustomMessageBox.Show(ex.ToString()); }
}
else
{
@ -279,7 +279,7 @@ namespace ArdupilotMega
camera.sensorheight = float.Parse(TXT_sensheight.Text);
camera.sensorwidth = float.Parse(TXT_senswidth.Text);
}
catch { MessageBox.Show("One of your entries is not a valid number"); return; }
catch { CustomMessageBox.Show("One of your entries is not a valid number"); return; }
cameras[CMB_camera.Text] = camera;

View File

@ -227,7 +227,7 @@ namespace WebCamService
camimage(image);
}
}
catch { Console.WriteLine("Grab bmp failed"); timer1.Enabled = false; this.CloseInterfaces(); System.Windows.Forms.MessageBox.Show("Problem with capture device, grabbing frame took longer than 5 sec"); }
catch { Console.WriteLine("Grab bmp failed"); timer1.Enabled = false; this.CloseInterfaces(); System.Windows.Forms.CustomMessageBox.Show("Problem with capture device, grabbing frame took longer than 5 sec"); }
}
/// <summary> build the capture graph for grabber. </summary>

View File

@ -525,7 +525,7 @@ namespace ArdupilotMega
mode.mode = (byte)MAVLink.MAV_MODE.MAV_MODE_TEST2;
break;
default:
MessageBox.Show("No Mode Changed " + (int)Enum.Parse(Common.getModes(), modein));
CustomMessageBox.Show("No Mode Changed " + (int)Enum.Parse(Common.getModes(), modein));
return false;
}
}
@ -553,12 +553,12 @@ namespace ArdupilotMega
mode.mode = (byte)MAVLink.MAV_MODE.MAV_MODE_AUTO;
break;
default:
MessageBox.Show("No Mode Changed " + (int)Enum.Parse(Common.getModes(), modein));
CustomMessageBox.Show("No Mode Changed " + (int)Enum.Parse(Common.getModes(), modein));
return false;
}
}
}
catch { System.Windows.Forms.MessageBox.Show("Failed to find Mode"); return false; }
catch { System.Windows.Forms.CustomMessageBox.Show("Failed to find Mode"); return false; }
return true;
}
@ -574,7 +574,7 @@ namespace ArdupilotMega
// Create a request using a URL that can receive a post.
WebRequest request = WebRequest.Create(url);
request.Timeout = 5000;
request.Timeout = 10000;
// Set the Method property of the request to POST.
request.Method = "GET";
// Get the response.

View File

@ -143,7 +143,7 @@ namespace System.IO.Ports
client.Close();
}
log.Info(ex.ToString());
System.Windows.Forms.MessageBox.Show("Please check your Firewall settings\nPlease try running this command\n1. Run the following command in an elevated command prompt to disable Windows Firewall temporarily:\n \nNetsh advfirewall set allprofiles state off\n \nNote: This is just for test; please turn it back on with the command 'Netsh advfirewall set allprofiles state on'.\n");
System.Windows.Forms.CustomMessageBox.Show("Please check your Firewall settings\nPlease try running this command\n1. Run the following command in an elevated command prompt to disable Windows Firewall temporarily:\n \nNetsh advfirewall set allprofiles state off\n \nNote: This is just for test; please turn it back on with the command 'Netsh advfirewall set allprofiles state on'.\n");
throw new Exception("The socket/serialproxy is closed " + e);
}
}

View File

@ -0,0 +1,242 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using ArdupilotMega.Controls;
using System.Text;
using ArdupilotMega;
namespace System.Windows.Forms
{
public static class CustomMessageBox
{
const int FORM_Y_MARGIN = 10;
const int FORM_X_MARGIN = 16;
static DialogResult _state = DialogResult.None;
public static DialogResult Show(string text)
{
return Show(text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None);
}
public static DialogResult Show(string text, string caption)
{
return Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.None);
}
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons)
{
return Show(text, caption, buttons, MessageBoxIcon.None);
}
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
{
if (text == null)
text = "";
if (caption == null)
caption = "";
// ensure we are always in a known state
_state = DialogResult.None;
// convert to nice wrapped lines.
text = AddNewLinesToText(text);
// get pixel width and height
Size textSize = TextRenderer.MeasureText(text, SystemFonts.DefaultFont);
// allow for icon
if (icon != MessageBoxIcon.None)
textSize.Width += SystemIcons.Question.Width;
var msgBoxFrm = new Form
{
FormBorderStyle = FormBorderStyle.FixedDialog,
ShowInTaskbar = false,
StartPosition = FormStartPosition.CenterScreen,
Text = caption,
MaximizeBox = false,
MinimizeBox = false,
Width = textSize.Width + 50,
Height = textSize.Height + 100,
TopMost = true,
};
Rectangle screenRectangle = msgBoxFrm.RectangleToScreen(msgBoxFrm.ClientRectangle);
int titleHeight = screenRectangle.Top - msgBoxFrm.Top;
var lblMessage = new Label
{
Left = 58,
Top = 15,
Width = textSize.Width + 10,
Height = textSize.Height + 10,
Text = text
};
msgBoxFrm.Controls.Add(lblMessage);
var actualIcon = getMessageBoxIcon(icon);
if (actualIcon == null)
{
lblMessage.Location = new Point(FORM_X_MARGIN, FORM_Y_MARGIN);
}
else
{
var iconPbox = new PictureBox
{
Image = actualIcon.ToBitmap(),
Location = new Point(FORM_X_MARGIN, FORM_Y_MARGIN)
};
msgBoxFrm.Controls.Add(iconPbox);
}
AddButtonsToForm(msgBoxFrm, buttons);
// display even if theme fails
try
{
ThemeManager.ApplyThemeTo(msgBoxFrm);
}
catch { }
if (System.Windows.Forms.Application.OpenForms.Count > 0)
{
msgBoxFrm.StartPosition = FormStartPosition.Manual;
Form parentForm = System.Windows.Forms.Application.OpenForms[0];
// center of first form
msgBoxFrm.Location = new Point(parentForm.Location.X + parentForm.Width / 2 - msgBoxFrm.Width / 2,
parentForm.Location.Y + parentForm.Height / 2 - msgBoxFrm.Height / 2);
DialogResult test = msgBoxFrm.ShowDialog();
}
else
{
DialogResult test = msgBoxFrm.ShowDialog();
}
DialogResult answer = _state;
return answer;
}
static void msgBoxFrm_FormClosing(object sender, FormClosingEventArgs e)
{
throw new NotImplementedException();
}
// from http://stackoverflow.com/questions/2512781/winforms-big-paragraph-tooltip/2512895#2512895
private static int maximumSingleLineTooltipLength = 85;
private static string AddNewLinesToText(string text)
{
if (text.Length < maximumSingleLineTooltipLength)
return text;
int lineLength = maximumSingleLineTooltipLength;
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();
}
private static void AddButtonsToForm(Form msgBoxFrm, MessageBoxButtons buttons)
{
Rectangle screenRectangle = msgBoxFrm.RectangleToScreen(msgBoxFrm.ClientRectangle);
int titleHeight = screenRectangle.Top - msgBoxFrm.Top;
var t = Type.GetType("Mono.Runtime");
if ((t != null))
titleHeight = 25;
switch (buttons)
{
case MessageBoxButtons.OK:
var but = new MyButton
{
Size = new Size(75, 23),
Text = "OK",
Left = msgBoxFrm.Width - 75 - FORM_X_MARGIN,
Top = msgBoxFrm.Height - 23 - FORM_Y_MARGIN - titleHeight
};
but.Click += delegate { _state = DialogResult.OK; msgBoxFrm.Close(); };
msgBoxFrm.Controls.Add(but);
msgBoxFrm.AcceptButton = but;
break;
case MessageBoxButtons.YesNo:
if (msgBoxFrm.Width < (75 * 2 + FORM_X_MARGIN * 3))
msgBoxFrm.Width = (75 * 2 + FORM_X_MARGIN * 3);
var butyes = new MyButton
{
Size = new Size(75, 23),
Text = "Yes",
Left = msgBoxFrm.Width - 75 * 2 - FORM_X_MARGIN * 2,
Top = msgBoxFrm.Height - 23 - FORM_Y_MARGIN - titleHeight
};
butyes.Click += delegate { _state = DialogResult.Yes; msgBoxFrm.Close(); };
msgBoxFrm.Controls.Add(butyes);
msgBoxFrm.AcceptButton = butyes;
var butno = new MyButton
{
Size = new Size(75, 23),
Text = "No",
Left = msgBoxFrm.Width - 75 - FORM_X_MARGIN,
Top = msgBoxFrm.Height - 23 - FORM_Y_MARGIN - titleHeight
};
butno.Click += delegate { _state = DialogResult.No; msgBoxFrm.Close(); };
msgBoxFrm.Controls.Add(butno);
msgBoxFrm.CancelButton = butno;
break;
default:
throw new NotImplementedException("Only MessageBoxButtons.OK and YesNo supported at this time");
}
}
/// <summary>
/// Get system icon for MessageBoxIcon.
/// </summary>
/// <param name="icon">The MessageBoxIcon value.</param>
/// <returns>SystemIcon type Icon.</returns>
private static Icon getMessageBoxIcon(MessageBoxIcon icon)
{
switch (icon)
{
case MessageBoxIcon.Asterisk:
return SystemIcons.Asterisk;
case MessageBoxIcon.Error:
return SystemIcons.Error;
case MessageBoxIcon.Exclamation:
return SystemIcons.Exclamation;
case MessageBoxIcon.Question:
return SystemIcons.Question;
default:
return null;
}
}
}
}

View File

@ -23,7 +23,8 @@ namespace ArdupilotMega
public Color BGGradBot = Color.FromArgb(0xcd, 0xe2, 0x96);
public new Color ForeColor = Color.FromArgb(0x40, 0x57, 0x04);
// i want to ignore forecolor
public Color TextColor = Color.FromArgb(0x40, 0x57, 0x04);
public Color Outline = Color.FromArgb(0x79, 0x94, 0x29);
@ -79,7 +80,7 @@ namespace ArdupilotMega
gr.DrawRectangle(mypen, outside);
SolidBrush mybrush = new SolidBrush(ForeColor);
SolidBrush mybrush = new SolidBrush(TextColor);
if (mouseover)
{

View File

@ -211,7 +211,7 @@ namespace ArdupilotMega.Controls
+ Environment.NewLine + Environment.NewLine
+ this.workerException.StackTrace;
MessageBox.Show(message,"Exception Details",MessageBoxButtons.OK,MessageBoxIcon.Information);
CustomMessageBox.Show(message,"Exception Details",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}

View File

@ -28,7 +28,7 @@ namespace ArdupilotMega
if (planlocs.Count <= 1)
{
MessageBox.Show("Please plan something first");
CustomMessageBox.Show("Please plan something first");
return;
}
@ -113,7 +113,7 @@ namespace ArdupilotMega
if (list.Count <= 2 || coords.Length > (2048 - 256) || distance > 50000)
{
MessageBox.Show("To many/few WP's or to Big a Distance " + (distance/1000) + "km");
CustomMessageBox.Show("To many/few WP's or to Big a Distance " + (distance/1000) + "km");
return answer;
}
@ -145,7 +145,7 @@ namespace ArdupilotMega
}
}
}
catch { MessageBox.Show("Error getting GE data"); }
catch { CustomMessageBox.Show("Error getting GE data"); }
return answer;
}

View File

@ -590,7 +590,7 @@ namespace ArdupilotMega.GCSViews
string line = sr.ReadLine();
if (line.Contains("NOTE:"))
MessageBox.Show(line, "Saved Note");
CustomMessageBox.Show(line, "Saved Note");
int index = line.IndexOf(',');
@ -711,7 +711,7 @@ namespace ArdupilotMega.GCSViews
catch { }
}
catch { MessageBox.Show("Set " + value + " Failed"); }
catch { CustomMessageBox.Show("Set " + value + " Failed"); }
}
}
@ -724,7 +724,7 @@ namespace ArdupilotMega.GCSViews
{
if (!MainV2.comPort.BaseStream.IsOpen)
{
MessageBox.Show("Please Connect First");
CustomMessageBox.Show("Please Connect First");
ConfigTabs.SelectedIndex = 0;
}
else
@ -764,7 +764,7 @@ namespace ArdupilotMega.GCSViews
BUT_videostart.Enabled = false;
}
catch (Exception ex) { MessageBox.Show("Camera Fail: " + ex.Message); }
catch (Exception ex) { CustomMessageBox.Show("Camera Fail: " + ex.Message); }
}
@ -818,7 +818,7 @@ namespace ArdupilotMega.GCSViews
}
catch (Exception ex)
{
MessageBox.Show("Can not add video source\n" + ex.ToString());
CustomMessageBox.Show("Can not add video source\n" + ex.ToString());
return;
}
@ -951,7 +951,7 @@ namespace ArdupilotMega.GCSViews
}
catch { MessageBox.Show("Error: getting param list"); }
catch { CustomMessageBox.Show("Error: getting param list"); }
((MyButton)sender).Enabled = true;
@ -1122,7 +1122,7 @@ namespace ArdupilotMega.GCSViews
string line = sr.ReadLine();
if (line.Contains("NOTE:"))
MessageBox.Show(line, "Saved Note");
CustomMessageBox.Show(line, "Saved Note");
int index = line.IndexOf(',');
@ -1155,7 +1155,7 @@ namespace ArdupilotMega.GCSViews
{
if (startup)
return;
MessageBox.Show("You need to restart the planner for this to take effect");
CustomMessageBox.Show("You need to restart the planner for this to take effect");
MainV2.config["CHK_GDIPlus"] = CHK_GDIPlus.Checked.ToString();
}

View File

@ -141,7 +141,7 @@ namespace ArdupilotMega.GCSViews
}
catch (Exception ex)
{
MessageBox.Show("Failed to get Firmware List : " + ex.Message);
CustomMessageBox.Show("Failed to get Firmware List : " + ex.Message);
}
log.Info("FW load done");
@ -211,12 +211,12 @@ namespace ArdupilotMega.GCSViews
// none found
if (items.Count == 0)
{
MessageBox.Show("The requested firmware was not found.");
CustomMessageBox.Show("The requested firmware was not found.");
return;
}
else if (items.Count == 1) // 1 found so accept it
{
DialogResult dr = MessageBox.Show("Are you sure you want to upload " + items[0].name + "?", "Continue", MessageBoxButtons.YesNo);
DialogResult dr = CustomMessageBox.Show("Are you sure you want to upload " + items[0].name + "?", "Continue", MessageBoxButtons.YesNo);
if (dr == System.Windows.Forms.DialogResult.Yes)
{
update(items[0]);
@ -239,7 +239,7 @@ namespace ArdupilotMega.GCSViews
{
if (select.frame == "+" && temp.name.Contains("Plus"))
{
DialogResult dr = MessageBox.Show("Are you sure you want to upload " + items[a].name + "?", "Continue", MessageBoxButtons.YesNo);
DialogResult dr = CustomMessageBox.Show("Are you sure you want to upload " + items[a].name + "?", "Continue", MessageBoxButtons.YesNo);
if (dr == System.Windows.Forms.DialogResult.Yes)
{
update(items[a]);
@ -248,7 +248,7 @@ namespace ArdupilotMega.GCSViews
}
else if (select.frame == "X" && temp.name.Contains("X"))
{
DialogResult dr = MessageBox.Show("Are you sure you want to upload " + items[a].name + "?", "Continue", MessageBoxButtons.YesNo);
DialogResult dr = CustomMessageBox.Show("Are you sure you want to upload " + items[a].name + "?", "Continue", MessageBoxButtons.YesNo);
if (dr == System.Windows.Forms.DialogResult.Yes)
{
update(items[a]);
@ -261,7 +261,7 @@ namespace ArdupilotMega.GCSViews
}
else
{
MessageBox.Show("Something has gone wrong, to many firmware choices");
CustomMessageBox.Show("Something has gone wrong, to many firmware choices");
return;
}
}
@ -318,7 +318,7 @@ namespace ArdupilotMega.GCSViews
{
if (softwares.Count == 0)
{
MessageBox.Show("No valid options");
CustomMessageBox.Show("No valid options");
return;
}
@ -330,7 +330,7 @@ namespace ArdupilotMega.GCSViews
if (board == "")
{
MessageBox.Show("Cant detect your APM version. Please check your cabling");
CustomMessageBox.Show("Cant detect your APM version. Please check your cabling");
return;
}
@ -344,9 +344,9 @@ namespace ArdupilotMega.GCSViews
if (apmformat_version != -1 && apmformat_version != temp.k_format_version)
{
if (DialogResult.No == MessageBox.Show("Epprom changed, all your setting will be lost during the update,\nDo you wish to continue?", "Epprom format changed (" + apmformat_version + " vs " + temp.k_format_version + ")", MessageBoxButtons.YesNo))
if (DialogResult.No == CustomMessageBox.Show("Epprom changed, all your setting will be lost during the update,\nDo you wish to continue?", "Epprom format changed (" + apmformat_version + " vs " + temp.k_format_version + ")", MessageBoxButtons.YesNo))
{
MessageBox.Show("Please connect and backup your config in the configuration tab.");
CustomMessageBox.Show("Please connect and backup your config in the configuration tab.");
return;
}
}
@ -370,7 +370,7 @@ namespace ArdupilotMega.GCSViews
}
else
{
MessageBox.Show("Invalid Board Type");
CustomMessageBox.Show("Invalid Board Type");
return;
}
@ -426,7 +426,7 @@ namespace ArdupilotMega.GCSViews
this.Refresh();
log.Info("Downloaded");
}
catch (Exception ex) { lbl_status.Text = "Failed download"; MessageBox.Show("Failed to download new firmware : " + ex.ToString()); return; }
catch (Exception ex) { lbl_status.Text = "Failed download"; CustomMessageBox.Show("Failed to download new firmware : " + ex.ToString()); return; }
UploadFlash(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"firmware.hex", board);
}
@ -451,7 +451,7 @@ namespace ArdupilotMega.GCSViews
sr.Dispose();
}
lbl_status.Text = "Failed read HEX";
MessageBox.Show("Failed to read firmware.hex : " + ex.Message);
CustomMessageBox.Show("Failed to read firmware.hex : " + ex.Message);
return;
}
ArduinoComms port = new ArduinoSTK();
@ -460,7 +460,7 @@ namespace ArdupilotMega.GCSViews
{
if (FLASH.Length > 126976)
{
MessageBox.Show("Firmware is to big for a 1280, Please upgrade!!");
CustomMessageBox.Show("Firmware is to big for a 1280, Please upgrade!!");
return;
}
//port = new ArduinoSTK();
@ -539,7 +539,7 @@ namespace ArdupilotMega.GCSViews
{
if (FLASH[s] != flashverify[s])
{
MessageBox.Show("Upload succeeded, but verify failed: exp " + FLASH[s].ToString("X") + " got " + flashverify[s].ToString("X") + " at " + s);
CustomMessageBox.Show("Upload succeeded, but verify failed: exp " + FLASH[s].ToString("X") + " got " + flashverify[s].ToString("X") + " at " + s);
break;
}
}
@ -549,7 +549,7 @@ namespace ArdupilotMega.GCSViews
else
{
lbl_status.Text = "Failed upload";
MessageBox.Show("Communication Error - no connection");
CustomMessageBox.Show("Communication Error - no connection");
}
port.Close();
@ -588,7 +588,7 @@ namespace ArdupilotMega.GCSViews
catch (Exception ex)
{
lbl_status.Text = "Failed upload";
MessageBox.Show("Check port settings or Port in use? " + ex);
CustomMessageBox.Show("Check port settings or Port in use? " + ex);
port.Close();
}
flashing = false;
@ -655,7 +655,7 @@ namespace ArdupilotMega.GCSViews
if (checksumact != checksum)
{
MessageBox.Show("The hex file loaded is invalid, please try again.");
CustomMessageBox.Show("The hex file loaded is invalid, please try again.");
throw new Exception("Checksum Failed - Invalid Hex");
}
}
@ -664,7 +664,7 @@ namespace ArdupilotMega.GCSViews
if (!hitend)
{
MessageBox.Show("The hex file did no contain an end flag. aborting");
CustomMessageBox.Show("The hex file did no contain an end flag. aborting");
throw new Exception("No end flag in file");
}
@ -678,7 +678,7 @@ namespace ArdupilotMega.GCSViews
if (flashing == true)
{
e.Cancel = true;
MessageBox.Show("Cant exit while updating");
CustomMessageBox.Show("Cant exit while updating");
}
}

View File

@ -781,7 +781,7 @@ namespace ArdupilotMega.GCSViews
Directory.CreateDirectory(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs");
swlog = new StreamWriter(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs" + Path.DirectorySeparatorChar + DateTime.Now.ToString("yyyy-MM-dd hh-mm") + " telem.log");
}
catch { MessageBox.Show("Log creation error"); }
catch { CustomMessageBox.Show("Log creation error"); }
}
private void BUTactiondo_Click(object sender, EventArgs e)
@ -795,7 +795,7 @@ namespace ArdupilotMega.GCSViews
comPort.doAction((MAVLink.MAV_ACTION)Enum.Parse(typeof(MAVLink.MAV_ACTION), "MAV_ACTION_" + CMB_action.Text));
#endif
}
catch { MessageBox.Show("The Command failed to execute"); }
catch { CustomMessageBox.Show("The Command failed to execute"); }
((Button)sender).Enabled = true;
}
@ -811,7 +811,7 @@ namespace ArdupilotMega.GCSViews
//System.Threading.Thread.Sleep(100);
//comPort.doAction(MAVLink.MAV_ACTION.MAV_ACTION_SET_AUTO); // set auto
}
catch { MessageBox.Show("The command failed to execute"); }
catch { CustomMessageBox.Show("The command failed to execute"); }
((Button)sender).Enabled = true;
}
@ -872,7 +872,7 @@ namespace ArdupilotMega.GCSViews
{
if (!MainV2.comPort.BaseStream.IsOpen)
{
MessageBox.Show("Please Connect First");
CustomMessageBox.Show("Please Connect First");
return;
}
@ -892,13 +892,13 @@ namespace ArdupilotMega.GCSViews
int intalt = (int)(100 * MainV2.cs.multiplierdist);
if (!int.TryParse(alt, out intalt))
{
MessageBox.Show("Bad Alt");
CustomMessageBox.Show("Bad Alt");
return;
}
if (gotolocation.Lat == 0 || gotolocation.Lng == 0)
{
MessageBox.Show("Bad Lat/Long");
CustomMessageBox.Show("Bad Lat/Long");
return;
}
@ -919,7 +919,7 @@ namespace ArdupilotMega.GCSViews
MainV2.givecomport = false;
}
catch (Exception ex) { MainV2.givecomport = false; MessageBox.Show("Error sending command : " + ex.Message); }
catch (Exception ex) { MainV2.givecomport = false; CustomMessageBox.Show("Error sending command : " + ex.Message); }
}
@ -1009,7 +1009,7 @@ namespace ArdupilotMega.GCSViews
tracklog.Minimum = 0;
tracklog.Maximum = 100;
}
catch { MessageBox.Show("Error: Failed to write log file"); }
catch { CustomMessageBox.Show("Error: Failed to write log file"); }
}
}
@ -1112,7 +1112,7 @@ namespace ArdupilotMega.GCSViews
((Button)sender).Enabled = false;
comPort.setWPCurrent((ushort)CMB_setwp.SelectedIndex); // set nav to
}
catch { MessageBox.Show("The command failed to execute"); }
catch { CustomMessageBox.Show("The command failed to execute"); }
((Button)sender).Enabled = true;
}
@ -1143,7 +1143,7 @@ namespace ArdupilotMega.GCSViews
comPort.doAction(MAVLink.MAV_ACTION.MAV_ACTION_SET_AUTO);
#endif
}
catch { MessageBox.Show("The Command failed to execute"); }
catch { CustomMessageBox.Show("The Command failed to execute"); }
((Button)sender).Enabled = true;
}
@ -1158,7 +1158,7 @@ namespace ArdupilotMega.GCSViews
comPort.doAction(MAVLink.MAV_ACTION.MAV_ACTION_RETURN);
#endif
}
catch { MessageBox.Show("The Command failed to execute"); }
catch { CustomMessageBox.Show("The Command failed to execute"); }
((Button)sender).Enabled = true;
}
@ -1173,7 +1173,7 @@ namespace ArdupilotMega.GCSViews
comPort.doAction(MAVLink.MAV_ACTION.MAV_ACTION_SET_MANUAL);
#endif
}
catch { MessageBox.Show("The Command failed to execute"); }
catch { CustomMessageBox.Show("The Command failed to execute"); }
((Button)sender).Enabled = true;
}
@ -1356,7 +1356,7 @@ namespace ArdupilotMega.GCSViews
{
stopRecordToolStripMenuItem_Click(sender, e);
MessageBox.Show("Output avi will be saved to the log folder");
CustomMessageBox.Show("Output avi will be saved to the log folder");
aviwriter = new AviWriter();
Directory.CreateDirectory(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs");
@ -1552,7 +1552,7 @@ namespace ArdupilotMega.GCSViews
}
else
{
MessageBox.Show("Max 10 at a time.");
CustomMessageBox.Show("Max 10 at a time.");
((CheckBox)sender).Checked = false;
}
ThemeManager.ApplyThemeTo(this);
@ -1635,7 +1635,7 @@ namespace ArdupilotMega.GCSViews
{
if (!MainV2.comPort.BaseStream.IsOpen)
{
MessageBox.Show("Please Connect First");
CustomMessageBox.Show("Please Connect First");
return;
}
@ -1645,13 +1645,13 @@ namespace ArdupilotMega.GCSViews
int intalt = (int)(100 * MainV2.cs.multiplierdist);
if (!int.TryParse(alt, out intalt))
{
MessageBox.Show("Bad Alt");
CustomMessageBox.Show("Bad Alt");
return;
}
if (gotolocation.Lat == 0 || gotolocation.Lng == 0)
{
MessageBox.Show("Bad Lat/Long");
CustomMessageBox.Show("Bad Lat/Long");
return;
}
@ -1735,7 +1735,7 @@ print 'Roll complete'
";
MessageBox.Show("This is Very ALPHA");
CustomMessageBox.Show("This is Very ALPHA");
Form scriptedit = new Form();
@ -1757,7 +1757,7 @@ print 'Roll complete'
scriptedit.ShowDialog();
if (DialogResult.Yes == MessageBox.Show("Run Script", "Run this script?", MessageBoxButtons.YesNo))
if (DialogResult.Yes == CustomMessageBox.Show("Run Script", "Run this script?", MessageBoxButtons.YesNo))
{
Script scr = new Script();

View File

@ -339,7 +339,6 @@
//
// BUT_write
//
this.BUT_write.ForeColor = System.Drawing.SystemColors.ControlText;
resources.ApplyResources(this.BUT_write, "BUT_write");
this.BUT_write.Name = "BUT_write";
this.BUT_write.UseVisualStyleBackColor = true;
@ -347,7 +346,6 @@
//
// BUT_read
//
this.BUT_read.ForeColor = System.Drawing.SystemColors.ControlText;
resources.ApplyResources(this.BUT_read, "BUT_read");
this.BUT_read.Name = "BUT_read";
this.BUT_read.UseVisualStyleBackColor = true;
@ -355,7 +353,6 @@
//
// SaveFile
//
this.SaveFile.ForeColor = System.Drawing.SystemColors.ControlText;
resources.ApplyResources(this.SaveFile, "SaveFile");
this.SaveFile.Name = "SaveFile";
this.SaveFile.UseVisualStyleBackColor = true;
@ -363,7 +360,6 @@
//
// BUT_loadwpfile
//
this.BUT_loadwpfile.ForeColor = System.Drawing.SystemColors.ControlText;
resources.ApplyResources(this.BUT_loadwpfile, "BUT_loadwpfile");
this.BUT_loadwpfile.Name = "BUT_loadwpfile";
this.BUT_loadwpfile.UseVisualStyleBackColor = true;
@ -608,7 +604,6 @@
//
// button1
//
this.button1.ForeColor = System.Drawing.SystemColors.ControlText;
resources.ApplyResources(this.button1, "button1");
this.button1.Name = "button1";
this.toolTip1.SetToolTip(this.button1, resources.GetString("button1.ToolTip"));
@ -617,7 +612,6 @@
//
// BUT_Add
//
this.BUT_Add.ForeColor = System.Drawing.SystemColors.ControlText;
resources.ApplyResources(this.BUT_Add, "BUT_Add");
this.BUT_Add.Name = "BUT_Add";
this.toolTip1.SetToolTip(this.BUT_Add, resources.GetString("BUT_Add.ToolTip"));

View File

@ -98,13 +98,13 @@ namespace ArdupilotMega.GCSViews
// if (!hashdefines.ContainsKey("WP_START_BYTE"))
{
MessageBox.Show("Your Ardupilot Mega project defines.h is Invalid");
CustomMessageBox.Show("Your Ardupilot Mega project defines.h is Invalid");
//return false;
}
}
catch (Exception)
{
MessageBox.Show("Can't open file!");
CustomMessageBox.Show("Can't open file!");
return false;
}
return true;
@ -180,7 +180,7 @@ namespace ArdupilotMega.GCSViews
}
if (wp_count == byte.MaxValue)
{
MessageBox.Show("To many Waypoints!!!");
CustomMessageBox.Show("To many Waypoints!!!");
break;
}
}
@ -200,7 +200,7 @@ namespace ArdupilotMega.GCSViews
}
catch (Exception ex)
{
MessageBox.Show("Can't open file! " + ex.ToString());
CustomMessageBox.Show("Can't open file! " + ex.ToString());
return false;
}
return true;
@ -260,7 +260,7 @@ namespace ArdupilotMega.GCSViews
{
if (selectedrow > Commands.RowCount)
{
MessageBox.Show("Invalid coord, How did you do this?");
CustomMessageBox.Show("Invalid coord, How did you do this?");
return;
}
DataGridViewTextBoxCell cell;
@ -286,13 +286,13 @@ namespace ArdupilotMega.GCSViews
if (result == 0 || pass == false)
{
MessageBox.Show("You must have a home altitude");
CustomMessageBox.Show("You must have a home altitude");
return;
}
int results1;
if (!int.TryParse(TXT_DefaultAlt.Text, out results1))
{
MessageBox.Show("Your default alt is not valid");
CustomMessageBox.Show("Your default alt is not valid");
return;
}
}
@ -332,7 +332,7 @@ namespace ArdupilotMega.GCSViews
if (float.Parse(TXT_homealt.Text) + int.Parse(TXT_DefaultAlt.Text) < alt) // calced height is less that GE ground height
{
MessageBox.Show("Altitude appears to be low!! (you will fly into a hill)\nGoogle Ground height: " + alt + " Meters\nYour height: " + ((float.Parse(TXT_homealt.Text) + int.Parse(TXT_DefaultAlt.Text))) + " Meters");
CustomMessageBox.Show("Altitude appears to be low!! (you will fly into a hill)\nGoogle Ground height: " + alt + " Meters\nYour height: " + ((float.Parse(TXT_homealt.Text) + int.Parse(TXT_DefaultAlt.Text))) + " Meters");
cell.Style.BackColor = Color.Red;
}
else
@ -346,7 +346,7 @@ namespace ArdupilotMega.GCSViews
}
else
{
MessageBox.Show("Invalid Home or wp Alt");
CustomMessageBox.Show("Invalid Home or wp Alt");
cell.Style.BackColor = Color.Red;
}
@ -772,7 +772,7 @@ namespace ArdupilotMega.GCSViews
for (int i = 1; i <= 7; i++)
Commands.Columns[i].HeaderText = "setme";
}
catch (Exception ex) { MessageBox.Show(ex.ToString()); }
catch (Exception ex) { CustomMessageBox.Show(ex.ToString()); }
}
/// <summary>
@ -797,7 +797,7 @@ namespace ArdupilotMega.GCSViews
//Console.WriteLine("editformat " + option + " value " + cmd);
ChangeColumnHeader(cmd);
}
catch (Exception ex) { MessageBox.Show(ex.ToString()); }
catch (Exception ex) { CustomMessageBox.Show(ex.ToString()); }
}
private void Commands_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
@ -1179,7 +1179,7 @@ namespace ArdupilotMega.GCSViews
}
sw.Close();
}
catch (Exception) { MessageBox.Show("Error writing file"); }
catch (Exception) { CustomMessageBox.Show("Error writing file"); }
}
}
@ -1248,7 +1248,7 @@ namespace ArdupilotMega.GCSViews
log.Info("Done");
}
catch (Exception ex) { error = 1; MessageBox.Show("Error : " + ex.ToString()); }
catch (Exception ex) { error = 1; CustomMessageBox.Show("Error : " + ex.ToString()); }
try
{
this.BeginInvoke((MethodInvoker)delegate()
@ -1282,7 +1282,7 @@ namespace ArdupilotMega.GCSViews
{
if (CHK_altmode.Checked)
{
if (DialogResult.No == MessageBox.Show("Absolute Alt is ticked are you sure?", "Alt Mode", MessageBoxButtons.YesNo))
if (DialogResult.No == CustomMessageBox.Show("Absolute Alt is ticked are you sure?", "Alt Mode", MessageBoxButtons.YesNo))
{
CHK_altmode.Checked = false;
}
@ -1298,7 +1298,7 @@ namespace ArdupilotMega.GCSViews
{
if (!double.TryParse(Commands[b, a].Value.ToString(), out answer))
{
MessageBox.Show("There are errors in your mission");
CustomMessageBox.Show("There are errors in your mission");
return;
}
}
@ -1501,7 +1501,7 @@ namespace ArdupilotMega.GCSViews
{
if (cellhome.Value.ToString() != TXT_homelat.Text && cellhome.Value.ToString() != "0")
{
DialogResult dr = MessageBox.Show("Reset Home to loaded coords", "Reset Home Coords", MessageBoxButtons.YesNo);
DialogResult dr = CustomMessageBox.Show("Reset Home to loaded coords", "Reset Home Coords", MessageBoxButtons.YesNo);
if (dr == DialogResult.Yes)
{
@ -1633,7 +1633,7 @@ namespace ArdupilotMega.GCSViews
}
if (isNumber > 127)
{
MessageBox.Show("The value can only be between 0 and 127");
CustomMessageBox.Show("The value can only be between 0 and 127");
TXT_WPRad.Text = "127";
}
writeKML();
@ -1656,7 +1656,7 @@ namespace ArdupilotMega.GCSViews
}
if (isNumber > 127)
{
MessageBox.Show("The value can only be between 0 and 127");
CustomMessageBox.Show("The value can only be between 0 and 127");
TXT_loiterrad.Text = "127";
}
}
@ -1712,7 +1712,7 @@ namespace ArdupilotMega.GCSViews
writeKML();
}
}
catch (Exception) { MessageBox.Show("Row error"); }
catch (Exception) { CustomMessageBox.Show("Row error"); }
}
private void Commands_DefaultValuesNeeded(object sender, DataGridViewRowEventArgs e)
@ -1792,7 +1792,7 @@ namespace ArdupilotMega.GCSViews
string header = sr.ReadLine();
if (header == null || !header.Contains("QGC WPL 110"))
{
MessageBox.Show("Invalid Waypoint file");
CustomMessageBox.Show("Invalid Waypoint file");
return;
}
while (!error && !sr.EndOfStream)
@ -1839,11 +1839,11 @@ namespace ArdupilotMega.GCSViews
wp_count++;
}
catch { MessageBox.Show("Line invalid\n" + line); }
catch { CustomMessageBox.Show("Line invalid\n" + line); }
if (wp_count == byte.MaxValue)
{
MessageBox.Show("To many Waypoints!!!");
CustomMessageBox.Show("To many Waypoints!!!");
break;
}
@ -1859,7 +1859,7 @@ namespace ArdupilotMega.GCSViews
}
catch (Exception ex)
{
MessageBox.Show("Can't open file! " + ex.ToString());
CustomMessageBox.Show("Can't open file! " + ex.ToString());
}
}
@ -2252,7 +2252,7 @@ namespace ArdupilotMega.GCSViews
FlightData.mymap.MapType = (MapType)comboBoxMapType.SelectedItem;
MainV2.config["MapType"] = comboBoxMapType.Text;
}
catch { MessageBox.Show("Map change failed. try zomming out first."); }
catch { CustomMessageBox.Show("Map change failed. try zomming out first."); }
}
private void Commands_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
@ -2324,7 +2324,7 @@ namespace ArdupilotMega.GCSViews
private void TXT_homelat_Enter(object sender, EventArgs e)
{
sethome = true;
MessageBox.Show("Click on the Map to set Home ");
CustomMessageBox.Show("Click on the Map to set Home ");
}
private void Planner_Resize(object sender, EventArgs e)
@ -2345,7 +2345,7 @@ namespace ArdupilotMega.GCSViews
private void CHK_altmode_CheckedChanged(object sender, EventArgs e)
{
if (Commands.RowCount > 0 && !quickadd)
MessageBox.Show("You will need to change your altitudes");
CustomMessageBox.Show("You will need to change your altitudes");
}
protected override void OnPaint(PaintEventArgs pe)
@ -2391,7 +2391,7 @@ namespace ArdupilotMega.GCSViews
RectLatLng area = MainMap.SelectedArea;
if (area.IsEmpty)
{
DialogResult res = MessageBox.Show("No ripp area defined, ripp displayed on screen?", "Rip", MessageBoxButtons.YesNo);
DialogResult res = CustomMessageBox.Show("No ripp area defined, ripp displayed on screen?", "Rip", MessageBoxButtons.YesNo);
if (res == DialogResult.Yes)
{
area = MainMap.CurrentViewArea;
@ -2400,7 +2400,7 @@ namespace ArdupilotMega.GCSViews
if (!area.IsEmpty)
{
DialogResult res = MessageBox.Show("Ready ripp at Zoom = " + (int)MainMap.Zoom + " ?", "GMap.NET", MessageBoxButtons.YesNo);
DialogResult res = CustomMessageBox.Show("Ready ripp at Zoom = " + (int)MainMap.Zoom + " ?", "GMap.NET", MessageBoxButtons.YesNo);
for (int i = 1; i <= MainMap.MaxZoom; i++)
{
@ -2422,7 +2422,7 @@ namespace ArdupilotMega.GCSViews
}
else
{
MessageBox.Show("Select map area holding ALT", "GMap.NET", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
CustomMessageBox.Show("Select map area holding ALT", "GMap.NET", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
@ -2485,7 +2485,7 @@ namespace ArdupilotMega.GCSViews
if (drawnpolygon == null || drawnpolygon.Points.Count == 0)
{
MessageBox.Show("Right click the map to draw a polygon", "Area", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
CustomMessageBox.Show("Right click the map to draw a polygon", "Area", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
GMapPolygon area = drawnpolygon;
@ -2520,17 +2520,17 @@ namespace ArdupilotMega.GCSViews
if (!double.TryParse(angle, out tryme))
{
MessageBox.Show("Invalid Angle");
CustomMessageBox.Show("Invalid Angle");
return;
}
if (!double.TryParse(alt, out tryme))
{
MessageBox.Show("Invalid Alt");
CustomMessageBox.Show("Invalid Alt");
return;
}
if (!double.TryParse(distance, out tryme))
{
MessageBox.Show("Invalid Distance");
CustomMessageBox.Show("Invalid Distance");
return;
}
@ -2691,7 +2691,7 @@ namespace ArdupilotMega.GCSViews
if (Commands.RowCount > 150)
{
MessageBox.Show("Stopping at 150 WP's");
CustomMessageBox.Show("Stopping at 150 WP's");
break;
}
}
@ -2713,7 +2713,7 @@ namespace ArdupilotMega.GCSViews
}
else
{
MessageBox.Show("If you're at the field, connect to your APM and wait for GPS lock. Then click 'Home Location' link to set home to your location");
CustomMessageBox.Show("If you're at the field, connect to your APM and wait for GPS lock. Then click 'Home Location' link to set home to your location");
}
}
@ -2771,7 +2771,7 @@ namespace ArdupilotMega.GCSViews
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")));
CustomMessageBox.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();
@ -2794,7 +2794,7 @@ namespace ArdupilotMega.GCSViews
{
if (polygongridmode == false)
{
MessageBox.Show("You will remain in polygon mode until you clear the polygon or create a grid/upload a fence");
CustomMessageBox.Show("You will remain in polygon mode until you clear the polygon or create a grid/upload a fence");
}
polygongridmode = true;
@ -2909,7 +2909,7 @@ namespace ArdupilotMega.GCSViews
MainMap.Invalidate();
}
catch {
MessageBox.Show("Remove point Failed. Please try again.");
CustomMessageBox.Show("Remove point Failed. Please try again.");
}
}
}
@ -2981,7 +2981,7 @@ namespace ArdupilotMega.GCSViews
GeoCoderStatusCode status = MainMap.SetCurrentPositionByKeywords(place);
if (status != GeoCoderStatusCode.G_GEO_SUCCESS)
{
MessageBox.Show("Google Maps Geocoder can't find: '" + place + "', reason: " + status.ToString(), "GMap.NET", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
CustomMessageBox.Show("Google Maps Geocoder can't find: '" + place + "', reason: " + status.ToString(), "GMap.NET", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else
{
@ -3017,7 +3017,7 @@ namespace ArdupilotMega.GCSViews
parser.ElementAdded += parser_ElementAdded;
parser.ParseString(kml, true);
if (DialogResult.Yes == MessageBox.Show("Do you want to load this into the flight data screen?", "Load data", MessageBoxButtons.YesNo))
if (DialogResult.Yes == CustomMessageBox.Show("Do you want to load this into the flight data screen?", "Load data", MessageBoxButtons.YesNo))
{
foreach (var temp in kmlpolygons.Polygons)
{
@ -3030,7 +3030,7 @@ namespace ArdupilotMega.GCSViews
}
}
catch (Exception ex) { MessageBox.Show("Bad KML File :" + ex.ToString()); }
catch (Exception ex) { CustomMessageBox.Show("Bad KML File :" + ex.ToString()); }
}
}
@ -3064,25 +3064,25 @@ namespace ArdupilotMega.GCSViews
//FENCE_TOTAL
if (MainV2.comPort.param["FENCE_ACTION"] == null)
{
MessageBox.Show("Not Supported");
CustomMessageBox.Show("Not Supported");
return;
}
if (drawnpolygon == null)
{
MessageBox.Show("No polygon to upload");
CustomMessageBox.Show("No polygon to upload");
return;
}
if (geofence.Markers.Count == 0)
{
MessageBox.Show("No return location set");
CustomMessageBox.Show("No return location set");
return;
}
if (drawnpolygon.Points.Count == 0)
{
MessageBox.Show("No polygon drawn");
CustomMessageBox.Show("No polygon drawn");
return;
}
@ -3093,7 +3093,7 @@ namespace ArdupilotMega.GCSViews
// check it
if (!pnpoly(plll.ToArray(), geofence.Markers[0].Position.Lat, geofence.Markers[0].Position.Lng))
{
MessageBox.Show("Your return location is outside the polygon");
CustomMessageBox.Show("Your return location is outside the polygon");
return;
}
@ -3108,13 +3108,13 @@ namespace ArdupilotMega.GCSViews
if (!int.TryParse(minalts, out minalt))
{
MessageBox.Show("Bad Min Alt");
CustomMessageBox.Show("Bad Min Alt");
return;
}
if (!int.TryParse(maxalts, out maxalt))
{
MessageBox.Show("Bad Max Alt");
CustomMessageBox.Show("Bad Max Alt");
return;
}
@ -3125,7 +3125,7 @@ namespace ArdupilotMega.GCSViews
}
catch
{
MessageBox.Show("Failed to set min/max fence alt");
CustomMessageBox.Show("Failed to set min/max fence alt");
return;
}
@ -3136,7 +3136,7 @@ namespace ArdupilotMega.GCSViews
}
catch
{
MessageBox.Show("Failed to set FENCE_ACTION");
CustomMessageBox.Show("Failed to set FENCE_ACTION");
return;
}
@ -3192,13 +3192,13 @@ namespace ArdupilotMega.GCSViews
if (MainV2.comPort.param["FENCE_ACTION"] == null || MainV2.comPort.param["FENCE_TOTAL"] == null)
{
MessageBox.Show("Not Supported");
CustomMessageBox.Show("Not Supported");
return;
}
if (int.Parse(MainV2.comPort.param["FENCE_TOTAL"].ToString()) <= 1)
{
MessageBox.Show("Nothing to download");
CustomMessageBox.Show("Nothing to download");
return;
}
@ -3320,7 +3320,7 @@ namespace ArdupilotMega.GCSViews
{
if (geofence.Markers.Count == 0)
{
MessageBox.Show("Please set a return location");
CustomMessageBox.Show("Please set a return location");
return;
}
@ -3362,7 +3362,7 @@ namespace ArdupilotMega.GCSViews
sw.Close();
}
catch { MessageBox.Show("Failed to write fence file"); }
catch { CustomMessageBox.Show("Failed to write fence file"); }
}
}

View File

@ -274,7 +274,7 @@ namespace ArdupilotMega.GCSViews
if (MainV2.comPort.BaseStream.IsOpen == false)
{
MessageBox.Show("Please connect first");
CustomMessageBox.Show("Please connect first");
return;
}

View File

@ -152,7 +152,7 @@ namespace ArdupilotMega.GCSViews
comPort.Write(Encoding.ASCII.GetBytes(cmd + "\r"), 0, cmd.Length + 1);
}
}
catch { MessageBox.Show("Error writing to com port"); }
catch { CustomMessageBox.Show("Error writing to com port"); }
}
}
/*

View File

@ -117,7 +117,7 @@ namespace ArdupilotMega
joystick.Acquire();
System.Windows.Forms.MessageBox.Show("Please ensure you have calibrated your joystick in Windows first");
System.Windows.Forms.CustomMessageBox.Show("Please ensure you have calibrated your joystick in Windows first");
joystick.Poll();
@ -133,7 +133,7 @@ namespace ArdupilotMega
values["Slider1"] = obj.GetSlider()[0];
values["Slider2"] = obj.GetSlider()[1];
System.Windows.Forms.MessageBox.Show("Please move the joystick axis you want assigned to this function after clicking ok");
System.Windows.Forms.CustomMessageBox.Show("Please move the joystick axis you want assigned to this function after clicking ok");
DateTime start = DateTime.Now;
@ -178,7 +178,7 @@ namespace ArdupilotMega
}
}
System.Windows.Forms.MessageBox.Show("No valid option was detected");
System.Windows.Forms.CustomMessageBox.Show("No valid option was detected");
return joystickaxis.None;
}
@ -210,7 +210,7 @@ namespace ArdupilotMega
joystick.Poll();
System.Windows.Forms.MessageBox.Show("Please press the joystick button you want assigned to this function after clicking ok");
System.Windows.Forms.CustomMessageBox.Show("Please press the joystick button you want assigned to this function after clicking ok");
DateTime start = DateTime.Now;
@ -228,7 +228,7 @@ namespace ArdupilotMega
}
}
System.Windows.Forms.MessageBox.Show("No valid option was detected");
System.Windows.Forms.CustomMessageBox.Show("No valid option was detected");
return -1;
}
@ -332,7 +332,7 @@ namespace ArdupilotMega
MainV2.comPort.setMode(mode);
}
catch { System.Windows.Forms.MessageBox.Show("Failed to change Modes"); }
catch { System.Windows.Forms.CustomMessageBox.Show("Failed to change Modes"); }
});
}
}

View File

@ -34,7 +34,7 @@ namespace ArdupilotMega
CMB_joysticks.Items.Add(device.ProductName);
}
}
catch { MessageBox.Show("Error geting joystick list: do you have the directx redist installed?"); this.Close(); return; }
catch { CustomMessageBox.Show("Error geting joystick list: do you have the directx redist installed?"); this.Close(); return; }
if (CMB_joysticks.Items.Count > 0)
CMB_joysticks.SelectedIndex = 0;
@ -134,7 +134,7 @@ namespace ArdupilotMega
{
joy.setButton(f, int.Parse(this.Controls.Find("cmbbutton" + name, false)[0].Text), this.Controls.Find("cmbaction" + name, false)[0].Text);
}
catch { MessageBox.Show("Set Button "+ name + " Failed"); }
catch { CustomMessageBox.Show("Set Button "+ name + " Failed"); }
}
joy.start(CMB_joysticks.Text);

View File

@ -77,7 +77,7 @@ namespace ArdupilotMega
catch (Exception ex)
{
log.Error("Error opening comport", ex);
MessageBox.Show("Error opening comport");
CustomMessageBox.Show("Error opening comport");
}
var t11 = new System.Threading.Thread(delegate()
@ -312,7 +312,7 @@ namespace ArdupilotMega
log.Info("exit while");
}
catch (Exception ex) { MessageBox.Show("Error reading data" + ex.ToString()); }
catch (Exception ex) { CustomMessageBox.Show("Error reading data" + ex.ToString()); }
}
string lastline = "";
@ -899,7 +899,7 @@ namespace ArdupilotMega
tr.Close();
}
catch (Exception ex) { MessageBox.Show("Error processing log. Is it still downloading? " + ex.Message); continue; }
catch (Exception ex) { CustomMessageBox.Show("Error processing log. Is it still downloading? " + ex.Message); continue; }
writeKMLFirstPerson(logfile + ".kml");

View File

@ -52,7 +52,7 @@ namespace ArdupilotMega
dataGridView1.DataSource = m_dtCSV;
}
catch (Exception ex) { MessageBox.Show("Failed to read File: " + ex.ToString()); }
catch (Exception ex) { CustomMessageBox.Show("Failed to read File: " + ex.ToString()); }
foreach (DataGridViewColumn column in dataGridView1.Columns)
{
@ -256,7 +256,7 @@ namespace ArdupilotMega
{
if (dataGridView1.RowCount == 0 || dataGridView1.ColumnCount == 0)
{
MessageBox.Show("Please load a valid file");
CustomMessageBox.Show("Please load a valid file");
return;
}
@ -267,7 +267,7 @@ namespace ArdupilotMega
if (col == 0)
{
MessageBox.Show("Please pick another column, Highlight the cell you wish to graph");
CustomMessageBox.Show("Please pick another column, Highlight the cell you wish to graph");
return;
}
@ -307,11 +307,11 @@ namespace ArdupilotMega
}
else
{
MessageBox.Show("Max of 5");
CustomMessageBox.Show("Max of 5");
break;
}
}
catch { error++; log.Info("Bad Data : " + type + " " + col + " " + a); if (error >= 500) { MessageBox.Show("There is to much bad data - failing"); break; } }
catch { error++; log.Info("Bad Data : " + type + " " + col + " " + a); if (error >= 500) { CustomMessageBox.Show("There is to much bad data - failing"); break; } }
}
a++;
}

View File

@ -472,13 +472,6 @@ namespace ArdupilotMega
return true;
}
public bool setParam(string paramname, object flag)
{
int value = (int)(float)param[paramname];
return setParam(paramname, value | (int)flag);
}
/// <summary>
/// Set parameter on apm
/// </summary>
@ -1917,7 +1910,7 @@ namespace ArdupilotMega
MainV2.comPort.generatePacket((byte)MAVLink.MAVLINK_MSG_ID_SET_MODE, mode);
}
}
catch { System.Windows.Forms.MessageBox.Show("Failed to change Modes"); }
catch { System.Windows.Forms.CustomMessageBox.Show("Failed to change Modes"); }
#endif
}

View File

@ -5,23 +5,24 @@ using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Collections;
using netDxf;
using netDxf.Entities;
using netDxf.Tables;
using netDxf.Header;
using System.Reflection;
using log4net;
namespace ArdupilotMega
{
public class MagCalib
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//alglib.lsfit.
public static void doWork()
/// <summary>
/// Self contained process tlog and save/display offsets
/// </summary>
public static void ProcessLog()
{
// based of tridge's work
Tuple<float, float, float> offset = new Tuple<float, float, float>(0, 0, 0);
List<Tuple<float, float, float>> data = new List<Tuple<float, float, float>>();
Hashtable filter = new Hashtable();
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "*.tlog|*.tlog";
openFileDialog1.FilterIndex = 2;
@ -37,8 +38,42 @@ namespace ArdupilotMega
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
foreach (string logfile in openFileDialog1.FileNames)
double[] ans = getOffsets(openFileDialog1.FileName);
SaveOffsets(ans);
}
}
/// <summary>
/// Processes a tlog to get the offsets - creates dxf of data
/// </summary>
/// <param name="fn">Filename</param>
/// <returns>Offsets</returns>
public static double[] getOffsets(string fn)
{
// based of tridge's work
string logfile = fn;
// old method
float minx = 0;
float maxx = 0;
float miny = 0;
float maxy = 0;
float minz = 0;
float maxz = 0;
// this is for a dxf
Polyline3dVertex vertex;
List<Polyline3dVertex> vertexes = new List<Polyline3dVertex>();
// data storage
Tuple<float, float, float> offset = new Tuple<float, float, float>(0, 0, 0);
List<Tuple<float, float, float>> data = new List<Tuple<float, float, float>>();
Hashtable filter = new Hashtable();
log.Info("Start log: " + DateTime.Now);
MAVLink mine = new MAVLink();
mine.logplaybackfile = new BinaryReader(File.Open(logfile, FileMode.Open, FileAccess.Read, FileShare.Read));
@ -49,22 +84,17 @@ namespace ArdupilotMega
// gather data
while (mine.logplaybackfile.BaseStream.Position < mine.logplaybackfile.BaseStream.Length)
{
// bar moves to 100 % in this step
//progressBar1.Value = (int)((float)mine.logplaybackfile.BaseStream.Position / (float)mine.logplaybackfile.BaseStream.Length * 100.0f / 1.0f);
//progressBar1.Refresh();
//Application.DoEvents();
byte[] packetraw = mine.readPacket();
var packet = mine.DebugPacket(packetraw);
var packet = mine.DebugPacket(packetraw, false);
// this is for packets we dont know about
if (packet == null)
continue;
if (packet.GetType() == typeof(MAVLink.__mavlink_sensor_offsets_t))
{
offset = new Tuple<float,float,float>(
offset = new Tuple<float, float, float>(
((MAVLink.__mavlink_sensor_offsets_t)packet).mag_ofs_x,
((MAVLink.__mavlink_sensor_offsets_t)packet).mag_ofs_y,
((MAVLink.__mavlink_sensor_offsets_t)packet).mag_ofs_z);
@ -73,6 +103,21 @@ namespace ArdupilotMega
{
int div = 20;
// fox dxf
vertex = new Polyline3dVertex(new Vector3f(
((MAVLink.__mavlink_raw_imu_t)packet).xmag - offset.Item1,
((MAVLink.__mavlink_raw_imu_t)packet).ymag - offset.Item2,
((MAVLink.__mavlink_raw_imu_t)packet).zmag - offset.Item3)
);
vertexes.Add(vertex);
// for old method
setMinorMax(((MAVLink.__mavlink_raw_imu_t)packet).xmag - offset.Item1, ref minx, ref maxx);
setMinorMax(((MAVLink.__mavlink_raw_imu_t)packet).ymag - offset.Item2, ref miny, ref maxy);
setMinorMax(((MAVLink.__mavlink_raw_imu_t)packet).zmag - offset.Item3, ref minz, ref maxz);
// for new lease sq
string item = (int)(((MAVLink.__mavlink_raw_imu_t)packet).xmag / div) + "," +
(int)(((MAVLink.__mavlink_raw_imu_t)packet).ymag / div) + "," +
(int)(((MAVLink.__mavlink_raw_imu_t)packet).zmag / div);
@ -94,10 +139,13 @@ namespace ArdupilotMega
((MAVLink.__mavlink_raw_imu_t)packet).xmag - offset.Item1,
((MAVLink.__mavlink_raw_imu_t)packet).ymag - offset.Item2,
((MAVLink.__mavlink_raw_imu_t)packet).zmag - offset.Item3));
}
}
log.Info("Log Processed " + DateTime.Now);
Console.WriteLine("Extracted " + data.Count + " data points");
Console.WriteLine("Current offset: " + offset);
@ -105,6 +153,46 @@ namespace ArdupilotMega
mine.logplaybackfile.Close();
mine.logplaybackfile = null;
double[] x = LeastSq(data);
System.Console.WriteLine("Old Method {0} {1} {2}", -(maxx + minx) / 2, -(maxy + miny) / 2, -(maxz + minz) / 2);
log.Info("Least Sq Done " + DateTime.Now);
// create a dxf for those who want to "see" the calibration
DxfDocument dxf = new DxfDocument();
Polyline3d polyline = new Polyline3d(vertexes, true);
polyline.Layer = new Layer("polyline3d");
polyline.Layer.Color.Index = 24;
dxf.AddEntity(polyline);
Point pnt = new Point(new Vector3f(-offset.Item1, -offset.Item2, -offset.Item3));
pnt.Layer = new Layer("old offset");
pnt.Layer.Color.Index = 22;
dxf.AddEntity(pnt);
pnt = new Point(new Vector3f(-(float)x[0], -(float)x[1], -(float)x[2]));
pnt.Layer = new Layer("new offset");
pnt.Layer.Color.Index = 21;
dxf.AddEntity(pnt);
dxf.Save("magoffset.dxf", DxfVersion.AutoCad2000);
log.Info("dxf Done " + DateTime.Now);
Array.Resize<double>(ref x, 3);
return x;
}
/// <summary>
/// Does the least sq adjustment to find the center of the sphere
/// </summary>
/// <param name="data">list of x,y,z data</param>
/// <returns>offsets</returns>
public static double[] LeastSq(List<Tuple<float, float, float>> data)
{
double[] x = new double[] { 0, 0, 0, 0 };
double epsg = 0.0000000001;
double epsf = 0;
@ -118,19 +206,57 @@ namespace ArdupilotMega
alglib.minlmoptimize(state, sphere_error, null, data);
alglib.minlmresults(state, out x, out rep);
System.Console.WriteLine("{0}", rep.terminationtype); // EXPECTED: 4
System.Console.WriteLine("{0}", alglib.ap.format(x, 2)); // EXPECTED: [-3,+3]
//System.Console.ReadLine();
log.InfoFormat("{0}", rep.terminationtype);
log.InfoFormat("{0}", alglib.ap.format(x, 2));
// return;
}
}
return x;
}
public static void sphere_error(double[] xi, double[] fi, object obj)
/// <summary>
/// saves the offests to eeprom, os displays if cant
/// </summary>
/// <param name="ofs">offsets</param>
public static void SaveOffsets(double[] ofs)
{
if (MainV2.comPort.param.ContainsKey("COMPASS_OFS_X"))
{
try
{
// disable learning
MainV2.comPort.setParam("COMPASS_LEARN", 0);
// set values
MainV2.comPort.setParam("COMPASS_OFS_X", (float)ofs[0]);
MainV2.comPort.setParam("COMPASS_OFS_Y", (float)ofs[1]);
MainV2.comPort.setParam("COMPASS_OFS_Z", (float)ofs[2]);
}
catch {
CustomMessageBox.Show("Set Compass offset failed");
return;
}
CustomMessageBox.Show("New offsets are " + ofs[0].ToString("0") + " " + ofs[1].ToString("0") + " " + ofs[2].ToString("0") +"\nThese have been saved for you.", "New Mag Offsets");
}
else
{
CustomMessageBox.Show("New offsets are " + ofs[0].ToString("0") + " " + ofs[1].ToString("0") + " " + ofs[2].ToString("0") + "\n\nPlease write these down for manual entry", "New Mag Offsets");
}
}
/// <summary>
/// Min or max finder
/// </summary>
/// <param name="value">value to process</param>
/// <param name="min">current min</param>
/// <param name="max">current max</param>
private static void setMinorMax(float value, ref float min, ref float max)
{
if (value > max)
max = value;
if (value < min)
min = value;
}
static void sphere_error(double[] xi, double[] fi, object obj)
{
double xofs = xi[0];
double yofs = xi[1];

View File

@ -171,7 +171,7 @@ namespace ArdupilotMega
// preload
Python.CreateEngine();
}
catch (Exception e) { MessageBox.Show("A Major error has occured : " + e.ToString()); this.Close(); }
catch (Exception e) { CustomMessageBox.Show("A Major error has occured : " + e.ToString()); this.Close(); }
if (MainV2.config["CHK_GDIPlus"] != null)
GCSViews.FlightData.myhud.UseOpenGL = !bool.Parse(MainV2.config["CHK_GDIPlus"].ToString());
@ -232,7 +232,7 @@ namespace ArdupilotMega
if (cs.rateattitude == 0) // initilised to 10, configured above from save
{
MessageBox.Show("NOTE: your attitude rate is 0, the hud will not work\nChange in Configuration > Planner > Telemetry Rates");
CustomMessageBox.Show("NOTE: your attitude rate is 0, the hud will not work\nChange in Configuration > Planner > Telemetry Rates");
}
@ -249,7 +249,7 @@ namespace ArdupilotMega
if (Framework < 3.5)
{
MessageBox.Show("This program requires .NET Framework 3.5. You currently have " + Framework);
CustomMessageBox.Show("This program requires .NET Framework 3.5. You currently have " + Framework);
}
}
@ -303,7 +303,7 @@ namespace ArdupilotMega
}
string name = "ss" + DateTime.Now.ToString("hhmmss") + ".jpg";
bitmap.Save(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + name, System.Drawing.Imaging.ImageFormat.Jpeg);
MessageBox.Show("Screenshot saved to " + name);
CustomMessageBox.Show("Screenshot saved to " + name);
}
}
@ -475,7 +475,7 @@ namespace ArdupilotMega
if (comPort.BaseStream.IsOpen && cs.groundspeed > 4)
{
if (DialogResult.No == MessageBox.Show("Your model is still moving are you sure you want to disconnect?", "Disconnect", MessageBoxButtons.YesNo))
if (DialogResult.No == CustomMessageBox.Show("Your model is still moving are you sure you want to disconnect?", "Disconnect", MessageBoxButtons.YesNo))
{
return;
}
@ -538,9 +538,9 @@ namespace ArdupilotMega
try
{
Directory.CreateDirectory(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs");
comPort.logfile = new BinaryWriter(File.Open(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs" + Path.DirectorySeparatorChar + DateTime.Now.ToString("yyyy-MM-dd hh-mm-ss") + ".tlog", FileMode.CreateNew));
comPort.logfile = new BinaryWriter(File.Open(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs" + Path.DirectorySeparatorChar + DateTime.Now.ToString("yyyy-MM-dd hh-mm-ss") + ".tlog", FileMode.CreateNew,FileAccess.ReadWrite,FileShare.Read));
}
catch { MessageBox.Show("Failed to create log - wont log this session"); } // soft fail
catch { CustomMessageBox.Show("Failed to create log - wont log this session"); } // soft fail
comPort.BaseStream.PortName = CMB_serialport.Text;
comPort.Open(true);
@ -605,7 +605,7 @@ namespace ArdupilotMega
}
else
{
MessageBox.Show("You dont appear to have uploaded a firmware yet,\n\nPlease goto the firmware page and upload one.");
CustomMessageBox.Show("You dont appear to have uploaded a firmware yet,\n\nPlease goto the firmware page and upload one.");
return;
}
}
@ -733,7 +733,7 @@ namespace ArdupilotMega
//appconfig.Save();
}
catch (Exception ex) { MessageBox.Show(ex.ToString()); }
catch (Exception ex) { CustomMessageBox.Show(ex.ToString()); }
}
else
{
@ -1071,6 +1071,9 @@ namespace ArdupilotMega
MenuFlightData_Click(sender, e);
// for long running tasks using own threads.
// for short use threadpool
try
{
listener = new TcpListener(IPAddress.Any, 56781);
@ -1085,7 +1088,7 @@ namespace ArdupilotMega
catch (Exception ex)
{
log.Error("Error starting TCP listener thread: ", ex);
MessageBox.Show(ex.ToString());
CustomMessageBox.Show(ex.ToString());
}
var t12 = new Thread(new ThreadStart(joysticksend))
@ -1493,7 +1496,7 @@ namespace ArdupilotMega
catch (Exception ex)
{
log.Error("Update Failed", ex);
MessageBox.Show("Update Failed " + ex.Message);
CustomMessageBox.Show("Update Failed " + ex.Message);
}
}
@ -1556,13 +1559,7 @@ namespace ArdupilotMega
if (fi.Length != response.ContentLength || response.Headers[HttpResponseHeader.ETag] != CurrentEtag)
{
using (var sw = new StreamWriter(path + ".etag"))
{
sw.WriteLine(response.Headers[HttpResponseHeader.ETag]);
sw.Close();
}
shouldGetFile = true;
log.Info("Newer file found: " + path + " " + fi.Length + " vs " + response.ContentLength);
}
}
else
@ -1576,7 +1573,7 @@ namespace ArdupilotMega
if (shouldGetFile)
{
var dr = MessageBox.Show("Update Found\n\nDo you wish to update now?", "Update Now", MessageBoxButtons.YesNo);
var dr = CustomMessageBox.Show("Update Found\n\nDo you wish to update now?", "Update Now", MessageBoxButtons.YesNo);
if (dr == DialogResult.Yes)
{
DoUpdate();
@ -1858,7 +1855,7 @@ namespace ArdupilotMega
{
MainV2.comPort.Open(false);
}
catch (Exception ex) { MessageBox.Show(ex.ToString()); }
catch (Exception ex) { CustomMessageBox.Show(ex.ToString()); }
return true;
}
if (keyData == (Keys.Control | Keys.Y)) // for ryan beall
@ -1871,7 +1868,7 @@ namespace ArdupilotMega
#else
MainV2.comPort.doAction(MAVLink.MAV_ACTION.MAV_ACTION_STORAGE_WRITE);
#endif
MessageBox.Show("Done MAV_ACTION_STORAGE_WRITE");
CustomMessageBox.Show("Done MAV_ACTION_STORAGE_WRITE");
return true;
}
if (keyData == (Keys.Control | Keys.J)) // for jani

View File

@ -33,9 +33,11 @@ namespace ArdupilotMega
CodeGen.runCode("Sin(0.55)");
//MagCalib.doWork();
int wt = 0, ct = 0;
ThreadPool.GetMaxThreads(out wt, out ct);
log.Info("Max Threads: " + wt);
//return;
//MagCalib.ProcessLog();
//MessageBox.Show("NOTE: This version may break advanced mission scripting");
@ -66,17 +68,17 @@ namespace ArdupilotMega
log.Debug(ex.ToString());
if (ex.Message == "The port is closed.") {
MessageBox.Show("Serial connection has been lost");
CustomMessageBox.Show("Serial connection has been lost");
return;
}
if (ex.Message == "A device attached to the system is not functioning.")
{
MessageBox.Show("Serial connection has been lost");
CustomMessageBox.Show("Serial connection has been lost");
return;
}
if (e.Exception.GetType() == typeof(MissingMethodException))
{
MessageBox.Show("Please Update - Some older library dlls are causing problems\n" + e.Exception.Message);
CustomMessageBox.Show("Please Update - Some older library dlls are causing problems\n" + e.Exception.Message);
return;
}
if (e.Exception.GetType() == typeof(ObjectDisposedException) || e.Exception.GetType() == typeof(InvalidOperationException)) // something is trying to update while the form, is closing.
@ -85,10 +87,10 @@ namespace ArdupilotMega
}
if (e.Exception.GetType() == typeof(FileNotFoundException) || e.Exception.GetType() == typeof(BadImageFormatException)) // i get alot of error from people who click the exe from inside a zip file.
{
MessageBox.Show("You are missing some DLL's. Please extract the zip file somewhere. OR Use the update feature from the menu");
CustomMessageBox.Show("You are missing some DLL's. Please extract the zip file somewhere. OR Use the update feature from the menu");
return;
}
DialogResult dr = MessageBox.Show("An error has occurred\n"+ex.ToString() + "\n\nReport this Error???", "Send Error", MessageBoxButtons.YesNo);
DialogResult dr = CustomMessageBox.Show("An error has occurred\n"+ex.ToString() + "\n\nReport this Error???", "Send Error", MessageBoxButtons.YesNo);
if (DialogResult.Yes == dr)
{
try
@ -130,7 +132,7 @@ namespace ArdupilotMega
}
catch
{
MessageBox.Show("Error sending Error report!! Youre most likerly are not on the internet");
CustomMessageBox.Show("Error sending Error report!! Youre most likerly are not on the internet");
}
}
}

View File

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

View File

@ -190,47 +190,6 @@ namespace ArdupilotMega
else { list6.Clear(); }
}
public static string CustomMessageBox(string title, string promptText, string buttontext1, string buttontext2)
{
Form form = new Form();
System.Windows.Forms.Label label = new System.Windows.Forms.Label();
Button button1 = new Button();
Button button2 = new Button();
form.Text = title;
label.Text = promptText;
button1.Text = buttontext1;
button2.Text = buttontext2;
button1.DialogResult = DialogResult.OK;
button2.DialogResult = DialogResult.Cancel;
label.SetBounds(9, 10, 372, 13);
button1.SetBounds(228, 72, 75, 23);
button2.SetBounds(309, 72, 75, 23);
label.AutoSize = true;
button1.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
button2.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
form.ClientSize = new Size(396, 107);
form.Controls.AddRange(new Control[] { label, button1, button2 });
form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height);
form.FormBorderStyle = FormBorderStyle.FixedDialog;
form.StartPosition = FormStartPosition.CenterScreen;
form.MinimizeBox = false;
form.MaximizeBox = false;
form.AcceptButton = button1;
form.CancelButton = button2;
DialogResult dialogResult = form.ShowDialog();
if (dialogResult == DialogResult.OK)
{
return buttontext1;
}
return buttontext2;
}
private void ACM_Setup_Load(object sender, EventArgs e)
{
@ -274,7 +233,7 @@ namespace ArdupilotMega
if (!comPort.BaseStream.IsOpen && !MainV2.comPort.logreadmode)
{
MessageBox.Show("Please connect first");
CustomMessageBox.Show("Please connect first");
this.Close();
}
@ -292,7 +251,7 @@ namespace ArdupilotMega
}
catch
{
MessageBox.Show("Comport open failed");
CustomMessageBox.Show("Comport open failed");
return;
}
timer1.Start();

View File

@ -29,6 +29,7 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(_3DRradio));
this.Progressbar = new System.Windows.Forms.ProgressBar();
this.S1 = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
@ -97,7 +98,7 @@
this.S1.Name = "S1";
this.S1.Size = new System.Drawing.Size(80, 21);
this.S1.TabIndex = 4;
this.toolTip1.SetToolTip(this.S1, "Serial Baud Rate 57 = 57600");
this.toolTip1.SetToolTip(this.S1, "Serial baud rate in rounded kbps. So 57 means 57600. \r\n");
//
// label1
//
@ -149,7 +150,9 @@
this.S2.Name = "S2";
this.S2.Size = new System.Drawing.Size(80, 21);
this.S2.TabIndex = 9;
this.toolTip1.SetToolTip(this.S2, "the inter-radio data rate in rounded kbps. So 128 means");
this.toolTip1.SetToolTip(this.S2, "AIR_SPEED is the inter-radio data rate in rounded kbps. So 128 means 128kbps. Max" +
" is 192, min is 2. I would not recommend values below 16 as the frequency hoppin" +
"g and tdm sync times get too long. ");
//
// label4
//
@ -198,7 +201,7 @@
this.S3.Name = "S3";
this.S3.Size = new System.Drawing.Size(80, 21);
this.S3.TabIndex = 11;
this.toolTip1.SetToolTip(this.S3, "a 16 bit \'network ID\'. This is used to seed the frequency");
this.toolTip1.SetToolTip(this.S3, resources.GetString("S3.ToolTip"));
//
// label5
//
@ -238,7 +241,8 @@
this.S4.Name = "S4";
this.S4.Size = new System.Drawing.Size(80, 21);
this.S4.TabIndex = 13;
this.toolTip1.SetToolTip(this.S4, "the transmit power in dBm. 20dBm is 100mW. It is useful to");
this.toolTip1.SetToolTip(this.S4, "TXPOWER is the transmit power in dBm. 20dBm is 100mW. It is useful to set this to" +
" lower levels for short range testing.\r\n");
//
// label6
//
@ -255,7 +259,7 @@
this.S5.Name = "S5";
this.S5.Size = new System.Drawing.Size(80, 21);
this.S5.TabIndex = 15;
this.toolTip1.SetToolTip(this.S5, "to enable/disable the golay error correcting code. It defaults");
this.toolTip1.SetToolTip(this.S5, resources.GetString("S5.ToolTip"));
//
// label7
//
@ -272,7 +276,7 @@
this.S6.Name = "S6";
this.S6.Size = new System.Drawing.Size(80, 21);
this.S6.TabIndex = 17;
this.toolTip1.SetToolTip(this.S6, "enables/disables MAVLink packet framing. This tries to align");
this.toolTip1.SetToolTip(this.S6, resources.GetString("S6.ToolTip"));
//
// label8
//
@ -289,7 +293,7 @@
this.S7.Name = "S7";
this.S7.Size = new System.Drawing.Size(80, 21);
this.S7.TabIndex = 19;
this.toolTip1.SetToolTip(this.S7, "enables/disables \"opportunistic resend\". When enabled the");
this.toolTip1.SetToolTip(this.S7, resources.GetString("S7.ToolTip"));
//
// RS7
//
@ -297,7 +301,7 @@
this.RS7.Name = "RS7";
this.RS7.Size = new System.Drawing.Size(80, 21);
this.RS7.TabIndex = 29;
this.toolTip1.SetToolTip(this.RS7, "enables/disables \"opportunistic resend\". When enabled the");
this.toolTip1.SetToolTip(this.RS7, resources.GetString("RS7.ToolTip"));
//
// RS6
//
@ -305,7 +309,7 @@
this.RS6.Name = "RS6";
this.RS6.Size = new System.Drawing.Size(80, 21);
this.RS6.TabIndex = 28;
this.toolTip1.SetToolTip(this.RS6, "enables/disables MAVLink packet framing. This tries to align");
this.toolTip1.SetToolTip(this.RS6, resources.GetString("RS6.ToolTip"));
//
// RS5
//
@ -313,7 +317,7 @@
this.RS5.Name = "RS5";
this.RS5.Size = new System.Drawing.Size(80, 21);
this.RS5.TabIndex = 27;
this.toolTip1.SetToolTip(this.RS5, "to enable/disable the golay error correcting code. It defaults");
this.toolTip1.SetToolTip(this.RS5, resources.GetString("RS5.ToolTip"));
//
// RS4
//
@ -344,7 +348,8 @@
this.RS4.Name = "RS4";
this.RS4.Size = new System.Drawing.Size(80, 21);
this.RS4.TabIndex = 26;
this.toolTip1.SetToolTip(this.RS4, "the transmit power in dBm. 20dBm is 100mW. It is useful to");
this.toolTip1.SetToolTip(this.RS4, "TXPOWER is the transmit power in dBm. 20dBm is 100mW. It is useful to set this to" +
" lower levels for short range testing.\r\n");
//
// RS3
//
@ -384,7 +389,7 @@
this.RS3.Name = "RS3";
this.RS3.Size = new System.Drawing.Size(80, 21);
this.RS3.TabIndex = 25;
this.toolTip1.SetToolTip(this.RS3, "a 16 bit \'network ID\'. This is used to seed the frequency");
this.toolTip1.SetToolTip(this.RS3, resources.GetString("RS3.ToolTip"));
//
// RS2
//
@ -401,7 +406,9 @@
this.RS2.Name = "RS2";
this.RS2.Size = new System.Drawing.Size(80, 21);
this.RS2.TabIndex = 24;
this.toolTip1.SetToolTip(this.RS2, "the inter-radio data rate in rounded kbps. So 128 means");
this.toolTip1.SetToolTip(this.RS2, "AIR_SPEED is the inter-radio data rate in rounded kbps. So 128 means 128kbps. Max" +
" is 192, min is 2. I would not recommend values below 16 as the frequency hoppin" +
"g and tdm sync times get too long. ");
//
// RS1
//
@ -420,7 +427,7 @@
this.RS1.Name = "RS1";
this.RS1.Size = new System.Drawing.Size(80, 21);
this.RS1.TabIndex = 22;
this.toolTip1.SetToolTip(this.RS1, "Serial Baud Rate 57 = 57600");
this.toolTip1.SetToolTip(this.RS1, "Serial baud rate in rounded kbps. So 57 means 57600. \r\n");
//
// RS0
//
@ -472,6 +479,7 @@
this.RSSI.ReadOnly = true;
this.RSSI.Size = new System.Drawing.Size(194, 58);
this.RSSI.TabIndex = 34;
this.toolTip1.SetToolTip(this.RSSI, resources.GetString("RSSI.ToolTip"));
//
// label11
//
@ -605,6 +613,7 @@
this.Controls.Add(this.lbl_status);
this.Controls.Add(this.Progressbar);
this.Controls.Add(this.BUT_upload);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(334, 482);

View File

@ -59,7 +59,7 @@ namespace ArdupilotMega
comPort.Open();
}
catch { MessageBox.Show("Invalid ComPort or in use"); return; }
catch { CustomMessageBox.Show("Invalid ComPort or in use"); return; }
bool bootloadermode = false;
@ -99,7 +99,7 @@ namespace ArdupilotMega
{
iHex.load(firmwarefile);
}
catch { MessageBox.Show("Bad Firmware File"); goto exit; }
catch { CustomMessageBox.Show("Bad Firmware File"); goto exit; }
if (!bootloadermode)
{
@ -118,16 +118,16 @@ namespace ArdupilotMega
{
uploader.upload(comPort, iHex);
}
catch (Exception ex) { MessageBox.Show("Upload Failed " + ex.Message); }
catch (Exception ex) { CustomMessageBox.Show("Upload Failed " + ex.Message); }
}
else
{
MessageBox.Show("Failed to download new firmware");
CustomMessageBox.Show("Failed to download new firmware");
}
}
else
{
MessageBox.Show("Failed to identify Radio");
CustomMessageBox.Show("Failed to identify Radio");
}
exit:
@ -198,7 +198,7 @@ namespace ArdupilotMega
}
catch { MessageBox.Show("Invalid ComPort or in use"); return; }
catch { CustomMessageBox.Show("Invalid ComPort or in use"); return; }
lbl_status.Text = "Connecting";
@ -242,7 +242,7 @@ namespace ArdupilotMega
}
else
{
MessageBox.Show("Set Command error");
CustomMessageBox.Show("Set Command error");
}
}
}
@ -258,7 +258,7 @@ namespace ArdupilotMega
}
else
{
MessageBox.Show("Set Command error");
CustomMessageBox.Show("Set Command error");
}
}
}
@ -309,7 +309,7 @@ namespace ArdupilotMega
}
else
{
MessageBox.Show("Set Command error");
CustomMessageBox.Show("Set Command error");
}
}
}
@ -325,7 +325,7 @@ namespace ArdupilotMega
}
else
{
MessageBox.Show("Set Command error");
CustomMessageBox.Show("Set Command error");
}
}
}
@ -351,7 +351,7 @@ namespace ArdupilotMega
doCommand(comPort, "ATZ");
lbl_status.Text = "Fail";
MessageBox.Show("Failed to enter command mode");
CustomMessageBox.Show("Failed to enter command mode");
}
@ -374,7 +374,7 @@ namespace ArdupilotMega
}
catch { MessageBox.Show("Invalid ComPort or in use"); return; }
catch { CustomMessageBox.Show("Invalid ComPort or in use"); return; }
lbl_status.Text = "Connecting";
@ -479,7 +479,7 @@ namespace ArdupilotMega
doCommand(comPort, "ATO");
lbl_status.Text = "Fail";
MessageBox.Show("Failed to enter command mode");
CustomMessageBox.Show("Failed to enter command mode");
}
comPort.Close();

View File

@ -120,4 +120,124 @@
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</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>
<data name="S3.ToolTip" xml:space="preserve">
<value>NETID is a 16 bit 'network ID'. This is used to seed the frequency hopping sequence and to identify packets as coming from the right radio. Make sure you use a different NETID from anyone else running the same sort of radio in the area. </value>
</data>
<data name="S5.ToolTip" xml:space="preserve">
<value>ECC is to enable/disable the golay error correcting code. It defaults to off. If you enable it then you packets take twice as many bytes to send, so you lose half your air bandwidth, but it can correct up to 3 bit errors per 12 bits of data. Use this for long range, usually in combination with a lower air data rate. The golay decode takes 20 microsecond per transmitted byte (40 microseconds per user data byte) which means you will also be a bit CPU constrained at the highest air data rates. So you usually use golay at 128kbps or less.
</value>
</data>
<data name="S6.ToolTip" xml:space="preserve">
<value>MAVLINK enables/disables MAVLink packet framing. This tries to align radio packets to MAVLink packet boundaries, which makes a big difference to what happens to the MAVLink stream when you lose a packet.
</value>
</data>
<data name="S7.ToolTip" xml:space="preserve">
<value>OPPRESEND enables/disables "opportunistic resend". When enabled the radio will send a packet twice if the serial input buffer has less than 256 bytes in it. The 2nd send is marked as a resend and discarded by the receiving radio if it got the first packet OK. This makes a big difference to the link quality, especially for uplink commands.
</value>
</data>
<data name="RS7.ToolTip" xml:space="preserve">
<value>OPPRESEND enables/disables "opportunistic resend". When enabled the radio will send a packet twice if the serial input buffer has less than 256 bytes in it. The 2nd send is marked as a resend and discarded by the receiving radio if it got the first packet OK. This makes a big difference to the link quality, especially for uplink commands.
</value>
</data>
<data name="RS6.ToolTip" xml:space="preserve">
<value>MAVLINK enables/disables MAVLink packet framing. This tries to align radio packets to MAVLink packet boundaries, which makes a big difference to what happens to the MAVLink stream when you lose a packet.
</value>
</data>
<data name="RS5.ToolTip" xml:space="preserve">
<value>ECC is to enable/disable the golay error correcting code. It defaults to off. If you enable it then you packets take twice as many bytes to send, so you lose half your air bandwidth, but it can correct up to 3 bit errors per 12 bits of data. Use this for long range, usually in combination with a lower air data rate. The golay decode takes 20 microsecond per transmitted byte (40 microseconds per user data byte) which means you will also be a bit CPU constrained at the highest air data rates. So you usually use golay at 128kbps or less.
</value>
</data>
<data name="RS3.ToolTip" xml:space="preserve">
<value>NETID is a 16 bit 'network ID'. This is used to seed the frequency hopping sequence and to identify packets as coming from the right radio. Make sure you use a different NETID from anyone else running the same sort of radio in the area. </value>
</data>
<data name="RSSI.ToolTip" xml:space="preserve">
<value>see the spec for a RSSI to dBm graph. The numbers at the end are:
txe: number of transmit errors (eg. transmit timeouts)
rxe: number of receive errors (crc error, framing error etc)
stx: number of serial transmit overflows
rrx: number of serial receive overflows
ecc: number of 12 bit words successfully corrected by the golay code
which result in a valid packet CRC
</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABILAAASCwAAAAAAAAAA
AAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADOxkjAtnoOAKpJ4vyiK
c+8nh3D/J4Zv/yeHcP8oi3PvKpJ4vy6fg4AzsZIwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADjGo2AyspPfLZ+D/yiQ
d/8hlXj/G6F9/xeqg/8XqYL/GKqD/xuhfv8ilnn/KZB3/y2fhP8yspPfN8ajYAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADvRrDA1vpzfL6uN/yel
hP8XvJD/DMyY/wfQl/8FzJP/A8qS/wPJkf8EypL/BsyU/wnRmP8PzZn/Gb2R/yemhP8tqoz/Mb2a3zbQ
qkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAA4y6ZgMbWV/yin
iP8WwZP/Btqf/wDPlf8AyI7/A8aP/yfNnv9T2LP/UNax/03XsP8506b/G8ya/wHKkf8F0Zf/CNuf/xLB
kv8fpYT/J7KQ/y7IomAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAAAAAANcajny+w
kf8hqoj/CNSd/wDRlf8Axor/Hcyd/3Lhwf+p7Nj/o+vV/57m0/+X5dD/k+TN/4/jzf+K5Mz/fuHH/0PW
rf8HzJT/ANCT/wDRlv8OpX//HayI/yrFn58AAAAAAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAADDC
nmAtro7/H62J/wPWmv8Ay47/AMaO/3XhxP+e6tT/mObP/5Pjy/+Q4sr/jODJ/4ffx/+C3MT/f9vC/3nb
wf9y2r7/adq7/2DauP8ZzZv/Fdae/8T/9/9WxKj/HKuI/y7IomAAAAAAAAAAAAAAAAD///8AAAAAAAAA
AAAiuZMwKKyM/x6ohf8C1Zr/AMmL/wHGjv+49OL///////////9+3ML/f9zD/4Dcwv9+28L/e9rA/3bZ
vv9w1rr/Z9S4/17Rs/9Qz63/Qcyn/3LewP////////////n///8MpH7/JbKP/zXQqUAAAAAAAAAAAP//
/wAAAAAAAAAAABymhN8dnn//BNGa/wDKjP8AxY3/sfHf/////////////////2nXt/9w1rv/c9e8/3TX
vP9x17z/a9W5/2TTtf9Y0K//SMyp/zXFoP9i07X/////////////////f/LR/wDQlf8epYT/Mb2a3wAA
AAAAAAAA////AAAAAAADlnJgFZR1/wq4iv8AzpH/AMCD/4rmzf//////////////////////WdGv/2PU
tf9p1rf/atS4/2nUtv9i0rT/Vc+u/0fKpv8zxZz/Ws+w//////////////////////8GyJL/ANCS/xLB
kv8tq4z/OMajYAAAAAD///8AAAAAAACHZt8NkW//ANKV/wDChP9i27r//////////////////////9Dx
6P9MzKn/Vc+v/17Rsv9g0rP/XNCx/1XNrv9Fyaf/McSd/1fPr///////////////////////QM2m/ynK
oP8JzJX/C9yh/ymmhf80spPfAAAAAP///wAAcUwwAHtc/wCrfP8AyIv/AMKK////////////////////
/////////////5Dgyv9Gyqb/TMyq/07Nq/9MzKn/Qcmj/y/Fnf9Wzq3//////////////////////57k
0v8av5T/Lceg/yzOo/8M05v/Hr6T/zCghf80spIw////AABoRYAAclT/AL2H/wDBhf9R1rL/////////
////////4vfw//////////////////H8+P9KzKn/Ocah/zTFnv8qwpj/Us2t////////////////////
////////DLqM/yDBlv8wxp//OM6m/xPPm/8Xz53/LZF5/y+fg4////8AAGNAvwB7Wf8Aw4j/ALyC/4bj
yP+g5tL/g93E/2HSsv9Pzqz/Us6s//////////////////////9Yzq//Gr2S/0jLp///////////////
/////////////yrDm/8SvI//JMGY/zDHn/81zKT/Is2e/xTUnf8nl3v/LJJ5v////wAAXz3vAIlg/wDA
hf8AuoD/quzZ/5Hjyv9628D/ada2/1jRsP9Jy6f/a9a4//////////////////////+Y4s7/////////
//////////////////+c4tD/AbaH/xW8kf8jwZj/LcWd/y/Jn/8kzJ3/E9Ca/yGjgf8ri3Tv////AABd
PP8Ak2b/AL6D/w/Ekv+m6tf/j+HJ/3vawP9p1rf/W9Gx/0rNqf85yJ//Nsaf////////////////////
/////////////////////////////wCwe/8AtoT/ELqP/xu+k/8jwZj/KMeb/yHKm/8QzZf/HqyG/ymI
cf////8AAF07/wCSZP8AvYL/GMWU/6Dn1P+K38f/ddi+/27Wuf+E3MX/leHN/6fm1f+l5tX/neLQ////
////////////////////////////////////////j9/J/27Vuv9Tzq7/JsKY/xa/kv8aw5T/FcaW/wvL
lf8aqoT/J4dw/////wAAXTv/AJFk/wC9gP8GwY3/mObQ/5rkz/+26dv/y/Hl/8Dt3/+06tz/pebV/5bg
zP+g5NL//////////////v///f7+//7+/v//////7fn2////////////tOnb/6Ll0v+v6Nj/jeDI/zXK
o/8IxJD/BMqS/xaqgv8lh2//////AABeO+8AgVf/AL1//wDBif/R9uv/1PPq/8Tv5P+36t3/rujY/6Lk
0v+U4cv/jt7J//j8+///////+/38//f8+//2+/r/+Pz7//3+/v/m9/P/9Pv6//D6+P9/28L/jd7J/5jj
z/+h5dL/qOvX/4Hmyf8f1J//E596/yOJcO////8AAGA8vwB3U/8p06P/hufM/8Ty5f/D7+T/s+vb/6bm
1P+c4c//j9/K/4vcyP/t+fb///7///j8/P/0+/r/8vr5//P7+f/1+/r/+/39///////i9fL/ZNO1/3HW
vP992sH/htzG/4vhyv+S5dD/mO7W/6X74v80noT/Io90v////wAAZkCAAHla/33ny/945cb/nunV/7Xr
3v+l5tT/luDN/4ndxv992cL/1vLq//v9/P/1+/n/8vv4//L69//z+/j/9Pv5/7Xo2//x+vn/////////
//+y59n/aNS3/3LWvP932r//fNzD/4Ljyf+J7ND/l/bd/yORdf8knH6A////AABuRzAAdlT/Xc6x/23o
xv9s4MH/qurZ/5jiz/+I3cb/edjA/8ju5f/3/Pv/8vv4//H6+P/y+/j/6/f0/7np3v/7/fz//v7+/6fk
1f+56tz///////////9h0bT/aNW4/23Wu/9v3L//dOLG/37w0f9m1rn/Hpt8/ymujTD///8AAAAAAACD
X98po4X/Z+7K/1vgvP+A4sf/jOHK/3rZwv+r59f/9Pv6/+/69//v+vf/8vr4/9fy6/9n0rf/VM6t/6Di
0v/N7+f/adO4/1PMrf9t1Lr/i9zI/1/Rs/9h0rX/ZNe4/2bbvf9s5sb/ePfV/z2ylf8lrozfAAAAAP//
/wAAAAAAAJNsYAWQbf9U1rP/Vee//0rYsf993sb/pebV//P7+v/s+Pb/6/f1/+749v+s5tj/Vc2u/1jP
r/9ZzrD/btW5/1bOr/9Wza//Vs6v/1fOr/9Z0LD/WdCy/1vTtP9d1rX/Xt+8/2btyP9k4L//IaaF/y7D
nmAAAAAA////AAAAAAAAAAAAD6J9zyCjgv9S68L/P9+0/2Pevv/5////7/v6/+v59//j9/L/gtvF/1PN
r/9Wz7D/Wc+x/1nQsf9Zz7H/WM6w/1fPsP9UzrD/VM+w/1TPrv9U0a//U9Oy/1Tatv9Z5sD/Y/LL/zSx
lP8qupbPAAAAAAAAAAD///8AAAAAAAAAAAAYto4wGaeE/y23lP8+5rn/6/////j////w//3/ve/i/2bV
uP9Tzq7/Vc+v/1jPsP9Z0LL/WM+w/1fOsf9Wz7D/Us2w/1HOrf9Qzq3/T9Cu/0zSr/9M2LP/TeC5/1bt
xP9HxaX/KLKQ/zTPqDAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAkvpdgG6iF/y++m//e/////P///3rl
yf9G0K3/VdKy/1bPsf9Wz7H/Vs6w/1bPsP9Sza//Ucyu/0/Nrf9NzKz/S82s/0fOrP9G0a7/QdWv/0Le
tP9I6L7/Q8Ok/yitjP8yyKJgAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAmwJlgG6iF/yK3
kP8k3q7/H9el/x7Pn/8tzKT/Q9Cs/1HQsP9Q0K7/TM6u/0nMrf9Hzaz/RMyp/0LNqf8+zqn/ONGo/zTV
qf833rD/O+S4/zvCof8orIv/MMSfYAAAAAAAAAAAAAAAAAAAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAA
AAAkvpdgG6iE/xukgv8gy53/HNql/xzRn/8czJz/HcmZ/yXJnP8qyp7/Lcqg/yzLn/8nypz/JMqc/yTO
n/8l1KT/KN2r/y3Tpv8nq4n/JaqJ/yzAm2AAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAato8wFKN/zxCScv8RnHn/DbqM/wjIlP8GyZT/BsaS/wbFkf8GxZH/B8WR/wfH
k/8IypX/DMmV/xG3jP8WoX3/Fph2/xqkgs8ft5EwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJVvYACGZM8Aelr/AHlZ/wCFX/8AiWL/AJlr/wCb
bP8AlGf/AI5k/wB/W/8AeFj/AHtb/wCHZd8ClXBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwSzAAaESAAGI/vwBf
Pd8AXTz/AF08/wBdPP8AXz3fAGJAvwBoRIAAcUswAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP//
/wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP//
/wD///8A////AP///wD///8A/+AD//+AAP/+AAA//AAAH/gAAA/wAAAH4AAAA+AAAAPAAAABwAAAAYAA
AACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAwAAAAcAAAAHgAAAD4AAAA/AA
AAf4AAAP/AAAH/4AAD//gAD//+AD//////8=
</value>
</data>
</root>

View File

@ -184,21 +184,21 @@ namespace resedit
{
sw.Write("<tr><td>" + row.Cells[colFile.Index].Value.ToString() + "</td><td>" + row.Cells[colInternal.Index].Value.ToString() + "</td><td>" + row.Cells[colOtherLang.Index].Value.ToString() + "</td></tr>");
}
catch (Exception ex) { try { MessageBox.Show("Failed to save " + row.Cells[colOtherLang.Index].Value.ToString() + " " + ex.ToString()); } catch { } }
catch (Exception ex) { try { CustomMessageBox.Show("Failed to save " + row.Cells[colOtherLang.Index].Value.ToString() + " " + ex.ToString()); } catch { } }
}
if (writer != null)
writer.Close();
sw.Write("</table></html>");
sw.Close();
MessageBox.Show("Saved");
CustomMessageBox.Show("Saved");
}
private void button3_Click(object sender, EventArgs e)
{
if (!File.Exists("translation/output.html"))
{
MessageBox.Show("No existing translation has been done");
CustomMessageBox.Show("No existing translation has been done");
return;
}
@ -230,7 +230,7 @@ namespace resedit
sr1.Close();
MessageBox.Show("Modified "+a+" entries");
CustomMessageBox.Show("Modified "+a+" entries");
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
@ -292,7 +292,7 @@ namespace resedit
catch { }
}
MessageBox.Show("Loaded Existing");
CustomMessageBox.Show("Loaded Existing");
}
}
}

View File

@ -82,7 +82,7 @@ namespace ArdupilotMega
}
catch (Exception e)
{
System.Windows.Forms.MessageBox.Show("Error running script " + e.Message);
System.Windows.Forms.CustomMessageBox.Show("Error running script " + e.Message);
}
}

View File

@ -45,13 +45,13 @@ namespace ArdupilotMega
{
comPort.PortName = CMB_serialport.Text;
}
catch { MessageBox.Show("Invalid PortName"); return; }
catch { CustomMessageBox.Show("Invalid PortName"); return; }
try {
comPort.BaudRate = int.Parse(CMB_baudrate.Text);
} catch {MessageBox.Show("Invalid BaudRate"); return;}
} catch {CustomMessageBox.Show("Invalid BaudRate"); return;}
try {
comPort.Open();
} catch {MessageBox.Show("Error Connecting\nif using com0com please rename the ports to COM??"); return;}
} catch {CustomMessageBox.Show("Error Connecting\nif using com0com please rename the ports to COM??"); return;}
string alt = "100";
@ -70,7 +70,7 @@ namespace ArdupilotMega
intalt = (int)(100 * MainV2.cs.multiplierdist);
if (!int.TryParse(alt, out intalt))
{
MessageBox.Show("Bad Alt");
CustomMessageBox.Show("Bad Alt");
return;
}

View File

@ -43,13 +43,13 @@ namespace ArdupilotMega
{
comPort.PortName = CMB_serialport.Text;
}
catch { MessageBox.Show("Invalid PortName"); return; }
catch { CustomMessageBox.Show("Invalid PortName"); return; }
try {
comPort.BaudRate = int.Parse(CMB_baudrate.Text);
} catch {MessageBox.Show("Invalid BaudRate"); return;}
} catch {CustomMessageBox.Show("Invalid BaudRate"); return;}
try {
comPort.Open();
} catch {MessageBox.Show("Error Connecting\nif using com0com please rename the ports to COM??"); return;}
} catch {CustomMessageBox.Show("Error Connecting\nif using com0com please rename the ports to COM??"); return;}
t12 = new System.Threading.Thread(new System.Threading.ThreadStart(mainloop))
{

View File

@ -123,6 +123,9 @@
this.pictureBoxQuad = new System.Windows.Forms.PictureBox();
this.BUT_levelac2 = new ArdupilotMega.MyButton();
this.tabHeli = new System.Windows.Forms.TabPage();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.H1_ENABLE = new System.Windows.Forms.RadioButton();
this.CCPM = new System.Windows.Forms.RadioButton();
this.BUT_HS4save = new ArdupilotMega.MyButton();
this.BUT_swash_manual = new ArdupilotMega.MyButton();
this.groupBox3 = new System.Windows.Forms.GroupBox();
@ -176,9 +179,7 @@
this.tabReset = new System.Windows.Forms.TabPage();
this.BUT_reset = new ArdupilotMega.MyButton();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.CCPM = new System.Windows.Forms.RadioButton();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.H1_ENABLE = new System.Windows.Forms.RadioButton();
this.BUT_MagCalibration = new ArdupilotMega.MyButton();
this.tabControl1.SuspendLayout();
this.tabRadioIn.SuspendLayout();
this.groupBoxElevons.SuspendLayout();
@ -196,6 +197,7 @@
((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuadX)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuad)).BeginInit();
this.tabHeli.SuspendLayout();
this.groupBox5.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
@ -204,7 +206,6 @@
((System.ComponentModel.ISupportInitialize)(this.HS2_TRIM)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.HS1_TRIM)).BeginInit();
this.tabReset.SuspendLayout();
this.groupBox5.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
@ -656,7 +657,8 @@
//
// tabHardware
//
this.tabHardware.BackColor = System.Drawing.Color.DarkRed;
this.tabHardware.BackColor = System.Drawing.SystemColors.Control;
this.tabHardware.Controls.Add(this.BUT_MagCalibration);
this.tabHardware.Controls.Add(this.label27);
this.tabHardware.Controls.Add(this.CMB_sonartype);
this.tabHardware.Controls.Add(this.CHK_enableoptflow);
@ -1018,6 +1020,29 @@
this.tabHeli.UseVisualStyleBackColor = true;
this.tabHeli.Click += new System.EventHandler(this.tabHeli_Click);
//
// groupBox5
//
this.groupBox5.Controls.Add(this.H1_ENABLE);
this.groupBox5.Controls.Add(this.CCPM);
resources.ApplyResources(this.groupBox5, "groupBox5");
this.groupBox5.Name = "groupBox5";
this.groupBox5.TabStop = false;
//
// H1_ENABLE
//
resources.ApplyResources(this.H1_ENABLE, "H1_ENABLE");
this.H1_ENABLE.Name = "H1_ENABLE";
this.H1_ENABLE.TabStop = true;
this.H1_ENABLE.UseVisualStyleBackColor = true;
this.H1_ENABLE.CheckedChanged += new System.EventHandler(this.H1_ENABLE_CheckedChanged);
//
// CCPM
//
resources.ApplyResources(this.CCPM, "CCPM");
this.CCPM.Name = "CCPM";
this.CCPM.TabStop = true;
this.CCPM.UseVisualStyleBackColor = true;
//
// BUT_HS4save
//
resources.ApplyResources(this.BUT_HS4save, "BUT_HS4save");
@ -1559,28 +1584,12 @@
this.BUT_reset.UseVisualStyleBackColor = true;
this.BUT_reset.Click += new System.EventHandler(this.BUT_reset_Click);
//
// CCPM
// BUT_MagCalibration
//
resources.ApplyResources(this.CCPM, "CCPM");
this.CCPM.Name = "CCPM";
this.CCPM.TabStop = true;
this.CCPM.UseVisualStyleBackColor = true;
//
// groupBox5
//
this.groupBox5.Controls.Add(this.H1_ENABLE);
this.groupBox5.Controls.Add(this.CCPM);
resources.ApplyResources(this.groupBox5, "groupBox5");
this.groupBox5.Name = "groupBox5";
this.groupBox5.TabStop = false;
//
// H1_ENABLE
//
resources.ApplyResources(this.H1_ENABLE, "H1_ENABLE");
this.H1_ENABLE.Name = "H1_ENABLE";
this.H1_ENABLE.TabStop = true;
this.H1_ENABLE.UseVisualStyleBackColor = true;
this.H1_ENABLE.CheckedChanged += new System.EventHandler(this.H1_ENABLE_CheckedChanged);
resources.ApplyResources(this.BUT_MagCalibration, "BUT_MagCalibration");
this.BUT_MagCalibration.Name = "BUT_MagCalibration";
this.BUT_MagCalibration.UseVisualStyleBackColor = true;
this.BUT_MagCalibration.Click += new System.EventHandler(this.BUT_MagCalibration_Click);
//
// Setup
//
@ -1616,6 +1625,8 @@
((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuad)).EndInit();
this.tabHeli.ResumeLayout(false);
this.tabHeli.PerformLayout();
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox2.ResumeLayout(false);
@ -1627,8 +1638,6 @@
((System.ComponentModel.ISupportInitialize)(this.HS2_TRIM)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.HS1_TRIM)).EndInit();
this.tabReset.ResumeLayout(false);
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
this.ResumeLayout(false);
}
@ -1784,6 +1793,7 @@
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.RadioButton H1_ENABLE;
private System.Windows.Forms.RadioButton CCPM;
private MyButton BUT_MagCalibration;
}
}

View File

@ -159,7 +159,7 @@ namespace ArdupilotMega.Setup
return;
}
MessageBox.Show("Ensure your transmitter is on and receiver is powered and connected\nEnsure your motor does not have power/no props!!!");
CustomMessageBox.Show("Ensure your transmitter is on and receiver is powered and connected\nEnsure your motor does not have power/no props!!!");
byte oldrc = MainV2.cs.raterc;
byte oldatt = MainV2.cs.rateattitude;
@ -245,7 +245,7 @@ namespace ArdupilotMega.Setup
}
}
MessageBox.Show("Ensure all your sticks are centered and throttle is down, and click ok to continue");
CustomMessageBox.Show("Ensure all your sticks are centered and throttle is down, and click ok to continue");
MainV2.cs.UpdateCurrentSettings(currentStateBindingSource, true, MainV2.comPort);
@ -274,7 +274,7 @@ namespace ArdupilotMega.Setup
if (rctrim[a] < 1195 || rctrim[a] > 1205)
MainV2.comPort.setParam("RC" + (a + 1).ToString("0") + "_TRIM", rctrim[a]);
}
catch { MessageBox.Show("Failed to set Channel " + (a + 1).ToString()); }
catch { CustomMessageBox.Show("Failed to set Channel " + (a + 1).ToString()); }
data = data + "CH" + (a + 1) + " " + rcmin[a] + " | " + rcmax[a] + "\n";
}
@ -299,7 +299,7 @@ namespace ArdupilotMega.Setup
Configuration.startup = false;
}
MessageBox.Show("Here are the detected radio options\nNOTE Channels not connected are displayed as 1500 +-2\nNormal values are around 1100 | 1900\nChannel:Min | Max \n" + data, "Radio");
CustomMessageBox.Show("Here are the detected radio options\nNOTE Channels not connected are displayed as 1500 +-2\nNormal values are around 1100 | 1900\nChannel:Min | Max \n" + data, "Radio");
BUT_Calibrateradio.Text = "Please goto the next tab";
}
@ -336,7 +336,7 @@ namespace ArdupilotMega.Setup
CHK_revch3.Checked = MainV2.comPort.param["RC3_REV"].ToString() == "-1";
CHK_revch4.Checked = MainV2.comPort.param["RC4_REV"].ToString() == "-1";
}
catch (Exception ex) { MessageBox.Show("Missing RC rev Param "+ex.ToString()); }
catch (Exception ex) { CustomMessageBox.Show("Missing RC rev Param "+ex.ToString()); }
startup = false;
}
@ -605,7 +605,7 @@ namespace ArdupilotMega.Setup
MainV2.comPort.setParam("SIMPLE", value);
}
}
catch { MessageBox.Show("Failed to set Flight modes"); }
catch { CustomMessageBox.Show("Failed to set Flight modes"); }
BUT_SaveModes.Text = "Complete";
}
@ -635,7 +635,7 @@ namespace ArdupilotMega.Setup
{
if (MainV2.comPort.param["COMPASS_DEC"] == null)
{
MessageBox.Show("Not Available");
CustomMessageBox.Show("Not Available");
}
else
{
@ -655,14 +655,14 @@ namespace ArdupilotMega.Setup
dec -= ((mins) / 60.0f);
}
}
catch { MessageBox.Show("Invalid input!"); return; }
catch { CustomMessageBox.Show("Invalid input!"); return; }
TXT_declination.Text = dec.ToString();
MainV2.comPort.setParam("COMPASS_DEC", dec * deg2rad);
}
}
catch { MessageBox.Show("Set COMPASS_DEC Failed"); }
catch { CustomMessageBox.Show("Set COMPASS_DEC Failed"); }
}
@ -674,14 +674,14 @@ namespace ArdupilotMega.Setup
{
if (MainV2.comPort.param["MAG_ENABLE"] == null)
{
MessageBox.Show("Not Available");
CustomMessageBox.Show("Not Available");
}
else
{
MainV2.comPort.setParam("MAG_ENABLE", ((CheckBox)sender).Checked == true ? 1 : 0);
}
}
catch { MessageBox.Show("Set MAG_ENABLE Failed"); }
catch { CustomMessageBox.Show("Set MAG_ENABLE Failed"); }
}
//((CheckBox)sender).Checked = !((CheckBox)sender).Checked;
@ -695,14 +695,14 @@ namespace ArdupilotMega.Setup
{
if (MainV2.comPort.param["SONAR_ENABLE"] == null)
{
MessageBox.Show("Not Available");
CustomMessageBox.Show("Not Available");
}
else
{
MainV2.comPort.setParam("SONAR_ENABLE", ((CheckBox)sender).Checked == true ? 1 : 0);
}
}
catch { MessageBox.Show("Set SONAR_ENABLE Failed"); }
catch { CustomMessageBox.Show("Set SONAR_ENABLE Failed"); }
}
private void CHK_enableairspeed_CheckedChanged(object sender, EventArgs e)
@ -713,14 +713,14 @@ namespace ArdupilotMega.Setup
{
if (MainV2.comPort.param["ARSPD_ENABLE"] == null)
{
MessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString());
CustomMessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString());
}
else
{
MainV2.comPort.setParam("ARSPD_ENABLE", ((CheckBox)sender).Checked == true ? 1 : 0);
}
}
catch { MessageBox.Show("Set ARSPD_ENABLE Failed"); }
catch { CustomMessageBox.Show("Set ARSPD_ENABLE Failed"); }
}
private void CHK_enablebattmon_CheckedChanged(object sender, EventArgs e)
{
@ -738,7 +738,7 @@ namespace ArdupilotMega.Setup
CMB_batmontype.SelectedIndex = 1;
}
}
catch { MessageBox.Show("Set BATT_MONITOR Failed"); }
catch { CustomMessageBox.Show("Set BATT_MONITOR Failed"); }
}
private void TXT_battcapacity_Validating(object sender, CancelEventArgs e)
{
@ -753,14 +753,14 @@ namespace ArdupilotMega.Setup
{
if (MainV2.comPort.param["BATT_CAPACITY"] == null)
{
MessageBox.Show("Not Available");
CustomMessageBox.Show("Not Available");
}
else
{
MainV2.comPort.setParam("BATT_CAPACITY", float.Parse(TXT_battcapacity.Text));
}
}
catch { MessageBox.Show("Set BATT_CAPACITY Failed"); }
catch { CustomMessageBox.Show("Set BATT_CAPACITY Failed"); }
}
private void CMB_batmontype_SelectedIndexChanged(object sender, EventArgs e)
{
@ -770,7 +770,7 @@ namespace ArdupilotMega.Setup
{
if (MainV2.comPort.param["BATT_MONITOR"] == null)
{
MessageBox.Show("Not Available");
CustomMessageBox.Show("Not Available");
}
else
{
@ -804,7 +804,7 @@ namespace ArdupilotMega.Setup
MainV2.comPort.setParam("BATT_MONITOR", selection);
}
}
catch { MessageBox.Show("Set BATT_MONITOR Failed"); }
catch { CustomMessageBox.Show("Set BATT_MONITOR Failed"); }
}
private void TXT_inputvoltage_Validating(object sender, CancelEventArgs e)
{
@ -819,14 +819,14 @@ namespace ArdupilotMega.Setup
{
if (MainV2.comPort.param["INPUT_VOLTS"] == null)
{
MessageBox.Show("Not Available");
CustomMessageBox.Show("Not Available");
}
else
{
MainV2.comPort.setParam("INPUT_VOLTS", float.Parse(TXT_inputvoltage.Text));
}
}
catch { MessageBox.Show("Set INPUT_VOLTS Failed"); }
catch { CustomMessageBox.Show("Set INPUT_VOLTS Failed"); }
}
private void TXT_measuredvoltage_Validating(object sender, CancelEventArgs e)
{
@ -847,20 +847,20 @@ namespace ArdupilotMega.Setup
float new_divider = (measuredvoltage * divider) / voltage;
TXT_divider.Text = new_divider.ToString();
}
catch { MessageBox.Show("Invalid number entered"); return; }
catch { CustomMessageBox.Show("Invalid number entered"); return; }
try
{
if (MainV2.comPort.param["VOLT_DIVIDER"] == null)
{
MessageBox.Show("Not Available");
CustomMessageBox.Show("Not Available");
}
else
{
MainV2.comPort.setParam("VOLT_DIVIDER", float.Parse(TXT_divider.Text));
}
}
catch { MessageBox.Show("Set VOLT_DIVIDER Failed"); }
catch { CustomMessageBox.Show("Set VOLT_DIVIDER Failed"); }
}
private void TXT_divider_Validating(object sender, CancelEventArgs e)
{
@ -875,14 +875,14 @@ namespace ArdupilotMega.Setup
{
if (MainV2.comPort.param["VOLT_DIVIDER"] == null)
{
MessageBox.Show("Not Available");
CustomMessageBox.Show("Not Available");
}
else
{
MainV2.comPort.setParam("VOLT_DIVIDER", float.Parse(TXT_divider.Text));
}
}
catch { MessageBox.Show("Set VOLT_DIVIDER Failed"); }
catch { CustomMessageBox.Show("Set VOLT_DIVIDER Failed"); }
}
private void TXT_ampspervolt_Validating(object sender, CancelEventArgs e)
{
@ -897,14 +897,14 @@ namespace ArdupilotMega.Setup
{
if (MainV2.comPort.param["AMP_PER_VOLT"] == null)
{
MessageBox.Show("Not Available");
CustomMessageBox.Show("Not Available");
}
else
{
MainV2.comPort.setParam("AMP_PER_VOLT", float.Parse(TXT_ampspervolt.Text));
}
}
catch { MessageBox.Show("Set AMP_PER_VOLT Failed"); }
catch { CustomMessageBox.Show("Set AMP_PER_VOLT Failed"); }
}
private void BUT_reset_Click(object sender, EventArgs e)
@ -913,7 +913,7 @@ namespace ArdupilotMega.Setup
{
MainV2.comPort.setParam("SYSID_SW_MREV", UInt16.MaxValue);
}
catch { MessageBox.Show("Set SYSID_SW_MREV Failed"); return; }
catch { CustomMessageBox.Show("Set SYSID_SW_MREV Failed"); return; }
MainV2.givecomport = true;
@ -931,7 +931,7 @@ namespace ArdupilotMega.Setup
comPortT.DtrEnable = true;
comPortT.Open();
}
catch (Exception ex) { MainV2.givecomport = false; MessageBox.Show("Invalid Comport Settings : " + ex.Message); return; }
catch (Exception ex) { MainV2.givecomport = false; CustomMessageBox.Show("Invalid Comport Settings : " + ex.Message); return; }
BUT_reset.Text = "Rebooting (17 sec)";
BUT_reset.Refresh();
@ -958,7 +958,7 @@ namespace ArdupilotMega.Setup
}
catch
{
MessageBox.Show("Failed to re-connect : Please try again");
CustomMessageBox.Show("Failed to re-connect : Please try again");
this.Close();
}
@ -985,9 +985,9 @@ namespace ArdupilotMega.Setup
try
{
MainV2.comPort.setParam("FRAME", 0f);
MessageBox.Show("Set to +");
CustomMessageBox.Show("Set to +");
}
catch { MessageBox.Show("Set frame failed"); }
catch { CustomMessageBox.Show("Set frame failed"); }
}
private void pictureBoxQuadX_Click(object sender, EventArgs e)
@ -995,16 +995,16 @@ namespace ArdupilotMega.Setup
try
{
MainV2.comPort.setParam("FRAME", 1f);
MessageBox.Show("Set to x");
CustomMessageBox.Show("Set to x");
}
catch { MessageBox.Show("Set frame failed"); }
catch { CustomMessageBox.Show("Set frame failed"); }
}
private void Setup_Load(object sender, EventArgs e)
{
if (!MainV2.comPort.BaseStream.IsOpen)
{
MessageBox.Show("Please Connect First");
CustomMessageBox.Show("Please Connect First");
this.Close();
}
else
@ -1033,7 +1033,7 @@ namespace ArdupilotMega.Setup
MainV2.comPort.setParam("HSV_MAN", 0); // randy request - last
}
catch { MessageBox.Show("Set " + ((TextBox)sender).Name + " failed"); }
catch { CustomMessageBox.Show("Set " + ((TextBox)sender).Name + " failed"); }
}
private void TXT_srvpos2_Validating(object sender, CancelEventArgs e)
@ -1055,7 +1055,7 @@ namespace ArdupilotMega.Setup
System.Threading.Thread.Sleep(100);
MainV2.comPort.setParam("HSV_MAN", 0); // randy request - last
}
catch { MessageBox.Show("Set " + ((TextBox)sender).Name + " failed"); }
catch { CustomMessageBox.Show("Set " + ((TextBox)sender).Name + " failed"); }
}
private void TXT_srvpos3_Validating(object sender, CancelEventArgs e)
@ -1077,12 +1077,12 @@ namespace ArdupilotMega.Setup
System.Threading.Thread.Sleep(100);
MainV2.comPort.setParam("HSV_MAN", 0); // randy request - last
}
catch { MessageBox.Show("Set " + ((TextBox)sender).Name + " failed"); }
catch { CustomMessageBox.Show("Set " + ((TextBox)sender).Name + " failed"); }
}
private void BUT_0collective_Click(object sender, EventArgs e)
{
MessageBox.Show("Make sure your blades are at 0 degrees");
CustomMessageBox.Show("Make sure your blades are at 0 degrees");
try
{
@ -1091,7 +1091,7 @@ namespace ArdupilotMega.Setup
COL_MID.Text = MainV2.comPort.param["COL_MID_"].ToString();
}
catch { MessageBox.Show("Set COL_MID_ failed"); }
catch { CustomMessageBox.Show("Set COL_MID_ failed"); }
}
private void HS1_REV_CheckedChanged(object sender, EventArgs e)
@ -1191,7 +1191,7 @@ namespace ArdupilotMega.Setup
{
MainV2.comPort.setParam(((TextBox)sender).Name, test);
}
catch { MessageBox.Show("Failed to set Gyro Gain"); }
catch { CustomMessageBox.Show("Failed to set Gyro Gain"); }
}
private void GYR_ENABLE__CheckedChanged(object sender, EventArgs e)
@ -1216,7 +1216,7 @@ namespace ArdupilotMega.Setup
}
catch
{
MessageBox.Show("Failed to level : ac2 2.0.37+ is required");
CustomMessageBox.Show("Failed to level : ac2 2.0.37+ is required");
}
}
@ -1227,7 +1227,7 @@ namespace ArdupilotMega.Setup
//System.Diagnostics.Process.Start("http://www.ngdc.noaa.gov/geomagmodels/Declination.jsp");
System.Diagnostics.Process.Start("http://www.magnetic-declination.com/");
}
catch { MessageBox.Show("Webpage open failed... do you have a virus?\nhttp://www.magnetic-declination.com/"); }
catch { CustomMessageBox.Show("Webpage open failed... do you have a virus?\nhttp://www.magnetic-declination.com/"); }
}
void reverseChannel(string name, bool normalreverse, Control progressbar)
@ -1252,16 +1252,16 @@ namespace ArdupilotMega.Setup
try
{
MainV2.comPort.setParam("SWITCH_ENABLE", 0);
MessageBox.Show("Disabled Dip Switchs");
CustomMessageBox.Show("Disabled Dip Switchs");
}
catch { MessageBox.Show("Error Disableing Dip Switch"); }
catch { CustomMessageBox.Show("Error Disableing Dip Switch"); }
}
try
{
int i = normalreverse == false ? 1 : -1;
MainV2.comPort.setParam(name, i);
}
catch { MessageBox.Show("Error Reversing"); }
catch { CustomMessageBox.Show("Error Reversing"); }
}
private void CHK_revch1_CheckedChanged(object sender, EventArgs e)
@ -1313,7 +1313,7 @@ namespace ArdupilotMega.Setup
BUT_0collective.Enabled = true;
}
}
catch { MessageBox.Show("Failed to set HSV_MAN"); }
catch { CustomMessageBox.Show("Failed to set HSV_MAN"); }
}
private void BUT_HS4save_Click(object sender, EventArgs e)
@ -1342,7 +1342,7 @@ namespace ArdupilotMega.Setup
HS4_MIN.Enabled = true;
}
}
catch { MessageBox.Show("Failed to set HSV_MAN"); }
catch { CustomMessageBox.Show("Failed to set HSV_MAN"); }
}
private void tabHeli_Click(object sender, EventArgs e)
@ -1444,14 +1444,14 @@ namespace ArdupilotMega.Setup
{
if (MainV2.comPort.param["FLOW_ENABLE"] == null)
{
MessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString());
CustomMessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString());
}
else
{
MainV2.comPort.setParam("FLOW_ENABLE", ((CheckBox)sender).Checked == true ? 1 : 0);
}
}
catch { MessageBox.Show("Set FLOW_ENABLE Failed"); }
catch { CustomMessageBox.Show("Set FLOW_ENABLE Failed"); }
}
private void CMB_sonartype_SelectedIndexChanged(object sender, EventArgs e)
@ -1462,14 +1462,14 @@ namespace ArdupilotMega.Setup
{
if (MainV2.comPort.param["SONAR_TYPE"] == null)
{
MessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString());
CustomMessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString());
}
else
{
MainV2.comPort.setParam("SONAR_TYPE", ((ComboBox)sender).SelectedIndex);
}
}
catch { MessageBox.Show("Set SONAR_TYPE Failed"); }
catch { CustomMessageBox.Show("Set SONAR_TYPE Failed"); }
}
private void CHK_mixmode_CheckedChanged(object sender, EventArgs e)
@ -1480,14 +1480,14 @@ namespace ArdupilotMega.Setup
{
if (MainV2.comPort.param["ELEVON_MIXING"] == null)
{
MessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString());
CustomMessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString());
}
else
{
MainV2.comPort.setParam("ELEVON_MIXING", ((CheckBox)sender).Checked == true ? 1 : 0);
}
}
catch { MessageBox.Show("Set ELEVON_MIXING Failed"); }
catch { CustomMessageBox.Show("Set ELEVON_MIXING Failed"); }
}
private void CHK_elevonrev_CheckedChanged(object sender, EventArgs e)
@ -1498,14 +1498,14 @@ namespace ArdupilotMega.Setup
{
if (MainV2.comPort.param["ELEVON_REVERSE"] == null)
{
MessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString());
CustomMessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString());
}
else
{
MainV2.comPort.setParam("ELEVON_REVERSE", ((CheckBox)sender).Checked == true ? 1 : 0);
}
}
catch { MessageBox.Show("Set ELEVON_REVERSE Failed"); }
catch { CustomMessageBox.Show("Set ELEVON_REVERSE Failed"); }
}
private void CHK_elevonch1rev_CheckedChanged(object sender, EventArgs e)
@ -1516,14 +1516,14 @@ namespace ArdupilotMega.Setup
{
if (MainV2.comPort.param["ELEVON_CH1_REV"] == null)
{
MessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString());
CustomMessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString());
}
else
{
MainV2.comPort.setParam("ELEVON_CH1_REV", ((CheckBox)sender).Checked == true ? 1 : 0);
}
}
catch { MessageBox.Show("Set ELEVON_CH1_REV Failed"); }
catch { CustomMessageBox.Show("Set ELEVON_CH1_REV Failed"); }
}
private void CHK_elevonch2rev_CheckedChanged(object sender, EventArgs e)
@ -1534,14 +1534,14 @@ namespace ArdupilotMega.Setup
{
if (MainV2.comPort.param["ELEVON_CH2_REV"] == null)
{
MessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString());
CustomMessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString());
}
else
{
MainV2.comPort.setParam("ELEVON_CH2_REV", ((CheckBox)sender).Checked == true ? 1 : 0);
}
}
catch { MessageBox.Show("Set ELEVON_CH2_REV Failed"); }
catch { CustomMessageBox.Show("Set ELEVON_CH2_REV Failed"); }
}
private void CMB_batmonsensortype_SelectedIndexChanged(object sender, EventArgs e)
@ -1625,14 +1625,66 @@ namespace ArdupilotMega.Setup
{
if (MainV2.comPort.param["H1_ENABLE"] == null)
{
MessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString());
CustomMessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString());
}
else
{
MainV2.comPort.setParam("H1_ENABLE", ((RadioButton)sender).Checked == true ? 1 : 0);
}
}
catch { MessageBox.Show("Set H1_ENABLE Failed"); }
catch { CustomMessageBox.Show("Set H1_ENABLE Failed"); }
}
private void BUT_MagCalibration_Click(object sender, EventArgs e)
{
if (DialogResult.Yes == CustomMessageBox.Show("Use live data, or a log\n\nYes for Live data", "Mag Calibration", MessageBoxButtons.YesNo))
{
List<Tuple<float, float, float>> data = new List<Tuple<float, float, float>>();
byte backupratesens = MainV2.cs.ratesensors;
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
CustomMessageBox.Show("Data will be collected for 30 seconds, Please click ok and move the apm around all axises");
DateTime deadline = DateTime.Now.AddSeconds(30);
float oldmx = 0;
float oldmy = 0;
float oldmz = 0;
while (deadline > DateTime.Now)
{
Application.DoEvents();
if (oldmx != MainV2.cs.mx &&
oldmy != MainV2.cs.my &&
oldmz != MainV2.cs.mz)
{
data.Add(new Tuple<float, float, float>(
MainV2.cs.mx - (float)MainV2.cs.mag_ofs_x,
MainV2.cs.my - (float)MainV2.cs.mag_ofs_y,
MainV2.cs.mz - (float)MainV2.cs.mag_ofs_z));
oldmx = MainV2.cs.mx;
oldmy = MainV2.cs.my;
oldmz = MainV2.cs.mz;
}
}
MainV2.cs.ratesensors = backupratesens;
double[] ans = MagCalib.LeastSq(data);
MagCalib.SaveOffsets(ans);
}
else
{
MagCalib.ProcessLog();
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -281,7 +281,7 @@ namespace ArdupilotMega
sw2.Close();
sw.Close();
MessageBox.Show("Done " + matchs + " matchs");
CustomMessageBox.Show("Done " + matchs + " matchs");
}
private void InitializeComponent()

View File

@ -135,7 +135,7 @@ namespace ArdupilotMega
ArduinoComms port = new ArduinoSTK();
if (DialogResult.Yes == MessageBox.Show("is this a 1280?", "", MessageBoxButtons.YesNo))
if (DialogResult.Yes == CustomMessageBox.Show("is this a 1280?", "", MessageBoxButtons.YesNo))
{
port = new ArduinoSTK();
port.BaudRate = 57600;
@ -176,23 +176,23 @@ namespace ArdupilotMega
}
else
{
MessageBox.Show("Communication Error - WPs wrote but no config");
CustomMessageBox.Show("Communication Error - WPs wrote but no config");
}
}
else
{
MessageBox.Show("Communication Error - Bad data");
CustomMessageBox.Show("Communication Error - Bad data");
}
}
else
{
MessageBox.Show("Communication Error - no connection");
CustomMessageBox.Show("Communication Error - no connection");
}
port.Close();
}
catch (Exception ex) { MessageBox.Show("Port in use? " + ex.ToString()); port.Close(); }
catch (Exception ex) { CustomMessageBox.Show("Port in use? " + ex.ToString()); port.Close(); }
}
catch (Exception) { MessageBox.Show("Error reading file"); }
catch (Exception) { CustomMessageBox.Show("Error reading file"); }
}
}
@ -207,7 +207,7 @@ namespace ArdupilotMega
ArduinoComms port = new ArduinoSTK();
if (DialogResult.Yes == MessageBox.Show("is this a 1280?", "", MessageBoxButtons.YesNo))
if (DialogResult.Yes == CustomMessageBox.Show("is this a 1280?", "", MessageBoxButtons.YesNo))
{
port = new ArduinoSTK();
port.BaudRate = 57600;
@ -247,21 +247,21 @@ namespace ArdupilotMega
}
else
{
MessageBox.Show("Communication Error - WPs wrote but no config");
CustomMessageBox.Show("Communication Error - WPs wrote but no config");
}
}
else
{
MessageBox.Show("Communication Error - Bad data");
CustomMessageBox.Show("Communication Error - Bad data");
}
}
else
{
MessageBox.Show("Communication Error - no connection");
CustomMessageBox.Show("Communication Error - no connection");
}
port.Close();
}
catch (Exception ex) { MessageBox.Show("Port in use? " + ex.ToString()); port.Close(); }
catch (Exception ex) { CustomMessageBox.Show("Port in use? " + ex.ToString()); port.Close(); }
}
private void BUT_flashdl_Click(object sender, EventArgs e)
@ -270,7 +270,7 @@ namespace ArdupilotMega
ArduinoComms port = new ArduinoSTK();
if (DialogResult.Yes == MessageBox.Show("is this a 1280?", "", MessageBoxButtons.YesNo))
if (DialogResult.Yes == CustomMessageBox.Show("is this a 1280?", "", MessageBoxButtons.YesNo))
{
port = new ArduinoSTK();
port.BaudRate = 57600;
@ -342,11 +342,11 @@ namespace ArdupilotMega
}
else
{
MessageBox.Show("Communication Error - no connection");
CustomMessageBox.Show("Communication Error - no connection");
}
port.Close();
}
catch (Exception ex) { MessageBox.Show("Port in use? " + ex.ToString()); port.Close(); }
catch (Exception ex) { CustomMessageBox.Show("Port in use? " + ex.ToString()); port.Close(); }
}
public int swapend(int value)
@ -371,10 +371,10 @@ namespace ArdupilotMega
sr.Close();
}
catch (Exception ex) { MessageBox.Show("Failed to read firmware.hex : " + ex.Message); }
catch (Exception ex) { CustomMessageBox.Show("Failed to read firmware.hex : " + ex.Message); }
ArduinoComms port = new ArduinoSTK();
if (DialogResult.Yes == MessageBox.Show("is this a 1280?", "", MessageBoxButtons.YesNo))
if (DialogResult.Yes == CustomMessageBox.Show("is this a 1280?", "", MessageBoxButtons.YesNo))
{
port = new ArduinoSTK();
port.BaudRate = 57600;
@ -415,14 +415,14 @@ namespace ArdupilotMega
else
{
MessageBox.Show("Communication Error - no connection");
CustomMessageBox.Show("Communication Error - no connection");
}
port.Close();
}
catch (Exception ex) { MessageBox.Show("Check port settings or Port in use? " + ex.ToString()); port.Close(); }
catch (Exception ex) { CustomMessageBox.Show("Check port settings or Port in use? " + ex.ToString()); port.Close(); }
}
@ -519,7 +519,7 @@ namespace ArdupilotMega
{
ArduinoComms port = new ArduinoSTK();
if (DialogResult.Yes == MessageBox.Show("is this a 1280?", "", MessageBoxButtons.YesNo))
if (DialogResult.Yes == CustomMessageBox.Show("is this a 1280?", "", MessageBoxButtons.YesNo))
{
port = new ArduinoSTK();
port.BaudRate = 57600;
@ -563,16 +563,16 @@ namespace ArdupilotMega
}
else
{
MessageBox.Show("Communication Error - Bad data");
CustomMessageBox.Show("Communication Error - Bad data");
}
}
else
{
MessageBox.Show("Communication Error - no connection");
CustomMessageBox.Show("Communication Error - no connection");
}
port.Close();
}
catch (Exception ex) { MessageBox.Show("Port Error? " + ex.ToString()); if (port != null && port.IsOpen) { port.Close(); } }
catch (Exception ex) { CustomMessageBox.Show("Port Error? " + ex.ToString()); if (port != null && port.IsOpen) { port.Close(); } }
}
@ -627,16 +627,16 @@ namespace ArdupilotMega
}
else
{
MessageBox.Show("Communication Error - Bad data");
CustomMessageBox.Show("Communication Error - Bad data");
}
}
else
{
MessageBox.Show("Communication Error - no connection");
CustomMessageBox.Show("Communication Error - no connection");
}
port.Close();
}
catch (Exception ex) { MessageBox.Show("Port Error? " + ex.ToString()); if (port != null && port.IsOpen) { port.Close(); } }
catch (Exception ex) { CustomMessageBox.Show("Port Error? " + ex.ToString()); if (port != null && port.IsOpen) { port.Close(); } }
}
@ -691,16 +691,16 @@ namespace ArdupilotMega
}
else
{
MessageBox.Show("Communication Error - Bad data");
CustomMessageBox.Show("Communication Error - Bad data");
}
}
else
{
MessageBox.Show("Communication Error - no connection");
CustomMessageBox.Show("Communication Error - no connection");
}
port.Close();
}
catch (Exception ex) { MessageBox.Show("Port Error? " + ex.ToString()); if (port != null && port.IsOpen) { port.Close(); } }
catch (Exception ex) { CustomMessageBox.Show("Port Error? " + ex.ToString()); if (port != null && port.IsOpen) { port.Close(); } }
}
private void BUT_copyto1280_Click(object sender, EventArgs e)
@ -751,14 +751,14 @@ namespace ArdupilotMega
else
{
MessageBox.Show("Communication Error - no connection");
CustomMessageBox.Show("Communication Error - no connection");
}
port.Close();
}
catch (Exception ex) { MessageBox.Show("Check port settings or Port in use? " + ex.ToString()); port.Close(); }
catch (Exception ex) { CustomMessageBox.Show("Check port settings or Port in use? " + ex.ToString()); port.Close(); }
}
private void button2_Click(object sender, EventArgs e)
@ -771,7 +771,7 @@ namespace ArdupilotMega
sr.Close();
}
catch (Exception ex) { MessageBox.Show("Failed to read firmware.hex : " + ex.Message); }
catch (Exception ex) { CustomMessageBox.Show("Failed to read firmware.hex : " + ex.Message); }
StreamWriter sw = new StreamWriter(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"firmware.bin");
BinaryWriter bw = new BinaryWriter(sw.BaseStream);
@ -858,7 +858,7 @@ namespace ArdupilotMega
int removed = ((GMap.NET.CacheProviders.SQLitePureImageCache)MainMap.Manager.ImageCacheLocal).DeleteOlderThan(DateTime.Now, GMap.NET.MapType.Custom);
MessageBox.Show("Removed "+removed + " images\nshrinking file next");
CustomMessageBox.Show("Removed "+removed + " images\nshrinking file next");
GMap.NET.CacheProviders.SQLitePureImageCache.VacuumDb(MainMap.CacheLocation + @"\TileDBv3\en\Data.gmdb");

View File

@ -0,0 +1 @@