diff --git a/Tools/ArdupilotMegaPlanner/3DRRadio/ChangeLog.txt b/Tools/ArdupilotMegaPlanner/3DRRadio/ChangeLog.txt index 5520a2a8ea..78e539edb7 100644 --- a/Tools/ArdupilotMegaPlanner/3DRRadio/ChangeLog.txt +++ b/Tools/ArdupilotMegaPlanner/3DRRadio/ChangeLog.txt @@ -1,4 +1,5 @@ -0.9 - added rfd900a +1.0 - added rf freeq for 868 +0.9 - added rfd900a 0.8 - fix settings saving. 0.7 - fix typos - log rssi screen to log as well 0.6 - add terminal logging to file, fix remote radio config diff --git a/Tools/ArdupilotMegaPlanner/3DRRadio/Config.resx b/Tools/ArdupilotMegaPlanner/3DRRadio/Config.resx index 253ddcc778..abc588ecd0 100644 --- a/Tools/ArdupilotMegaPlanner/3DRRadio/Config.resx +++ b/Tools/ArdupilotMegaPlanner/3DRRadio/Config.resx @@ -1588,7 +1588,7 @@ - 3DRRadio Config 0.9 + 3DRRadio Config 1.0 settingsToolStripMenuItem diff --git a/Tools/ArdupilotMegaPlanner/Antenna/Tracker.cs b/Tools/ArdupilotMegaPlanner/Antenna/Tracker.cs index 3f7ec918df..566ca8a197 100644 --- a/Tools/ArdupilotMegaPlanner/Antenna/Tracker.cs +++ b/Tools/ArdupilotMegaPlanner/Antenna/Tracker.cs @@ -198,7 +198,7 @@ namespace ArdupilotMega.Antenna try { // 10 hz - position updates default to 3 hz on the stream rate - tracker.PanAndTilt(MainV2.cs.AZToMAV, MainV2.cs.ELToMAV); + tracker.PanAndTilt(MainV2.comPort.MAV.cs.AZToMAV, MainV2.comPort.MAV.cs.ELToMAV); System.Threading.Thread.Sleep(100); } catch { } @@ -262,7 +262,7 @@ namespace ArdupilotMega.Antenna void tm1_Tick(object item) { - float snr = MainV2.cs.localsnrdb; + float snr = MainV2.comPort.MAV.cs.localsnrdb; float best = snr; float tilt = 0; @@ -316,13 +316,13 @@ namespace ArdupilotMega.Antenna System.Threading.Thread.Sleep(2000); - Console.WriteLine("Angle " + n + " snr " + MainV2.cs.localsnrdb); + Console.WriteLine("Angle " + n + " snr " + MainV2.comPort.MAV.cs.localsnrdb); - if (MainV2.cs.localsnrdb > lastsnr) + if (MainV2.comPort.MAV.cs.localsnrdb > lastsnr) { best = n; - lastsnr = MainV2.cs.localsnrdb; + lastsnr = MainV2.comPort.MAV.cs.localsnrdb; } } diff --git a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj index 2d343243d8..0fa7c14e76 100644 --- a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj +++ b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj @@ -292,6 +292,12 @@ ConnectionStats.cs + + Component + + + FlashMessage.cs + UserControl @@ -412,6 +418,12 @@ ConfigAteryxSensors.cs + + UserControl + + + ConfigSignalization.cs + @@ -730,6 +742,9 @@ ConnectionStats.cs + + FlashMessage.cs + HSI.cs @@ -844,6 +859,9 @@ ConfigRawParams.cs + + ConfigSignalization.cs + ConfigTradHeli.cs @@ -1203,6 +1221,7 @@ Help.cs + Designer Simulation.cs @@ -1343,6 +1362,7 @@ Help.cs + Designer Simulation.cs @@ -1425,8 +1445,6 @@ Always - - Always diff --git a/Tools/ArdupilotMegaPlanner/ChangeLog.txt b/Tools/ArdupilotMegaPlanner/ChangeLog.txt index baeac2d157..2d671710e9 100644 --- a/Tools/ArdupilotMegaPlanner/ChangeLog.txt +++ b/Tools/ArdupilotMegaPlanner/ChangeLog.txt @@ -1,4 +1,34 @@ -* Mission Planner 1.2.22 +* Mission Planner 1.2.26 +move mavlink structure/currentstate around for future mods +update old firmware git hashs +mod some error descriptions +AP_mount camera trigger mod +modify raw param display with units/range/desc +add radio support for 868mhz +update ch7 options +updated dataflashlog format +small df log parser mod for bad gps loc +renable menu to always dock. right click for autohide + +* Mission Planner 1.2.25 +fix scaling problem on arducopter config tab. when linking is enabled + +* Mission Planner 1.2.24 +failsafe: hide element not needed +ap_limits back - beta +add new accel setup - beta +fix planner config screen exception +fix quickview desc/units if never been configured + +* Mission Planner 1.2.23 +ammend serial dispose on usb devices detach +add item currentstate item description and units +ammend battery screen for 3dr power module +add trackbar zoom to flight data +add unit desccription +ammend PREFLIGHT_REBOOT_SHUTDOWN timeout + +* Mission Planner 1.2.22 fix speed modification scale fix typo on antenna Tracker setup for ThemeManager.cs diff --git a/Tools/ArdupilotMegaPlanner/Common.cs b/Tools/ArdupilotMegaPlanner/Common.cs index 2751b8911c..49f7a41af1 100644 --- a/Tools/ArdupilotMegaPlanner/Common.cs +++ b/Tools/ArdupilotMegaPlanner/Common.cs @@ -201,29 +201,29 @@ namespace ArdupilotMega double width = (MainMap.Manager.GetDistance(MainMap.FromLocalToLatLng(0, 0), MainMap.FromLocalToLatLng(MainMap.Width, 0)) * 1000.0); double m2pixelwidth = MainMap.Width / width; - float alpha = ((desired_lead_dist * (float)m2pixelwidth) / MainV2.cs.radius) * rad2deg; + float alpha = ((desired_lead_dist * (float)m2pixelwidth) / MainV2.comPort.MAV.cs.radius) * rad2deg; - if (MainV2.cs.radius < -1) + if (MainV2.comPort.MAV.cs.radius < -1) { // fixme - float p1 = (float)Math.Cos((cog) * deg2rad) * MainV2.cs.radius + MainV2.cs.radius; + float p1 = (float)Math.Cos((cog) * deg2rad) * MainV2.comPort.MAV.cs.radius + MainV2.comPort.MAV.cs.radius; - float p2 = (float)Math.Sin((cog) * deg2rad) * MainV2.cs.radius + MainV2.cs.radius; + float p2 = (float)Math.Sin((cog) * deg2rad) * MainV2.comPort.MAV.cs.radius + MainV2.comPort.MAV.cs.radius; - g.DrawArc(new Pen(Color.HotPink, 2), p1, p2, Math.Abs(MainV2.cs.radius) * 2, Math.Abs(MainV2.cs.radius) * 2, cog, alpha); + g.DrawArc(new Pen(Color.HotPink, 2), p1, p2, Math.Abs(MainV2.comPort.MAV.cs.radius) * 2, Math.Abs(MainV2.comPort.MAV.cs.radius) * 2, cog, alpha); } - else if (MainV2.cs.radius > 1) + else if (MainV2.comPort.MAV.cs.radius > 1) { // correct - float p1 = (float)Math.Cos((cog - 180) * deg2rad) * MainV2.cs.radius + MainV2.cs.radius; + float p1 = (float)Math.Cos((cog - 180) * deg2rad) * MainV2.comPort.MAV.cs.radius + MainV2.comPort.MAV.cs.radius; - float p2 = (float)Math.Sin((cog - 180) * deg2rad) * MainV2.cs.radius + MainV2.cs.radius; + float p2 = (float)Math.Sin((cog - 180) * deg2rad) * MainV2.comPort.MAV.cs.radius + MainV2.comPort.MAV.cs.radius; - g.DrawArc(new Pen(Color.HotPink, 2), -p1, -p2, MainV2.cs.radius * 2, MainV2.cs.radius * 2, cog - 180, alpha); + g.DrawArc(new Pen(Color.HotPink, 2), -p1, -p2, MainV2.comPort.MAV.cs.radius * 2, MainV2.comPort.MAV.cs.radius * 2, cog - 180, alpha); } } @@ -543,20 +543,18 @@ namespace ArdupilotMega { [DisplayText("Do Nothing")] CH7_DO_NOTHING = 0, - [DisplayText("Set Hover")] - CH7_SET_HOVER = 1, [DisplayText("Flip")] CH7_FLIP = 2, [DisplayText("Simple Mode")] CH7_SIMPLE_MODE = 3, [DisplayText("Return to Launch")] CH7_RTL = 4, - [DisplayText("Automatic Trim")] + [DisplayText("Save Trim")] CH7_AUTO_TRIM = 5, - [DisplayText("ADC Filter")] - CH7_ADC_FILTER = 6, [DisplayText("Save Waypoint")] - CH7_SAVE_WP = 7 + CH7_SAVE_WP = 7, + [DisplayText("Camera Trigger")] + CH7_CAMERA_TRIGGER = 9 } public enum ac2ch6modes @@ -699,15 +697,15 @@ namespace ArdupilotMega public static Type getModes() { - if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane) + if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduPlane) { return typeof(apmmodes); } - else if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2) + else if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduCopter2) { return typeof(ac2modes); } - else if (MainV2.cs.firmware == MainV2.Firmwares.ArduRover) + else if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduRover) { return typeof(aprovermodes); } @@ -717,17 +715,17 @@ namespace ArdupilotMega public static List> getModesList() { - if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane) + if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduPlane) { var flightModes = EnumTranslator.Translate(); return flightModes.ToList(); } - else if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2) + else if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduCopter2) { var flightModes = EnumTranslator.Translate(); return flightModes.ToList(); } - else if (MainV2.cs.firmware == MainV2.Firmwares.ArduRover) + else if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduRover) { var flightModes = EnumTranslator.Translate(); return flightModes.ToList(); @@ -897,26 +895,26 @@ namespace ArdupilotMega public static string speechConversion(string input) { - if (MainV2.cs.wpno == 0) + if (MainV2.comPort.MAV.cs.wpno == 0) { input = input.Replace("{wpn}", "Home"); } else { - input = input.Replace("{wpn}", MainV2.cs.wpno.ToString()); + input = input.Replace("{wpn}", MainV2.comPort.MAV.cs.wpno.ToString()); } - input = input.Replace("{asp}", MainV2.cs.airspeed.ToString("0")); + input = input.Replace("{asp}", MainV2.comPort.MAV.cs.airspeed.ToString("0")); - input = input.Replace("{alt}", MainV2.cs.alt.ToString("0")); + input = input.Replace("{alt}", MainV2.comPort.MAV.cs.alt.ToString("0")); - input = input.Replace("{wpa}", MainV2.cs.targetalt.ToString("0")); + input = input.Replace("{wpa}", MainV2.comPort.MAV.cs.targetalt.ToString("0")); - input = input.Replace("{gsp}", MainV2.cs.groundspeed.ToString("0")); + input = input.Replace("{gsp}", MainV2.comPort.MAV.cs.groundspeed.ToString("0")); - input = input.Replace("{mode}", MainV2.cs.mode.ToString()); + input = input.Replace("{mode}", MainV2.comPort.MAV.cs.mode.ToString()); - input = input.Replace("{batv}", MainV2.cs.battery_voltage.ToString("0.00")); + input = input.Replace("{batv}", MainV2.comPort.MAV.cs.battery_voltage.ToString("0.00")); return input; } diff --git a/Tools/ArdupilotMegaPlanner/Controls/ConfigPanel.cs b/Tools/ArdupilotMegaPlanner/Controls/ConfigPanel.cs index 6bfaa471ab..c50129d717 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/ConfigPanel.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/ConfigPanel.cs @@ -35,7 +35,7 @@ namespace ArdupilotMega.Controls public void PopulateData() { // process hashdefines and update display - foreach (string value in MainV2.comPort.param.Keys) + foreach (string value in MainV2.comPort.MAV.param.Keys) { if (value == null || value == "") // older ap version have a null param continue; @@ -44,7 +44,7 @@ namespace ArdupilotMega.Controls { try { - float numbervalue = (float)MainV2.comPort.param[value]; + float numbervalue = (float)MainV2.comPort.MAV.param[value]; MAVLink.modifyParamForDisplay(true, value, ref numbervalue); diff --git a/Tools/ArdupilotMegaPlanner/Controls/FlashMessage.cs b/Tools/ArdupilotMegaPlanner/Controls/FlashMessage.cs new file mode 100644 index 0000000000..f685e389f3 --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Controls/FlashMessage.cs @@ -0,0 +1,142 @@ +using System; +using System.ComponentModel; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using System.Collections; + +namespace ArdupilotMega.Controls +{ + public partial class FlashMessage : Label + { + private const int fadeInterval = 20; //time in ms between "frames" of animation + private const int fadeDuration = 200; //overall animation duration in ms in one direction + private const int desiredHeight = 20; //desired height to animate to + private const int inOutDelay = 800 / fadeInterval; //number in ms between in and out + private const float fadeStepValue = desiredHeight * (float)fadeInterval / (float)fadeDuration; + private int inOutDelayCounter; + private int direction; + private int heightVisible; + private bool disposeOnComplete; + private Timer fadeTimer; + private bool inOut; + private Queue messages = new Queue(); + + public FlashMessage() + { + Visible = false; + + Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + Font = new System.Drawing.Font("Microsoft Sans Serif", 9.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + Location = new Point(0, 0); + TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + + fadeTimer = new Timer(); + fadeTimer.Interval = fadeInterval; + fadeTimer.Tick += new EventHandler(fadeTimer_Tick); + } + + public void FadeInOut(string msg, bool success) + { + if (Visible) + { + messages.Enqueue(new { msg = msg, success = success }); + } + else + { + if (this.Parent != null) Width = this.Parent.ClientSize.Width; + BringToFront(); + direction = 1; + inOut = true; + inOutDelayCounter = inOutDelay; + heightVisible = Height = 0; + Text = msg; + BackColor = success ? Color.YellowGreen : Color.Coral; + } + Visible = true; + fadeTimer.Enabled = true; + } + + //public void FadeIn(string msg, bool success) + //{ + // if (this.Parent != null) Width = this.Parent.ClientSize.Width; + // BringToFront(); + // direction = 1; + // inOut = false; + // heightVisible = Height = 0; + // if (Visible) + // { + // messages.Enqueue(msg); + // } + // else + // { + // Text = msg; + // } + // BackColor = success ? Color.YellowGreen : Color.Coral; + // Visible = true; + // fadeTimer.Enabled = true; + //} + + private void FadeOut(bool disposeOnComplete = false) + { + if (this.Parent != null) Width = this.Parent.ClientSize.Width; + BringToFront(); + direction = -1; + inOut = false; + heightVisible = Height = desiredHeight; + this.disposeOnComplete = disposeOnComplete; + fadeTimer.Enabled = true; + } + + private void fadeTimer_Tick(object sender, EventArgs e) + { + bool done = false; + heightVisible += (int)Math.Round(direction * fadeStepValue); + if (heightVisible < 0) { done = true; heightVisible = 0; } + if (heightVisible > desiredHeight) { done = true; heightVisible = desiredHeight; } + Height = heightVisible; + if (done) + { + if (inOut) + { + if (--inOutDelayCounter == 0) + { + FadeOut(disposeOnComplete); + } + } + else + { + if (messages.Count > 0) + { + Object o = messages.Dequeue(); + Text = (string)o.GetType().GetProperty("msg").GetValue(o, null); + bool success = (bool)o.GetType().GetProperty("success").GetValue(o, null); + BackColor = success ? Color.YellowGreen : Color.Coral; + + direction = 1; + inOut = true; + inOutDelayCounter = inOutDelay; + heightVisible = Height = 0; + + //Text = (messages.Dequeue()).msg; + } + else + { + fadeTimer.Enabled = false; + Visible = false; + if (direction == -1) //hide after fadeOut + { + if (disposeOnComplete) this.Dispose(); + } + } + } + } + else + { + //this.Height = heightVisible; + //this.Invalidate(); + } + } + } +} diff --git a/Tools/ArdupilotMegaPlanner/Controls/FlashMessage.designer.cs b/Tools/ArdupilotMegaPlanner/Controls/FlashMessage.designer.cs new file mode 100644 index 0000000000..e13f1af57f --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Controls/FlashMessage.designer.cs @@ -0,0 +1,46 @@ +using System.Windows.Forms; +using System.Drawing; +namespace ArdupilotMega.Controls +{ + partial class FlashMessage + { + public AutoScaleMode AutoScaleMode = AutoScaleMode.Font; + + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // FlashMessage + // + this.BackColor = System.Drawing.Color.Coral; + this.Name = "FM_info"; + this.ResumeLayout(false); + } + + #endregion + } +} diff --git a/Tools/ArdupilotMegaPlanner/Controls/FlashMessage.resx b/Tools/ArdupilotMegaPlanner/Controls/FlashMessage.resx new file mode 100644 index 0000000000..73afb877bd --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Controls/FlashMessage.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/Controls/HUD.cs b/Tools/ArdupilotMegaPlanner/Controls/HUD.cs index be21aa39d6..44e027d4e2 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/HUD.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/HUD.cs @@ -169,7 +169,7 @@ namespace ArdupilotMega.Controls //public float FontSize; public string Header; public System.Reflection.PropertyInfo Item; - public float GetValue { get { return (float)Item.GetValue((object)MainV2.cs, null); } } + public float GetValue { get { return (float)Item.GetValue((object)MainV2.comPort.MAV.cs, null); } } } public Hashtable CustomItems = new Hashtable(); diff --git a/Tools/ArdupilotMegaPlanner/CurrentState.cs b/Tools/ArdupilotMegaPlanner/CurrentState.cs index 8c4a8dd464..57fa227972 100644 --- a/Tools/ArdupilotMegaPlanner/CurrentState.cs +++ b/Tools/ArdupilotMegaPlanner/CurrentState.cs @@ -151,9 +151,9 @@ namespace ArdupilotMega return _ch3percent; try { - if (MainV2.comPort.param.ContainsKey("RC3_MIN")) + if (MainV2.comPort.MAV.param.ContainsKey("RC3_MIN")) { - return (int)((ch3out - float.Parse(MainV2.comPort.param["RC3_MIN"].ToString())) / (float.Parse(MainV2.comPort.param["RC3_MAX"].ToString()) - float.Parse(MainV2.comPort.param["RC3_MIN"].ToString())) * 100); + return (int)((ch3out - float.Parse(MainV2.comPort.MAV.param["RC3_MIN"].ToString())) / (float.Parse(MainV2.comPort.MAV.param["RC3_MAX"].ToString()) - float.Parse(MainV2.comPort.MAV.param["RC3_MIN"].ToString())) * 100); } else { @@ -437,11 +437,11 @@ namespace ArdupilotMega if (desc.Contains("(dist)")) { - desc = desc.Replace("(dist)", "(" + MainV2.cs.DistanceUnit + ")"); + desc = desc.Replace("(dist)", "(" + MainV2.comPort.MAV.cs.DistanceUnit + ")"); } else if (desc.Contains("(speed)")) { - desc = desc.Replace("(speed)", "(" + MainV2.cs.SpeedUnit + ")"); + desc = desc.Replace("(speed)", "(" + MainV2.comPort.MAV.cs.SpeedUnit + ")"); } return desc; @@ -490,10 +490,10 @@ namespace ArdupilotMega dowindcalc(); } - if (mavinterface.packets[MAVLink.MAVLINK_MSG_ID_STATUSTEXT] != null) // status text + if (mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_STATUSTEXT] != null) // status text { - string logdata = DateTime.Now + " " + Encoding.ASCII.GetString(mavinterface.packets[MAVLink.MAVLINK_MSG_ID_STATUSTEXT], 6, mavinterface.packets[MAVLink.MAVLINK_MSG_ID_STATUSTEXT].Length - 6); + string logdata = DateTime.Now + " " + Encoding.ASCII.GetString(mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_STATUSTEXT], 6, mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_STATUSTEXT].Length - 6); int ind = logdata.IndexOf('\0'); if (ind != -1) @@ -509,10 +509,10 @@ namespace ArdupilotMega } catch { } - mavinterface.packets[MAVLink.MAVLINK_MSG_ID_STATUSTEXT] = null; + mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_STATUSTEXT] = null; } - byte[] bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_RC_CHANNELS_SCALED]; + byte[] bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_RC_CHANNELS_SCALED]; if (bytearray != null) // hil mavlink 0.9 { @@ -530,7 +530,7 @@ namespace ArdupilotMega //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_RC_CHANNELS_SCALED] = null; } - bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_HIL_CONTROLS]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_HIL_CONTROLS]; if (bytearray != null) // hil mavlink 0.9 and 1.0 { @@ -544,7 +544,7 @@ namespace ArdupilotMega //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_HIL_CONTROLS] = null; } - bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_HWSTATUS]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_HWSTATUS]; if (bytearray != null) { @@ -556,7 +556,7 @@ namespace ArdupilotMega //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_HWSTATUS] = null; } - bytearray = mavinterface.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_WIND]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_WIND]; if (bytearray != null) { var wind = bytearray.ByteArrayToStructure(6); @@ -572,7 +572,7 @@ namespace ArdupilotMega #if MAVLINK10 - bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_HEARTBEAT]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_HEARTBEAT]; if (bytearray != null) { var hb = bytearray.ByteArrayToStructure(6); @@ -669,7 +669,7 @@ namespace ArdupilotMega } - bytearray = mavinterface.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_SYS_STATUS]; + bytearray = mavinterface.MAV.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_SYS_STATUS]; if (bytearray != null) { var sysstatus = bytearray.ByteArrayToStructure(6); @@ -684,7 +684,7 @@ namespace ArdupilotMega } #else - bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_SYS_STATUS]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_SYS_STATUS]; if (bytearray != null) { @@ -802,7 +802,7 @@ namespace ArdupilotMega } #endif - bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_SCALED_PRESSURE]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_SCALED_PRESSURE]; if (bytearray != null) { var pres = bytearray.ByteArrayToStructure(6); @@ -810,7 +810,7 @@ namespace ArdupilotMega press_temp = pres.temperature; } - bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_SENSOR_OFFSETS]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_SENSOR_OFFSETS]; if (bytearray != null) { var sensofs = bytearray.ByteArrayToStructure(6); @@ -833,7 +833,7 @@ namespace ArdupilotMega } - bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_ATTITUDE]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_ATTITUDE]; if (bytearray != null) { @@ -847,7 +847,7 @@ namespace ArdupilotMega //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_ATTITUDE] = null; } - bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_GPS_RAW_INT]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_GPS_RAW_INT]; if (bytearray != null) { var gps = bytearray.ByteArrayToStructure(6); @@ -872,14 +872,14 @@ namespace ArdupilotMega //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_GPS_RAW] = null; } - bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_GPS_STATUS]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_GPS_STATUS]; if (bytearray != null) { var gps = bytearray.ByteArrayToStructure(6); satcount = gps.satellites_visible; } - bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_RADIO]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_RADIO]; if (bytearray != null) { var radio = bytearray.ByteArrayToStructure(6); @@ -892,7 +892,7 @@ namespace ArdupilotMega fixedp = radio.fixedp; } - bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_GLOBAL_POSITION_INT]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_GLOBAL_POSITION_INT]; if (bytearray != null) { var loc = bytearray.ByteArrayToStructure(6); @@ -912,7 +912,7 @@ namespace ArdupilotMega } } - bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_MISSION_CURRENT]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_MISSION_CURRENT]; if (bytearray != null) { var wpcur = bytearray.ByteArrayToStructure(6); @@ -929,7 +929,7 @@ namespace ArdupilotMega //MAVLink.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_WAYPOINT_CURRENT] = null; } - bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT]; if (bytearray != null) { @@ -947,7 +947,7 @@ namespace ArdupilotMega //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT] = null; } - bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_RC_CHANNELS_RAW]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_RC_CHANNELS_RAW]; if (bytearray != null) { var rcin = bytearray.ByteArrayToStructure(6); @@ -967,7 +967,7 @@ namespace ArdupilotMega //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_RC_CHANNELS_RAW] = null; } - bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_SERVO_OUTPUT_RAW]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_SERVO_OUTPUT_RAW]; if (bytearray != null) { var servoout = bytearray.ByteArrayToStructure(6); @@ -985,7 +985,7 @@ namespace ArdupilotMega } - bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_RAW_IMU]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_RAW_IMU]; if (bytearray != null) { var imu = bytearray.ByteArrayToStructure(6); @@ -1005,7 +1005,7 @@ namespace ArdupilotMega //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_RAW_IMU] = null; } - bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_SCALED_IMU]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_SCALED_IMU]; if (bytearray != null) { var imu = bytearray.ByteArrayToStructure(6); @@ -1022,7 +1022,7 @@ namespace ArdupilotMega } - bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_VFR_HUD]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_VFR_HUD]; if (bytearray != null) { var vfr = bytearray.ByteArrayToStructure(6); @@ -1051,7 +1051,7 @@ namespace ArdupilotMega //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_VFR_HUD] = null; } - bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_MEMINFO]; + bytearray = mavinterface.MAV.packets[MAVLink.MAVLINK_MSG_ID_MEMINFO]; if (bytearray != null) { var mem = bytearray.ByteArrayToStructure(6); diff --git a/Tools/ArdupilotMegaPlanner/ElevationProfile.cs b/Tools/ArdupilotMegaPlanner/ElevationProfile.cs index ca7d702ff1..c41c1d877e 100644 --- a/Tools/ArdupilotMegaPlanner/ElevationProfile.cs +++ b/Tools/ArdupilotMegaPlanner/ElevationProfile.cs @@ -43,7 +43,7 @@ namespace ArdupilotMega lastloc = loc; } - this.homealt = homealt / MainV2.cs.multiplierdist; + this.homealt = homealt / MainV2.comPort.MAV.cs.multiplierdist; Form frm = Common.LoadingBox("Loading", "Downloading Google Earth Data"); @@ -82,7 +82,7 @@ namespace ArdupilotMega a += planloc.GetDistance(lastloc); } - list1.Add(a, planloc.Alt / MainV2.cs.multiplierdist, 0, planloc.Tag); // homealt + list1.Add(a, planloc.Alt / MainV2.comPort.MAV.cs.multiplierdist, 0, planloc.Tag); // homealt lastloc = planloc; count++; diff --git a/Tools/ArdupilotMegaPlanner/FollowMe.cs b/Tools/ArdupilotMegaPlanner/FollowMe.cs index 804e3a9be4..eb0738fef1 100644 --- a/Tools/ArdupilotMegaPlanner/FollowMe.cs +++ b/Tools/ArdupilotMegaPlanner/FollowMe.cs @@ -57,18 +57,18 @@ namespace ArdupilotMega string alt = "100"; - if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2) + if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduCopter2) { - alt = (10 * MainV2.cs.multiplierdist).ToString("0"); + alt = (10 * MainV2.comPort.MAV.cs.multiplierdist).ToString("0"); } else { - alt = (100 * MainV2.cs.multiplierdist).ToString("0"); + alt = (100 * MainV2.comPort.MAV.cs.multiplierdist).ToString("0"); } if (DialogResult.Cancel == Common.InputBox("Enter Alt", "Enter Alt (relative to home alt)", ref alt)) return; - intalt = (int)(100 * MainV2.cs.multiplierdist); + intalt = (int)(100 * MainV2.comPort.MAV.cs.multiplierdist); if (!int.TryParse(alt, out intalt)) { CustomMessageBox.Show("Bad Alt"); @@ -97,7 +97,7 @@ namespace ArdupilotMega { string line = comPort.ReadLine(); - //string line = string.Format("$GP{0},{1:HHmmss},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},", "GGA", DateTime.Now.ToUniversalTime(), Math.Abs(lat * 100), MainV2.cs.lat < 0 ? "S" : "N", Math.Abs(lng * 100), MainV2.cs.lng < 0 ? "W" : "E", MainV2.cs.gpsstatus, MainV2.cs.satcount, MainV2.cs.gpshdop, MainV2.cs.alt, "M", 0, "M", ""); + //string line = string.Format("$GP{0},{1:HHmmss},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},", "GGA", DateTime.Now.ToUniversalTime(), Math.Abs(lat * 100), MainV2.comPort.MAV.cs.lat < 0 ? "S" : "N", Math.Abs(lng * 100), MainV2.comPort.MAV.cs.lng < 0 ? "W" : "E", MainV2.comPort.MAV.cs.gpsstatus, MainV2.comPort.MAV.cs.satcount, MainV2.comPort.MAV.cs.gpshdop, MainV2.comPort.MAV.cs.alt, "M", 0, "M", ""); if (line.StartsWith("$GPGGA")) // { string[] items = line.Trim().Split(',','*'); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAP_Limits.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAP_Limits.cs index 27d7de5228..7277612941 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAP_Limits.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAP_Limits.cs @@ -41,7 +41,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView private void LIM_ENABLED_CheckedChanged(object sender, EventArgs e) { - if (!MainV2.comPort.param.ContainsKey("LIM_ENABLED")) + if (!MainV2.comPort.MAV.param.ContainsKey("LIM_ENABLED")) { CustomMessageBox.Show("This feature is not enabled in your firmware."); return; @@ -80,7 +80,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView void PopulateData() { - Hashtable copy = new Hashtable(MainV2.comPort.param); + Hashtable copy = new Hashtable(MainV2.comPort.MAV.param); foreach (string key in copy.Keys) { diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.cs index 364e64e569..28bed0563f 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.cs @@ -29,7 +29,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView } else { - if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane) + if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduPlane) { this.Enabled = true; } @@ -42,8 +42,8 @@ namespace ArdupilotMega.GCSViews.ConfigurationView startup = true; - if (MainV2.comPort.param["MANUAL_LEVEL"] != null) - CHK_manuallevel.Checked = MainV2.comPort.param["MANUAL_LEVEL"].ToString() == "1" ? true : false; + if (MainV2.comPort.MAV.param["MANUAL_LEVEL"] != null) + CHK_manuallevel.Checked = MainV2.comPort.MAV.param["MANUAL_LEVEL"].ToString() == "1" ? true : false; startup = false; } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.cs index af2a193c96..656840a9fe 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.cs @@ -79,13 +79,13 @@ namespace ArdupilotMega.GCSViews.ConfigurationView public void Activate() { - if (!MainV2.comPort.param.ContainsKey("FRAME")) + if (!MainV2.comPort.MAV.param.ContainsKey("FRAME")) { this.Enabled = false; return; } - if ((float)MainV2.comPort.param["FRAME"] == 0) + if ((float)MainV2.comPort.MAV.param["FRAME"] == 0) { this.radioButton_Plus.Checked = true; pictureBoxX.Opacity = DisabledOpacity; @@ -147,13 +147,13 @@ namespace ArdupilotMega.GCSViews.ConfigurationView { ConfigAccelerometerCalibrationQuad local = (ConfigAccelerometerCalibrationQuad)item; - while (!(MainV2.cs.message.Contains("Calibration successful") || MainV2.cs.message.Contains("Calibration failed"))) + while (!(MainV2.comPort.MAV.cs.message.Contains("Calibration successful") || MainV2.comPort.MAV.cs.message.Contains("Calibration failed"))) { System.Threading.Thread.Sleep(10); // read the message MainV2.comPort.readPacket(); // update cs with the message - MainV2.cs.UpdateCurrentSettings(null); + MainV2.comPort.MAV.cs.UpdateCurrentSettings(null); // update user display local.UpdateUserMessage(); } @@ -170,7 +170,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView { this.Invoke((MethodInvoker)delegate() { - lbl_Accel_user.Text = MainV2.cs.message; + lbl_Accel_user.Text = MainV2.comPort.MAV.cs.message; }); } } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.Designer.cs index 86d030a5c3..6d4714bbea 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.Designer.cs @@ -30,12 +30,9 @@ { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConfigArducopter)); - this.myLabel3 = new ArdupilotMega.Controls.MyLabel(); this.TUNE_LOW = new System.Windows.Forms.NumericUpDown(); this.TUNE_HIGH = new System.Windows.Forms.NumericUpDown(); - this.myLabel2 = new ArdupilotMega.Controls.MyLabel(); this.TUNE = new System.Windows.Forms.ComboBox(); - this.myLabel1 = new ArdupilotMega.Controls.MyLabel(); this.CH7_OPT = new System.Windows.Forms.ComboBox(); this.groupBox5 = new System.Windows.Forms.GroupBox(); this.THR_RATE_D = new System.Windows.Forms.NumericUpDown(); @@ -126,8 +123,6 @@ this.RATE_RLL_P = new System.Windows.Forms.NumericUpDown(); this.label91 = new System.Windows.Forms.Label(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.BUT_writePIDS = new ArdupilotMega.Controls.MyButton(); - this.BUT_rerequestparams = new ArdupilotMega.Controls.MyButton(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.LOITER_LAT_D = new System.Windows.Forms.NumericUpDown(); this.label1 = new System.Windows.Forms.Label(); @@ -137,6 +132,11 @@ this.label3 = new System.Windows.Forms.Label(); this.LOITER_LAT_P = new System.Windows.Forms.NumericUpDown(); this.label4 = new System.Windows.Forms.Label(); + this.BUT_rerequestparams = new ArdupilotMega.Controls.MyButton(); + this.BUT_writePIDS = new ArdupilotMega.Controls.MyButton(); + this.myLabel3 = new ArdupilotMega.Controls.MyLabel(); + this.myLabel2 = new ArdupilotMega.Controls.MyLabel(); + this.myLabel1 = new ArdupilotMega.Controls.MyLabel(); ((System.ComponentModel.ISupportInitialize)(this.TUNE_LOW)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.TUNE_HIGH)).BeginInit(); this.groupBox5.SuspendLayout(); @@ -195,12 +195,6 @@ ((System.ComponentModel.ISupportInitialize)(this.LOITER_LAT_P)).BeginInit(); this.SuspendLayout(); // - // myLabel3 - // - resources.ApplyResources(this.myLabel3, "myLabel3"); - this.myLabel3.Name = "myLabel3"; - this.myLabel3.resize = false; - // // TUNE_LOW // resources.ApplyResources(this.TUNE_LOW, "TUNE_LOW"); @@ -211,63 +205,19 @@ resources.ApplyResources(this.TUNE_HIGH, "TUNE_HIGH"); this.TUNE_HIGH.Name = "TUNE_HIGH"; // - // myLabel2 - // - resources.ApplyResources(this.myLabel2, "myLabel2"); - this.myLabel2.Name = "myLabel2"; - this.myLabel2.resize = false; - // // TUNE // this.TUNE.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.TUNE.DropDownWidth = 150; this.TUNE.FormattingEnabled = true; - this.TUNE.Items.AddRange(new object[] { - resources.GetString("TUNE.Items"), - resources.GetString("TUNE.Items1"), - resources.GetString("TUNE.Items2"), - resources.GetString("TUNE.Items3"), - resources.GetString("TUNE.Items4"), - resources.GetString("TUNE.Items5"), - resources.GetString("TUNE.Items6"), - resources.GetString("TUNE.Items7"), - resources.GetString("TUNE.Items8"), - resources.GetString("TUNE.Items9"), - resources.GetString("TUNE.Items10"), - resources.GetString("TUNE.Items11"), - resources.GetString("TUNE.Items12"), - resources.GetString("TUNE.Items13"), - resources.GetString("TUNE.Items14"), - resources.GetString("TUNE.Items15"), - resources.GetString("TUNE.Items16"), - resources.GetString("TUNE.Items17"), - resources.GetString("TUNE.Items18"), - resources.GetString("TUNE.Items19"), - resources.GetString("TUNE.Items20"), - resources.GetString("TUNE.Items21")}); resources.ApplyResources(this.TUNE, "TUNE"); this.TUNE.Name = "TUNE"; // - // myLabel1 - // - resources.ApplyResources(this.myLabel1, "myLabel1"); - this.myLabel1.Name = "myLabel1"; - this.myLabel1.resize = false; - // // CH7_OPT // this.CH7_OPT.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CH7_OPT.DropDownWidth = 150; this.CH7_OPT.FormattingEnabled = true; - this.CH7_OPT.Items.AddRange(new object[] { - resources.GetString("CH7_OPT.Items"), - resources.GetString("CH7_OPT.Items1"), - resources.GetString("CH7_OPT.Items2"), - resources.GetString("CH7_OPT.Items3"), - resources.GetString("CH7_OPT.Items4"), - resources.GetString("CH7_OPT.Items5"), - resources.GetString("CH7_OPT.Items6"), - resources.GetString("CH7_OPT.Items7")}); resources.ApplyResources(this.CH7_OPT, "CH7_OPT"); this.CH7_OPT.Name = "CH7_OPT"; // @@ -812,20 +762,6 @@ this.toolTip1.InitialDelay = 500; this.toolTip1.ReshowDelay = 100; // - // BUT_writePIDS - // - resources.ApplyResources(this.BUT_writePIDS, "BUT_writePIDS"); - this.BUT_writePIDS.Name = "BUT_writePIDS"; - this.BUT_writePIDS.UseVisualStyleBackColor = true; - this.BUT_writePIDS.Click += new System.EventHandler(this.BUT_writePIDS_Click); - // - // BUT_rerequestparams - // - resources.ApplyResources(this.BUT_rerequestparams, "BUT_rerequestparams"); - this.BUT_rerequestparams.Name = "BUT_rerequestparams"; - this.BUT_rerequestparams.UseVisualStyleBackColor = true; - this.BUT_rerequestparams.Click += new System.EventHandler(this.BUT_rerequestparams_Click); - // // groupBox1 // this.groupBox1.Controls.Add(this.LOITER_LAT_D); @@ -880,6 +816,38 @@ resources.ApplyResources(this.label4, "label4"); this.label4.Name = "label4"; // + // BUT_rerequestparams + // + resources.ApplyResources(this.BUT_rerequestparams, "BUT_rerequestparams"); + this.BUT_rerequestparams.Name = "BUT_rerequestparams"; + this.BUT_rerequestparams.UseVisualStyleBackColor = true; + this.BUT_rerequestparams.Click += new System.EventHandler(this.BUT_rerequestparams_Click); + // + // BUT_writePIDS + // + resources.ApplyResources(this.BUT_writePIDS, "BUT_writePIDS"); + this.BUT_writePIDS.Name = "BUT_writePIDS"; + this.BUT_writePIDS.UseVisualStyleBackColor = true; + this.BUT_writePIDS.Click += new System.EventHandler(this.BUT_writePIDS_Click); + // + // myLabel3 + // + resources.ApplyResources(this.myLabel3, "myLabel3"); + this.myLabel3.Name = "myLabel3"; + this.myLabel3.resize = false; + // + // myLabel2 + // + resources.ApplyResources(this.myLabel2, "myLabel2"); + this.myLabel2.Name = "myLabel2"; + this.myLabel2.resize = false; + // + // myLabel1 + // + resources.ApplyResources(this.myLabel1, "myLabel1"); + this.myLabel1.Name = "myLabel1"; + this.myLabel1.resize = false; + // // ConfigArducopter // resources.ApplyResources(this, "$this"); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.cs index f59189f21f..d03dc7878b 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.cs @@ -43,7 +43,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView } else { - if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2) + if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduCopter2) { this.Enabled = true; } @@ -163,7 +163,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView // process hashdefines and update display - foreach (string value in MainV2.comPort.param.Keys) + foreach (string value in MainV2.comPort.MAV.param.Keys) { if (value == null || value == "") continue; @@ -180,7 +180,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView if (ctl.GetType() == typeof(NumericUpDown)) { - float numbervalue = (float)MainV2.comPort.param[value]; + float numbervalue = (float)MainV2.comPort.MAV.param[value]; MAVLink.modifyParamForDisplay(true, value, ref numbervalue); @@ -231,7 +231,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView ComboBox thisctl = ((ComboBox)ctl); - thisctl.SelectedValue = (int)(float)MainV2.comPort.param[value]; + thisctl.SelectedValue = (int)(float)MainV2.comPort.MAV.param[value]; thisctl.Validated += new EventHandler(ComboBox_Validated); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.resx b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.resx index faddbe520e..873f222bba 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.resx @@ -118,37 +118,13 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 364, 321 - - - 29, 23 - - - - 42 - - - Min - - - myLabel3 - - - ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4666.36788, Culture=neutral, PublicKeyToken=null - - - $this - - - 3 - 399, 324 51, 20 + 41 @@ -185,96 +161,6 @@ 5 - - 364, 296 - - - 53, 23 - - - 39 - - - Ch6 Opt - - - myLabel2 - - - ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4666.36788, Culture=neutral, PublicKeyToken=null - - - $this - - - 6 - - - CH6_NONE - - - CH6_STABILIZE_KP - - - CH6_STABILIZE_KI - - - CH6_YAW_KP - - - CH6_RATE_KP - - - CH6_RATE_KI - - - CH6_YAW_RATE_KP - - - CH6_THROTTLE_KP - - - CH6_TOP_BOTTOM_RATIO - - - CH6_RELAY - - - CH6_TRAVERSE_SPEED - - - CH6_NAV_P - - - CH6_LOITER_P - - - CH6_HELI_EXTERNAL_GYRO - - - CH6_THR_HOLD_KP - - - CH6_Z_GAIN - - - CH6_DAMP - - - CH6_OPTFLOW_KP - - - CH6_OPTFLOW_KI - - - CH6_OPTFLOW_KD - - - CH6_NAV_I - - - CH6_RATE_KD - 423, 296 @@ -296,54 +182,6 @@ 7 - - 364, 348 - - - 53, 23 - - - 37 - - - Ch7 Opt - - - myLabel1 - - - ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4666.36788, Culture=neutral, PublicKeyToken=null - - - $this - - - 8 - - - Do Nothing - - - - - - - - - Simple Mode - - - RTL - - - - - - - - - Save WP - 423, 348 @@ -2487,63 +2325,6 @@ 17, 17 - - NoControl - - - 255, 383 - - - 103, 19 - - - 70 - - - Write Params - - - BUT_writePIDS - - - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4666.36788, Culture=neutral, PublicKeyToken=null - - - $this - - - 2 - - - NoControl - - - 364, 383 - - - 0, 15, 0, 0 - - - 103, 19 - - - 74 - - - Refresh Params - - - BUT_rerequestparams - - - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4666.36788, Culture=neutral, PublicKeyToken=null - - - $this - - - 1 - 80, 60 @@ -2760,6 +2541,135 @@ 0 + + NoControl + + + 364, 383 + + + 0, 15, 0, 0 + + + 103, 19 + + + 74 + + + Refresh Params + + + BUT_rerequestparams + + + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4724.22562, Culture=neutral, PublicKeyToken=null + + + $this + + + 1 + + + NoControl + + + 255, 383 + + + 103, 19 + + + 70 + + + Write Params + + + BUT_writePIDS + + + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4724.22562, Culture=neutral, PublicKeyToken=null + + + $this + + + 2 + + + 364, 321 + + + 29, 23 + + + 42 + + + Min + + + myLabel3 + + + ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4724.22562, Culture=neutral, PublicKeyToken=null + + + $this + + + 3 + + + 364, 296 + + + 53, 23 + + + 39 + + + Ch6 Opt + + + myLabel2 + + + ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4724.22562, Culture=neutral, PublicKeyToken=null + + + $this + + + 6 + + + 364, 348 + + + 53, 23 + + + 37 + + + Ch7 Opt + + + myLabel1 + + + ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4724.22562, Culture=neutral, PublicKeyToken=null + + + $this + + + 8 + True diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArduplane.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArduplane.cs index 7698f75998..ec300cb5ea 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArduplane.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArduplane.cs @@ -32,7 +32,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView } else { - if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane) + if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduPlane) { this.Enabled = true; } @@ -153,7 +153,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView disableNumericUpDownControls(this); // process hashdefines and update display - foreach (string value in MainV2.comPort.param.Keys) + foreach (string value in MainV2.comPort.MAV.param.Keys) { if (value == null || value == "") continue; @@ -167,7 +167,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView if (ctl.GetType() == typeof(NumericUpDown)) { - float numbervalue = (float)MainV2.comPort.param[value]; + float numbervalue = (float)MainV2.comPort.MAV.param[value]; MAVLink.modifyParamForDisplay(true, value,ref numbervalue); @@ -214,7 +214,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView ComboBox thisctl = ((ComboBox)ctl); - thisctl.SelectedIndex = (int)(float)MainV2.comPort.param[value]; + thisctl.SelectedIndex = (int)(float)MainV2.comPort.MAV.param[value]; thisctl.Validated += new EventHandler(ComboBox_Validated); } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArdurover.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArdurover.cs index bc92622f02..d75bc5e2bb 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArdurover.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArdurover.cs @@ -32,7 +32,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView } else { - if (MainV2.cs.firmware == MainV2.Firmwares.ArduRover) + if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduRover) { this.Enabled = true; } @@ -153,7 +153,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView disableNumericUpDownControls(this); // process hashdefines and update display - foreach (string value in MainV2.comPort.param.Keys) + foreach (string value in MainV2.comPort.MAV.param.Keys) { if (value == null || value == "") continue; @@ -167,7 +167,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView if (ctl.GetType() == typeof(NumericUpDown)) { - float numbervalue = (float)MainV2.comPort.param[value]; + float numbervalue = (float)MainV2.comPort.MAV.param[value]; MAVLink.modifyParamForDisplay(true, value, ref numbervalue); @@ -214,7 +214,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView ComboBox thisctl = ((ComboBox)ctl); - thisctl.SelectedIndex = (int)(float)MainV2.comPort.param[value]; + thisctl.SelectedIndex = (int)(float)MainV2.comPort.MAV.param[value]; thisctl.Validated += new EventHandler(ComboBox_Validated); } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAteryx.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAteryx.cs index d4ea5e74c8..235eec62ba 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAteryx.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAteryx.cs @@ -38,7 +38,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView } else { - if (MainV2.cs.firmware == MainV2.Firmwares.Ateryx) + if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.Ateryx) { this.Enabled = true; } @@ -159,7 +159,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView disableNumericUpDownControls(this); // process hashdefines and update display - foreach (string value in MainV2.comPort.param.Keys) + foreach (string value in MainV2.comPort.MAV.param.Keys) { if (value == null || value == "") continue; @@ -176,7 +176,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView NumericUpDown thisctl = ((NumericUpDown)ctl); thisctl.Maximum = 9000; thisctl.Minimum = -9000; - thisctl.Value = (decimal)(float)MainV2.comPort.param[value]; + thisctl.Value = (decimal)(float)MainV2.comPort.MAV.param[value]; thisctl.Increment = (decimal)0.001; if (thisctl.Name.EndsWith("_P") || thisctl.Name.EndsWith("_I") || thisctl.Name.EndsWith("_D") || thisctl.Name.EndsWith("_LOW") || thisctl.Name.EndsWith("_HIGH") || thisctl.Value == 0 @@ -216,7 +216,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView ComboBox thisctl = ((ComboBox)ctl); - thisctl.SelectedIndex = (int)(float)MainV2.comPort.param[value]; + thisctl.SelectedIndex = (int)(float)MainV2.comPort.MAV.param[value]; thisctl.Validated += new EventHandler(ComboBox_Validated); } @@ -353,7 +353,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView { ((Button)sender).Enabled = false; - if ((MainV2.cs.airspeed > 7.0) || (MainV2.cs.groundspeed > 10.0)) + if ((MainV2.comPort.MAV.cs.airspeed > 7.0) || (MainV2.comPort.MAV.cs.groundspeed > 10.0)) { MessageBox.Show("Unable - UAV airborne"); ((Button)sender).Enabled = true; @@ -379,7 +379,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView if (dr == System.Windows.Forms.DialogResult.Yes) { - if ((MainV2.cs.airspeed > 7.0) || (MainV2.cs.groundspeed > 7.0)) + if ((MainV2.comPort.MAV.cs.airspeed > 7.0) || (MainV2.comPort.MAV.cs.groundspeed > 7.0)) { MessageBox.Show("Unable - UAV airborne"); ((Button)sender).Enabled = true; diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAteryxSensors.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAteryxSensors.cs index 37eef9c720..32b4bc41ee 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAteryxSensors.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAteryxSensors.cs @@ -29,7 +29,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView } else { - if (MainV2.cs.firmware == MainV2.Firmwares.Ateryx) + if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.Ateryx) { this.Enabled = true; } @@ -55,7 +55,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView ((Button)sender).Enabled = false; - if ((MainV2.cs.airspeed > 7.0) || (MainV2.cs.groundspeed > 10.0)) + if ((MainV2.comPort.MAV.cs.airspeed > 7.0) || (MainV2.comPort.MAV.cs.groundspeed > 10.0)) { MessageBox.Show("Unable - UAV airborne"); ((Button)sender).Enabled = true; @@ -79,7 +79,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView { ((Button)sender).Enabled = false; - if ((MainV2.cs.airspeed > 7.0) || (MainV2.cs.groundspeed > 10.0)) + if ((MainV2.comPort.MAV.cs.airspeed > 7.0) || (MainV2.comPort.MAV.cs.groundspeed > 10.0)) { MessageBox.Show("Unable - UAV airborne"); ((Button)sender).Enabled = true; @@ -101,7 +101,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView private void timer1_Tick(object sender, EventArgs e) { - MainV2.cs.UpdateCurrentSettings(bindingSource1); + MainV2.comPort.MAV.cs.UpdateCurrentSettings(bindingSource1); } } } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigBatteryMonitoring.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigBatteryMonitoring.cs index 109590b04b..0d3689db32 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigBatteryMonitoring.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigBatteryMonitoring.cs @@ -49,7 +49,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView return; try { - if (MainV2.comPort.param["BATT_CAPACITY"] == null) + if (MainV2.comPort.MAV.param["BATT_CAPACITY"] == null) { CustomMessageBox.Show("Not Available"); } @@ -66,7 +66,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView return; try { - if (MainV2.comPort.param["BATT_MONITOR"] == null) + if (MainV2.comPort.MAV.param["BATT_MONITOR"] == null) { CustomMessageBox.Show("Not Available"); } @@ -117,7 +117,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView return; try { - if (MainV2.comPort.param["INPUT_VOLTS"] == null) + if (MainV2.comPort.MAV.param["INPUT_VOLTS"] == null) { CustomMessageBox.Show("Not Available"); } @@ -151,7 +151,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView try { - if (MainV2.comPort.param["VOLT_DIVIDER"] == null) + if (MainV2.comPort.MAV.param["VOLT_DIVIDER"] == null) { CustomMessageBox.Show("Not Available"); } @@ -173,7 +173,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView return; try { - if (MainV2.comPort.param["VOLT_DIVIDER"] == null) + if (MainV2.comPort.MAV.param["VOLT_DIVIDER"] == null) { CustomMessageBox.Show("Not Available"); } @@ -195,7 +195,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView return; try { - if (MainV2.comPort.param["AMP_PER_VOLT"] == null) + if (MainV2.comPort.MAV.param["AMP_PER_VOLT"] == null) { CustomMessageBox.Show("Not Available"); } @@ -304,28 +304,28 @@ namespace ArdupilotMega.GCSViews.ConfigurationView { startup = true; bool not_supported = false; - if (MainV2.comPort.param["BATT_MONITOR"] != null) + if (MainV2.comPort.MAV.param["BATT_MONITOR"] != null) { - if (MainV2.comPort.param["BATT_MONITOR"].ToString() != "0.0") + if (MainV2.comPort.MAV.param["BATT_MONITOR"].ToString() != "0.0") { - CMB_batmontype.SelectedIndex = getIndex(CMB_batmontype, (int)float.Parse(MainV2.comPort.param["BATT_MONITOR"].ToString())); + CMB_batmontype.SelectedIndex = getIndex(CMB_batmontype, (int)float.Parse(MainV2.comPort.MAV.param["BATT_MONITOR"].ToString())); } } - if (MainV2.comPort.param["BATT_CAPACITY"] != null) - TXT_battcapacity.Text = MainV2.comPort.param["BATT_CAPACITY"].ToString(); - if (MainV2.comPort.param["INPUT_VOLTS"] != null) - TXT_inputvoltage.Text = MainV2.comPort.param["INPUT_VOLTS"].ToString(); + if (MainV2.comPort.MAV.param["BATT_CAPACITY"] != null) + TXT_battcapacity.Text = MainV2.comPort.MAV.param["BATT_CAPACITY"].ToString(); + if (MainV2.comPort.MAV.param["INPUT_VOLTS"] != null) + TXT_inputvoltage.Text = MainV2.comPort.MAV.param["INPUT_VOLTS"].ToString(); else not_supported = true; - TXT_voltage.Text = MainV2.cs.battery_voltage.ToString(); + TXT_voltage.Text = MainV2.comPort.MAV.cs.battery_voltage.ToString(); TXT_measuredvoltage.Text = TXT_voltage.Text; - if (MainV2.comPort.param["VOLT_DIVIDER"] != null) - TXT_divider.Text = MainV2.comPort.param["VOLT_DIVIDER"].ToString(); + if (MainV2.comPort.MAV.param["VOLT_DIVIDER"] != null) + TXT_divider.Text = MainV2.comPort.MAV.param["VOLT_DIVIDER"].ToString(); else not_supported = true; - if (MainV2.comPort.param["AMP_PER_VOLT"] != null) - TXT_ampspervolt.Text = MainV2.comPort.param["AMP_PER_VOLT"].ToString(); + if (MainV2.comPort.MAV.param["AMP_PER_VOLT"] != null) + TXT_ampspervolt.Text = MainV2.comPort.MAV.param["AMP_PER_VOLT"].ToString(); else not_supported = true; if (not_supported) @@ -359,11 +359,11 @@ namespace ArdupilotMega.GCSViews.ConfigurationView CMB_batmonsensortype.SelectedIndex = 0; } - if (MainV2.comPort.param["BATT_VOLT_PIN"] != null) + if (MainV2.comPort.MAV.param["BATT_VOLT_PIN"] != null) { CMB_apmversion.Enabled = true; - float value = (float)MainV2.comPort.param["BATT_VOLT_PIN"]; + float value = (float)MainV2.comPort.MAV.param["BATT_VOLT_PIN"]; if (value == 0) // apm1 { CMB_apmversion.SelectedIndex = 0; @@ -402,7 +402,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView private void timer1_Tick(object sender, EventArgs e) { - TXT_voltage.Text = MainV2.cs.battery_voltage.ToString(); + TXT_voltage.Text = MainV2.comPort.MAV.cs.battery_voltage.ToString(); } private void CMB_apmversion_SelectedIndexChanged(object sender, EventArgs e) diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFailSafe.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFailSafe.cs index 85edd7d840..18b998216f 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFailSafe.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFailSafe.cs @@ -35,7 +35,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView // update all linked controls - 10hz try { - MainV2.cs.UpdateCurrentSettings(currentStateBindingSource); + MainV2.comPort.MAV.cs.UpdateCurrentSettings(currentStateBindingSource); } catch { } } @@ -43,15 +43,15 @@ namespace ArdupilotMega.GCSViews.ConfigurationView public void Activate() { // arducopter - mavlinkCheckBoxfs_batt_enable.setup(1, 0, "FS_BATT_ENABLE", MainV2.comPort.param); + mavlinkCheckBoxfs_batt_enable.setup(1, 0, "FS_BATT_ENABLE", MainV2.comPort.MAV.param); // plane - mavlinkCheckBoxthr_fs.setup(1, 0, "THR_FAILSAFE", MainV2.comPort.param, mavlinkNumericUpDownthr_fs_value); - mavlinkNumericUpDownthr_fs_value.setup(800, 1200, 1, 1, "THR_FS_VALUE", MainV2.comPort.param); - mavlinkCheckBoxthr_fs_action.setup(1, 0, "THR_FS_ACTION",MainV2.comPort.param); - mavlinkCheckBoxgcs_fs.setup(1, 0, "FS_GCS_ENABL", MainV2.comPort.param); - mavlinkCheckBoxshort_fs.setup(1, 0, "FS_SHORT_ACTN", MainV2.comPort.param); - mavlinkCheckBoxlong_fs.setup(1, 0, "FS_LONG_ACTN", MainV2.comPort.param); + mavlinkCheckBoxthr_fs.setup(1, 0, "THR_FAILSAFE", MainV2.comPort.MAV.param, mavlinkNumericUpDownthr_fs_value); + mavlinkNumericUpDownthr_fs_value.setup(800, 1200, 1, 1, "THR_FS_VALUE", MainV2.comPort.MAV.param); + mavlinkCheckBoxthr_fs_action.setup(1, 0, "THR_FS_ACTION",MainV2.comPort.MAV.param); + mavlinkCheckBoxgcs_fs.setup(1, 0, "FS_GCS_ENABL", MainV2.comPort.MAV.param); + mavlinkCheckBoxshort_fs.setup(1, 0, "FS_SHORT_ACTN", MainV2.comPort.MAV.param); + mavlinkCheckBoxlong_fs.setup(1, 0, "FS_LONG_ACTN", MainV2.comPort.MAV.param); timer.Enabled = true; timer.Interval = 100; @@ -109,7 +109,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView private void lbl_currentmode_TextChanged(object sender, EventArgs e) { - if (MainV2.cs.ch3in < (float)MainV2.comPort.param["THR_FS_VALUE"]) + if (MainV2.comPort.MAV.cs.ch3in < (float)MainV2.comPort.MAV.param["THR_FS_VALUE"]) { lbl_currentmode.ForeColor = Color.Red; } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.cs index 7f4cf09bda..361235278d 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.cs @@ -25,43 +25,43 @@ namespace ArdupilotMega.GCSViews.ConfigurationView { try { - MainV2.cs.UpdateCurrentSettings(currentStateBindingSource); + MainV2.comPort.MAV.cs.UpdateCurrentSettings(currentStateBindingSource); } catch { } float pwm = 0; - if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane || MainV2.cs.firmware == MainV2.Firmwares.ArduRover) // APM + if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduPlane || MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduRover) // APM { - if (MainV2.comPort.param.ContainsKey("FLTMODE_CH")) + if (MainV2.comPort.MAV.param.ContainsKey("FLTMODE_CH")) { - switch ((int)(float)MainV2.comPort.param["FLTMODE_CH"]) + switch ((int)(float)MainV2.comPort.MAV.param["FLTMODE_CH"]) { case 5: - pwm = MainV2.cs.ch5in; + pwm = MainV2.comPort.MAV.cs.ch5in; break; case 6: - pwm = MainV2.cs.ch6in; + pwm = MainV2.comPort.MAV.cs.ch6in; break; case 7: - pwm = MainV2.cs.ch7in; + pwm = MainV2.comPort.MAV.cs.ch7in; break; case 8: - pwm = MainV2.cs.ch8in; + pwm = MainV2.comPort.MAV.cs.ch8in; break; default: break; } - LBL_flightmodepwm.Text = MainV2.comPort.param["FLTMODE_CH"].ToString() + ": " + pwm.ToString(); + LBL_flightmodepwm.Text = MainV2.comPort.MAV.param["FLTMODE_CH"].ToString() + ": " + pwm.ToString(); } } - if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2) // ac2 + if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduCopter2) // ac2 { - pwm = MainV2.cs.ch5in; - LBL_flightmodepwm.Text = "5: " + MainV2.cs.ch5in.ToString(); + pwm = MainV2.comPort.MAV.cs.ch5in; + LBL_flightmodepwm.Text = "5: " + MainV2.comPort.MAV.cs.ch5in.ToString(); } Control[] fmodelist = new Control[] { CMB_fmode1, CMB_fmode2, CMB_fmode3, CMB_fmode4, CMB_fmode5, CMB_fmode6 }; @@ -100,11 +100,11 @@ namespace ArdupilotMega.GCSViews.ConfigurationView MainV2.comPort.setParam("FLTMODE5", (float)Int32.Parse(CMB_fmode5.SelectedValue.ToString())); MainV2.comPort.setParam("FLTMODE6", (float)Int32.Parse(CMB_fmode6.SelectedValue.ToString())); - if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2) // ac2 + if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduCopter2) // ac2 { float value = (float)(CB_simple1.Checked ? (int)SimpleMode.Simple1 : 0) + (CB_simple2.Checked ? (int)SimpleMode.Simple2 : 0) + (CB_simple3.Checked ? (int)SimpleMode.Simple3 : 0) + (CB_simple4.Checked ? (int)SimpleMode.Simple4 : 0) + (CB_simple5.Checked ? (int)SimpleMode.Simple5 : 0) + (CB_simple6.Checked ? (int)SimpleMode.Simple6 : 0); - if (MainV2.comPort.param.ContainsKey("SIMPLE")) + if (MainV2.comPort.MAV.param.ContainsKey("SIMPLE")) MainV2.comPort.setParam("SIMPLE", value); } } @@ -131,7 +131,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView public void Activate() { - if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane) // APM + if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduPlane) // APM { CB_simple1.Visible = false; CB_simple2.Visible = false; @@ -168,17 +168,17 @@ namespace ArdupilotMega.GCSViews.ConfigurationView try { - CMB_fmode1.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.param["FLTMODE1"].ToString())); - CMB_fmode2.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.param["FLTMODE2"].ToString())); - CMB_fmode3.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.param["FLTMODE3"].ToString())); - CMB_fmode4.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.param["FLTMODE4"].ToString())); - CMB_fmode5.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.param["FLTMODE5"].ToString())); + CMB_fmode1.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.MAV.param["FLTMODE1"].ToString())); + CMB_fmode2.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.MAV.param["FLTMODE2"].ToString())); + CMB_fmode3.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.MAV.param["FLTMODE3"].ToString())); + CMB_fmode4.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.MAV.param["FLTMODE4"].ToString())); + CMB_fmode5.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.apmmodes), MainV2.comPort.MAV.param["FLTMODE5"].ToString())); CMB_fmode6.Text = Common.apmmodes.MANUAL.ToString(); CMB_fmode6.Enabled = false; } catch { } } - else if (MainV2.cs.firmware == MainV2.Firmwares.ArduRover) // APM + else if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduRover) // APM { CB_simple1.Visible = false; CB_simple2.Visible = false; @@ -215,16 +215,16 @@ namespace ArdupilotMega.GCSViews.ConfigurationView try { - CMB_fmode1.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.param["FLTMODE1"].ToString())); - CMB_fmode2.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.param["FLTMODE2"].ToString())); - CMB_fmode3.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.param["FLTMODE3"].ToString())); - CMB_fmode4.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.param["FLTMODE4"].ToString())); - CMB_fmode5.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.param["FLTMODE5"].ToString())); + CMB_fmode1.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.MAV.param["FLTMODE1"].ToString())); + CMB_fmode2.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.MAV.param["FLTMODE2"].ToString())); + CMB_fmode3.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.MAV.param["FLTMODE3"].ToString())); + CMB_fmode4.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.MAV.param["FLTMODE4"].ToString())); + CMB_fmode5.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.aprovermodes), MainV2.comPort.MAV.param["FLTMODE5"].ToString())); CMB_fmode6.Text = Common.aprovermodes.MANUAL.ToString(); CMB_fmode6.Enabled = false; } catch { } - } else if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2) // ac2 + } else if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduCopter2) // ac2 { var flightModes = EnumTranslator.Translate(); @@ -254,15 +254,15 @@ namespace ArdupilotMega.GCSViews.ConfigurationView try { - CMB_fmode1.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.param["FLTMODE1"].ToString())); - CMB_fmode2.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.param["FLTMODE2"].ToString())); - CMB_fmode3.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.param["FLTMODE3"].ToString())); - CMB_fmode4.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.param["FLTMODE4"].ToString())); - CMB_fmode5.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.param["FLTMODE5"].ToString())); - CMB_fmode6.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.param["FLTMODE6"].ToString())); + CMB_fmode1.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.MAV.param["FLTMODE1"].ToString())); + CMB_fmode2.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.MAV.param["FLTMODE2"].ToString())); + CMB_fmode3.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.MAV.param["FLTMODE3"].ToString())); + CMB_fmode4.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.MAV.param["FLTMODE4"].ToString())); + CMB_fmode5.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.MAV.param["FLTMODE5"].ToString())); + CMB_fmode6.Text = EnumTranslator.GetDisplayText(Enum.Parse(typeof(Common.ac2modes), MainV2.comPort.MAV.param["FLTMODE6"].ToString())); CMB_fmode6.Enabled = true; - int simple = int.Parse(MainV2.comPort.param["SIMPLE"].ToString()); + int simple = int.Parse(MainV2.comPort.MAV.param["SIMPLE"].ToString()); CB_simple1.Checked = ((simple >> 0 & 1) == 1); CB_simple2.Checked = ((simple >> 1 & 1) == 1); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFriendlyParams.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFriendlyParams.cs index 657253aa1d..0eb4058204 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFriendlyParams.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFriendlyParams.cs @@ -158,7 +158,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView _params.Clear(); // When the parameter list is changed, re sort the list for our View's purposes - MainV2.comPort.param.Keys.ForEach(x => + MainV2.comPort.MAV.param.Keys.ForEach(x => { string displayName = _parameterMetaDataRepository.GetParameterMetaData(x.ToString(), ParameterMetaDataConstants.DisplayName); string parameterMode = _parameterMetaDataRepository.GetParameterMetaData(x.ToString(), ParameterMetaDataConstants.User); @@ -216,7 +216,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView { bool controlAdded = false; - string value = ((float)MainV2.comPort.param[x.Key]).ToString("0.###", CultureInfo.InvariantCulture); + string value = ((float)MainV2.comPort.MAV.param[x.Key]).ToString("0.###", CultureInfo.InvariantCulture); string description = _parameterMetaDataRepository.GetParameterMetaData(x.Key, ParameterMetaDataConstants.Description); string displayName = x.Value + " (" + x.Key + ")"; string units = _parameterMetaDataRepository.GetParameterMetaData(x.Key, ParameterMetaDataConstants.Units); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.cs index 8e89372292..0bfcd406de 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.cs @@ -29,9 +29,9 @@ namespace ArdupilotMega.GCSViews.ConfigurationView List> data = new List>(); // backup current rate and set to 10 hz - byte backupratesens = MainV2.cs.ratesensors; - MainV2.cs.ratesensors = 10; - MainV2.comPort.requestDatastream((byte)MAVLink.MAV_DATA_STREAM.RAW_SENSORS, MainV2.cs.ratesensors); // mag captures at 10 hz + byte backupratesens = MainV2.comPort.MAV.cs.ratesensors; + MainV2.comPort.MAV.cs.ratesensors = 10; + MainV2.comPort.requestDatastream((byte)MAVLink.MAV_DATA_STREAM.RAW_SENSORS, MainV2.comPort.MAV.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"); @@ -46,24 +46,24 @@ namespace ArdupilotMega.GCSViews.ConfigurationView // dont let the gui hang Application.DoEvents(); - if (oldmx != MainV2.cs.mx && - oldmy != MainV2.cs.my && - oldmz != MainV2.cs.mz) + if (oldmx != MainV2.comPort.MAV.cs.mx && + oldmy != MainV2.comPort.MAV.cs.my && + oldmz != MainV2.comPort.MAV.cs.mz) { data.Add(new Tuple( - 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)); + MainV2.comPort.MAV.cs.mx - (float)MainV2.comPort.MAV.cs.mag_ofs_x, + MainV2.comPort.MAV.cs.my - (float)MainV2.comPort.MAV.cs.mag_ofs_y, + MainV2.comPort.MAV.cs.mz - (float)MainV2.comPort.MAV.cs.mag_ofs_z)); - oldmx = MainV2.cs.mx; - oldmy = MainV2.cs.my; - oldmz = MainV2.cs.mz; + oldmx = MainV2.comPort.MAV.cs.mx; + oldmy = MainV2.comPort.MAV.cs.my; + oldmz = MainV2.comPort.MAV.cs.mz; } } // restore old sensor rate - MainV2.cs.ratesensors = backupratesens; - MainV2.comPort.requestDatastream((byte)MAVLink.MAV_DATA_STREAM.RAW_SENSORS, MainV2.cs.ratesensors); + MainV2.comPort.MAV.cs.ratesensors = backupratesens; + MainV2.comPort.requestDatastream((byte)MAVLink.MAV_DATA_STREAM.RAW_SENSORS, MainV2.comPort.MAV.cs.ratesensors); if (data.Count < 10) { @@ -98,7 +98,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView return; try { - if (MainV2.comPort.param["COMPASS_DEC"] == null) + if (MainV2.comPort.MAV.param["COMPASS_DEC"] == null) { CustomMessageBox.Show("Not Available"); } @@ -148,7 +148,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView return; try { - if (MainV2.comPort.param["MAG_ENABLE"] == null) + if (MainV2.comPort.MAV.param["MAG_ENABLE"] == null) { CustomMessageBox.Show("Not Available"); } @@ -166,7 +166,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView return; try { - if (MainV2.comPort.param["SONAR_ENABLE"] == null) + if (MainV2.comPort.MAV.param["SONAR_ENABLE"] == null) { CustomMessageBox.Show("Not Available"); } @@ -184,9 +184,9 @@ namespace ArdupilotMega.GCSViews.ConfigurationView return; try { - if (MainV2.comPort.param["ARSPD_ENABLE"] == null) + if (MainV2.comPort.MAV.param["ARSPD_ENABLE"] == null) { - CustomMessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString()); + CustomMessageBox.Show("Not Available on " + MainV2.comPort.MAV.cs.firmware.ToString()); } else { @@ -203,9 +203,9 @@ namespace ArdupilotMega.GCSViews.ConfigurationView return; try { - if (MainV2.comPort.param["FLOW_ENABLE"] == null) + if (MainV2.comPort.MAV.param["FLOW_ENABLE"] == null) { - CustomMessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString()); + CustomMessageBox.Show("Not Available on " + MainV2.comPort.MAV.cs.firmware.ToString()); } else { @@ -221,9 +221,9 @@ namespace ArdupilotMega.GCSViews.ConfigurationView return; try { - if (MainV2.comPort.param["SONAR_TYPE"] == null) + if (MainV2.comPort.MAV.param["SONAR_TYPE"] == null) { - CustomMessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString()); + CustomMessageBox.Show("Not Available on " + MainV2.comPort.MAV.cs.firmware.ToString()); } else { @@ -247,23 +247,23 @@ namespace ArdupilotMega.GCSViews.ConfigurationView startup = true; - CHK_airspeeduse.setup(1, 0, "ARSPD_USE", MainV2.comPort.param); - CHK_enableairspeed.setup(1, 0, "ARSPD_ENABLE", MainV2.comPort.param); - CHK_enablecompass.setup(1, 0, "MAG_ENABLE", MainV2.comPort.param, TXT_declination); - CHK_enableoptflow.setup(1,0,"FLOW_ENABLE", MainV2.comPort.param); - CHK_enablesonar.setup(1, 0, "SONAR_ENABLE", MainV2.comPort.param, CMB_sonartype); + CHK_airspeeduse.setup(1, 0, "ARSPD_USE", MainV2.comPort.MAV.param); + CHK_enableairspeed.setup(1, 0, "ARSPD_ENABLE", MainV2.comPort.MAV.param); + CHK_enablecompass.setup(1, 0, "MAG_ENABLE", MainV2.comPort.MAV.param, TXT_declination); + CHK_enableoptflow.setup(1,0,"FLOW_ENABLE", MainV2.comPort.MAV.param); + CHK_enablesonar.setup(1, 0, "SONAR_ENABLE", MainV2.comPort.MAV.param, CMB_sonartype); - if (MainV2.comPort.param["COMPASS_DEC"] != null) + if (MainV2.comPort.MAV.param["COMPASS_DEC"] != null) { - TXT_declination.Text = (float.Parse(MainV2.comPort.param["COMPASS_DEC"].ToString()) * rad2deg).ToString(); + TXT_declination.Text = (float.Parse(MainV2.comPort.MAV.param["COMPASS_DEC"].ToString()) * rad2deg).ToString(); } - if (MainV2.comPort.param["SONAR_TYPE"] != null) + if (MainV2.comPort.MAV.param["SONAR_TYPE"] != null) { - CMB_sonartype.SelectedIndex = int.Parse(MainV2.comPort.param["SONAR_TYPE"].ToString()); + CMB_sonartype.SelectedIndex = int.Parse(MainV2.comPort.MAV.param["SONAR_TYPE"].ToString()); } - if (MainV2.comPort.param["COMPASS_AUTODEC"] != null) + if (MainV2.comPort.MAV.param["COMPASS_AUTODEC"] != null) { - CHK_autodec.Checked = MainV2.comPort.param["COMPASS_AUTODEC"].ToString() == "1" ? true : false; + CHK_autodec.Checked = MainV2.comPort.MAV.param["COMPASS_AUTODEC"].ToString() == "1" ? true : false; } startup = false; @@ -295,9 +295,9 @@ namespace ArdupilotMega.GCSViews.ConfigurationView return; try { - if (MainV2.comPort.param["COMPASS_AUTODEC"] == null) + if (MainV2.comPort.MAV.param["COMPASS_AUTODEC"] == null) { - CustomMessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString()); + CustomMessageBox.Show("Not Available on " + MainV2.comPort.MAV.cs.firmware.ToString()); } else { diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigMount.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigMount.cs index 213235dd2c..8f9dfd6a3f 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigMount.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigMount.cs @@ -22,19 +22,14 @@ namespace ArdupilotMega.GCSViews.ConfigurationView public ConfigMount() { InitializeComponent(); - PBOX_WarningIcon.Opacity = 0.0F; - LBL_Error.Opacity = 0.0F; + var delay = new Transition(new TransitionType_Linear(2000)); var fadeIn = new Transition(new TransitionType_Linear(800)); - fadeIn.add(PBOX_WarningIcon, "Opacity", 1.0F); - fadeIn.add(LBL_Error, "Opacity", 1.0F); _ErrorTransition = new[] { delay, fadeIn }; _NoErrorTransition = new Transition(new TransitionType_Linear(10)); - _NoErrorTransition.add(PBOX_WarningIcon, "Opacity", 0.0F); - _NoErrorTransition.add(LBL_Error, "Opacity", 0.0F); //setup button actions foreach (var btn in Controls.Cast().OfType