diff --git a/ArduCopter/ArduCopter.pde b/ArduCopter/ArduCopter.pde index 6e9037014d..e0d90e3cbe 100644 --- a/ArduCopter/ArduCopter.pde +++ b/ArduCopter/ArduCopter.pde @@ -235,6 +235,7 @@ AP_TimerProcess timer_scheduler; AP_DCM_HIL dcm; AP_GPS_HIL g_gps_driver(NULL); AP_Compass_HIL compass; // never used + AP_Baro_BMP085_HIL barometer; AP_IMU_Shim imu; // never used AP_InertialSensor_Stub ins; AP_PeriodicProcessStub timer_scheduler; diff --git a/ArduPlane/ArduPlane.pde b/ArduPlane/ArduPlane.pde index f2dbcb7bbb..555a214ea3 100644 --- a/ArduPlane/ArduPlane.pde +++ b/ArduPlane/ArduPlane.pde @@ -203,6 +203,7 @@ AP_DCM_HIL dcm; AP_GPS_HIL g_gps_driver(NULL); AP_Compass_HIL compass; // never used AP_IMU_Shim imu; // never used +AP_Baro_BMP085_HIL barometer; #else #error Unrecognised HIL_MODE setting. diff --git a/ArduPlane/GCS_Mavlink.pde b/ArduPlane/GCS_Mavlink.pde index 3bf8642db8..dbfbe7614c 100644 --- a/ArduPlane/GCS_Mavlink.pde +++ b/ArduPlane/GCS_Mavlink.pde @@ -420,7 +420,7 @@ static void NOINLINE send_vfr_hud(mavlink_channel_t chan) (float)airspeed / 100.0, (float)g_gps->ground_speed / 100.0, (dcm.yaw_sensor / 100) % 360, - (uint16_t)(100 * g.channel_throttle.norm_output()), + (uint16_t)(100 * (g.channel_throttle.norm_output() / 2.0 + 0.5)), // scale -1,1 to 0-100 current_loc.alt / 100.0, 0); } diff --git a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj index 0b97741b3f..93dc01bf8d 100644 --- a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj +++ b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj @@ -247,6 +247,12 @@ ImageLabel.cs + + Form + + + XorPlus.cs + Form @@ -420,6 +426,9 @@ ImageLabel.cs + + XorPlus.cs + Configuration.cs diff --git a/Tools/ArdupilotMegaPlanner/Controls/XorPlus.Designer.cs b/Tools/ArdupilotMegaPlanner/Controls/XorPlus.Designer.cs new file mode 100644 index 0000000000..2a14e1fe1f --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Controls/XorPlus.Designer.cs @@ -0,0 +1,112 @@ +namespace ArdupilotMega +{ + partial class XorPlus + { + /// + /// 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.label16 = new System.Windows.Forms.Label(); + this.label15 = new System.Windows.Forms.Label(); + this.pictureBoxQuadX = new System.Windows.Forms.PictureBox(); + this.pictureBoxQuad = new System.Windows.Forms.PictureBox(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuadX)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuad)).BeginInit(); + this.SuspendLayout(); + // + // label16 + // + this.label16.AutoSize = true; + this.label16.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label16.Location = new System.Drawing.Point(108, 211); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(192, 26); + this.label16.TabIndex = 11; + this.label16.Text = "NOTE: images are for presentation only\r\nwill work with hexa\'s etc"; + // + // label15 + // + this.label15.AutoSize = true; + this.label15.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label15.Location = new System.Drawing.Point(151, 2); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(102, 13); + this.label15.TabIndex = 10; + this.label15.Text = "Frame Setup (+ or x)"; + // + // pictureBoxQuadX + // + this.pictureBoxQuadX.Cursor = System.Windows.Forms.Cursors.Hand; + this.pictureBoxQuadX.Image = global::ArdupilotMega.Properties.Resources.quadx; + this.pictureBoxQuadX.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.pictureBoxQuadX.Location = new System.Drawing.Point(210, 18); + this.pictureBoxQuadX.Name = "pictureBoxQuadX"; + this.pictureBoxQuadX.Size = new System.Drawing.Size(190, 190); + this.pictureBoxQuadX.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBoxQuadX.TabIndex = 9; + this.pictureBoxQuadX.TabStop = false; + this.pictureBoxQuadX.Click += new System.EventHandler(this.pictureBoxQuadX_Click); + // + // pictureBoxQuad + // + this.pictureBoxQuad.Cursor = System.Windows.Forms.Cursors.Hand; + this.pictureBoxQuad.Image = global::ArdupilotMega.Properties.Resources.quad; + this.pictureBoxQuad.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.pictureBoxQuad.Location = new System.Drawing.Point(3, 18); + this.pictureBoxQuad.Name = "pictureBoxQuad"; + this.pictureBoxQuad.Size = new System.Drawing.Size(190, 190); + this.pictureBoxQuad.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBoxQuad.TabIndex = 8; + this.pictureBoxQuad.TabStop = false; + this.pictureBoxQuad.Click += new System.EventHandler(this.pictureBoxQuad_Click); + // + // XorPlus + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(404, 242); + this.Controls.Add(this.label16); + this.Controls.Add(this.label15); + this.Controls.Add(this.pictureBoxQuadX); + this.Controls.Add(this.pictureBoxQuad); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "XorPlus"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Frame Type"; + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuadX)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuad)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.PictureBox pictureBoxQuadX; + private System.Windows.Forms.PictureBox pictureBoxQuad; + } +} diff --git a/Tools/ArdupilotMegaPlanner/Controls/XorPlus.cs b/Tools/ArdupilotMegaPlanner/Controls/XorPlus.cs new file mode 100644 index 0000000000..98808fe432 --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Controls/XorPlus.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace ArdupilotMega +{ + public partial class XorPlus : Form + { + public new event EventHandler Click; + + /// + /// either X or + + /// + public string frame = ""; + + public XorPlus() + { + InitializeComponent(); + } + + private void pictureBoxQuad_Click(object sender, EventArgs e) + { + frame = "+"; + if (Click != null) + { + Click(sender, new EventArgs()); + } + + this.Close(); + } + + private void pictureBoxQuadX_Click(object sender, EventArgs e) + { + frame = "X"; + if (Click != null) + { + Click(sender, new EventArgs()); + } + + this.Close(); + } + } +} diff --git a/Tools/ArdupilotMegaPlanner/Controls/XorPlus.resx b/Tools/ArdupilotMegaPlanner/Controls/XorPlus.resx new file mode 100644 index 0000000000..7080a7d118 --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Controls/XorPlus.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/Firmware/firmware2.xml b/Tools/ArdupilotMegaPlanner/Firmware/firmware2.xml index f772467318..c93ea11515 100644 --- a/Tools/ArdupilotMegaPlanner/Firmware/firmware2.xml +++ b/Tools/ArdupilotMegaPlanner/Firmware/firmware2.xml @@ -79,7 +79,19 @@ http://meee146-planner.googlecode.com/git/Tools/ArdupilotMegaPlanner/Firmware/AC2-Hexa-1280.hex http://meee146-planner.googlecode.com/git/Tools/ArdupilotMegaPlanner/Firmware/AC2-Hexa-2560.hex http://meee146-planner.googlecode.com/git/Tools/ArdupilotMegaPlanner/Firmware/AC2-Hexa-2560-2.hex - ArduCopter V2.2 b2 Hexa + ArduCopter V2.2 b2 Hexa X + +#define FRAME_CONFIG HEXA_FRAME +#define FRAME_ORIENTATION X_FRAME + + + 113 + + + http://meee146-planner.googlecode.com/git/Tools/ArdupilotMegaPlanner/Firmware/AC2-Hexa-1280.hex + http://meee146-planner.googlecode.com/git/Tools/ArdupilotMegaPlanner/Firmware/AC2-Hexa-2560.hex + http://meee146-planner.googlecode.com/git/Tools/ArdupilotMegaPlanner/Firmware/AC2-Hexa-2560-2.hex + ArduCopter V2.2 b2 Hexa Plus #define FRAME_CONFIG HEXA_FRAME #define FRAME_ORIENTATION X_FRAME @@ -115,7 +127,19 @@ http://meee146-planner.googlecode.com/git/Tools/ArdupilotMegaPlanner/Firmware/AC2-Octa-1280.hex http://meee146-planner.googlecode.com/git/Tools/ArdupilotMegaPlanner/Firmware/AC2-Octa-2560.hex http://meee146-planner.googlecode.com/git/Tools/ArdupilotMegaPlanner/Firmware/AC2-Octa-2560-2.hex - ArduCopter V2.2 b2 Octa + ArduCopter V2.2 b2 Octa X + +#define FRAME_CONFIG OCTA_FRAME +#define FRAME_ORIENTATION X_FRAME + + + 113 + + + http://meee146-planner.googlecode.com/git/Tools/ArdupilotMegaPlanner/Firmware/AC2-Octa-1280.hex + http://meee146-planner.googlecode.com/git/Tools/ArdupilotMegaPlanner/Firmware/AC2-Octa-2560.hex + http://meee146-planner.googlecode.com/git/Tools/ArdupilotMegaPlanner/Firmware/AC2-Octa-2560-2.hex + ArduCopter V2.2 b2 Octa Plus #define FRAME_CONFIG OCTA_FRAME #define FRAME_ORIENTATION X_FRAME diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs index 388acb3c2c..7f61c9d4d0 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs @@ -410,7 +410,8 @@ namespace ArdupilotMega.GCSViews void findfirmware(string findwhat) { List items = new List(); - + + // build list foreach (software temp in softwares) { if (temp.url.ToLower().Contains(findwhat.ToLower())) @@ -419,12 +420,13 @@ namespace ArdupilotMega.GCSViews } } + // none found if (items.Count == 0) { MessageBox.Show("The requested firmware was not found."); return; } - else if (items.Count == 1) + 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); if (dr == System.Windows.Forms.DialogResult.Yes) @@ -433,18 +435,47 @@ namespace ArdupilotMega.GCSViews } return; } - else if (items.Count >= 2) + else if (items.Count == 2) { + XorPlus select = new XorPlus(); + MainV2.fixtheme(select); + select.ShowDialog(); + int a = 0; + + if (select.frame == "") + { + return; + } + foreach (software temp in items) { - DialogResult dr = MessageBox.Show("Are you sure you want to upload " + items[0].name + "?", "Continue", MessageBoxButtons.YesNo); - if (dr == System.Windows.Forms.DialogResult.Yes) + if (select.frame == "+" && temp.name.Contains("Plus")) { - update(items[0]); - return; + DialogResult dr = MessageBox.Show("Are you sure you want to upload " + items[a].name + "?", "Continue", MessageBoxButtons.YesNo); + if (dr == System.Windows.Forms.DialogResult.Yes) + { + update(items[a]); + return; + } } + 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); + if (dr == System.Windows.Forms.DialogResult.Yes) + { + update(items[a]); + return; + } + } + + a++; } } + else + { + MessageBox.Show("Something has gone wrong, to many firmware choices"); + return; + } } private void pictureBoxAPM_Click(object sender, EventArgs e) diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs index e5881f7a69..82526a1e9c 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs @@ -298,7 +298,14 @@ namespace ArdupilotMega.GCSViews // online verify height if (isonline && CHK_geheight.Checked) { - cell.Value = ((int)getGEAlt(lat, lng) + int.Parse(TXT_DefaultAlt.Text)).ToString(); + if (CHK_altmode.Checked) + { + cell.Value = ((int)getGEAlt(lat, lng) + int.Parse(TXT_DefaultAlt.Text)).ToString(); + } + else + { + cell.Value = ((int)getGEAlt(lat, lng) + int.Parse(TXT_DefaultAlt.Text) - float.Parse(TXT_homealt.Text)).ToString(); + } } else { @@ -475,7 +482,7 @@ namespace ArdupilotMega.GCSViews // map center center = new GMapMarkerCross(MainMap.Position); - //top.Markers.Add(center); + top.Markers.Add(center); MainMap.Zoom = 3; @@ -939,9 +946,11 @@ namespace ArdupilotMega.GCSViews /// private void writeKML() { + // quickadd is for when loading wps from eeprom or file, to prevent slow, loading times if (quickadd) return; + // this is to share the current mission with the data tab pointlist = new List(); System.Diagnostics.Debug.WriteLine(DateTime.Now); @@ -952,6 +961,7 @@ namespace ArdupilotMega.GCSViews objects.Markers.Clear(); } + // process and add home to the list string home; if (TXT_homealt.Text != "" && TXT_homelat.Text != "" && TXT_homelng.Text != "") { @@ -967,6 +977,7 @@ namespace ArdupilotMega.GCSViews home = ""; } + // setup for centerpoint calc etc. double avglat = 0; double avglong = 0; double maxlat = -180; @@ -986,6 +997,7 @@ namespace ArdupilotMega.GCSViews int usable = 0; + // number rows System.Threading.Thread t1 = new System.Threading.Thread(delegate() { // thread for updateing row numbers @@ -2965,7 +2977,7 @@ namespace ArdupilotMega.GCSViews if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane) { - routes.Markers.Add(new GMapMarkerPlane(currentloc, MainV2.cs.yaw, MainV2.cs.groundcourse, MainV2.cs.nav_bearing, MainV2.cs.target_bearing)); + routes.Markers.Add(new GMapMarkerPlane(currentloc, MainV2.cs.yaw, MainV2.cs.groundcourse, MainV2.cs.nav_bearing, MainV2.cs.target_bearing) { ToolTipText = MainV2.cs.alt.ToString("0"), ToolTipMode = MarkerTooltipMode.Always }); } else { diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs index f6bded10da..12701c737d 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs @@ -1328,7 +1328,7 @@ namespace ArdupilotMega.GCSViews roll_out = (float)MainV2.cs.hilch1 / rollgain; pitch_out = (float)MainV2.cs.hilch2 / pitchgain; - throttle_out = ((float)MainV2.cs.hilch3 + 5000) / throttlegain; + throttle_out = ((float)MainV2.cs.hilch3 / 2 + 5000) / throttlegain; rudder_out = (float)MainV2.cs.hilch4 / ruddergain; } diff --git a/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs b/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs index d0371afd9f..644567d505 100644 --- a/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs +++ b/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs @@ -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.23")] +[assembly: AssemblyFileVersion("1.1.24")] [assembly: NeutralResourcesLanguageAttribute("")] diff --git a/Tools/ArdupilotMegaPlanner/Setup/Setup.resx b/Tools/ArdupilotMegaPlanner/Setup/Setup.resx index 4e49f35f37..dc88bef1bc 100644 --- a/Tools/ArdupilotMegaPlanner/Setup/Setup.resx +++ b/Tools/ArdupilotMegaPlanner/Setup/Setup.resx @@ -256,7 +256,7 @@ 3 - 21, 340 + 21, 349 409, 42 @@ -286,7 +286,7 @@ NoControl - 287, 158 + 287, 154 66, 17 @@ -316,7 +316,7 @@ NoControl - 315, 310 + 315, 306 66, 17 @@ -346,7 +346,7 @@ NoControl - 71, 158 + 71, 154 66, 17 @@ -514,7 +514,7 @@ 9 - 143, 61 + 143, 57 47, 211 @@ -535,7 +535,7 @@ 10 - 359, 61 + 359, 57 47, 211 @@ -556,7 +556,7 @@ 11 - 21, 304 + 21, 300 288, 23 @@ -1563,33 +1563,6 @@ 2 - - Zoom - - - NoControl - - - 78, 271 - - - 75, 75 - - - 29 - - - pictureBox2 - - - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabHardware - - - 3 - True @@ -1618,7 +1591,7 @@ tabHardware - 4 + 3 NoControl @@ -1645,7 +1618,7 @@ tabHardware - 5 + 4 383, 57 @@ -1669,7 +1642,7 @@ tabHardware - 6 + 5 NoControl @@ -1696,7 +1669,7 @@ tabHardware - 7 + 6 NoControl @@ -1723,7 +1696,7 @@ tabHardware - 8 + 7 NoControl @@ -1750,6 +1723,33 @@ tabHardware + 8 + + + Zoom + + + NoControl + + + 78, 271 + + + 75, 75 + + + 29 + + + pictureBox2 + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabHardware + + 9 diff --git a/libraries/RC_Channel/RC_Channel.cpp b/libraries/RC_Channel/RC_Channel.cpp index 72577a7444..37f90e0cdc 100644 --- a/libraries/RC_Channel/RC_Channel.cpp +++ b/libraries/RC_Channel/RC_Channel.cpp @@ -248,10 +248,12 @@ RC_Channel::norm_input() float RC_Channel::norm_output() { + uint16_t mid = (radio_max + radio_min) / 2; + if(radio_out < radio_trim) - return (float)(radio_out - radio_trim) / (float)(radio_trim - radio_min); + return (float)(radio_out - mid) / (float)(mid - radio_min); else - return (float)(radio_out - radio_trim) / (float)(radio_max - radio_trim); + return (float)(radio_out - mid) / (float)(radio_max - mid); } void RC_Channel::set_apm_rc( APM_RC_Class * apm_rc )