diff --git a/.gitignore b/.gitignore
index cf27052c2dae133737281ae881a25d658c199d59..a8991d7ec6859433b50905c62f4b18bb532a6ae9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,8 @@ build
 /Tools/ArdupilotMegaPlanner/obj
 /Tools/ArdupilotMegaPlanner/resedit/bin
 /Tools/ArdupilotMegaPlanner/resedit/obj
+/Tools/ArdupilotMegaPlanner/wix/bin
+/Tools/ArdupilotMegaPlanner/wix/obj
 tags
 *.o
 .*.swp
@@ -24,3 +26,5 @@ tags
 mav.log
 mav.log.raw
 status.txt
+
+/Tools/ArdupilotMegaPlanner/Msi/upload.bat
\ No newline at end of file
diff --git a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj
index bd24ec452944fbf9815eac0ce2cab366c7885017..3f859b1805a7da557a0837b0ff71ef78f8f03452 100644
--- a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj
+++ b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj
@@ -80,7 +80,7 @@
     <ManifestKeyFile>ArdupilotMega_TemporaryKey.pfx</ManifestKeyFile>
   </PropertyGroup>
   <PropertyGroup>
-    <GenerateManifests>true</GenerateManifests>
+    <GenerateManifests>false</GenerateManifests>
   </PropertyGroup>
   <PropertyGroup>
     <SignManifests>false</SignManifests>
@@ -297,7 +297,7 @@
       <DependentUpon>ConfigTradHeli.cs</DependentUpon>
     </Compile>
     <Compile Include="GCSViews\ConfigurationView\Configuration.cs">
-      <SubType>UserControl</SubType>
+      <SubType>Form</SubType>
     </Compile>
     <Compile Include="GCSViews\ConfigurationView\Configuration.Designer.cs">
       <DependentUpon>Configuration.cs</DependentUpon>
@@ -939,6 +939,8 @@
     </None>
     <None Include="MAC\Info.plist" />
     <None Include="MAC\run.sh" />
+    <None Include="Msi\installer.bat" />
+    <None Include="Msi\installer.wxs" />
     <None Include="mykey.snk" />
     <None Include="Properties\app.manifest" />
     <None Include="Properties\DataSources\CurrentState.datasource" />
@@ -952,6 +954,9 @@
   </ItemGroup>
   <ItemGroup>
     <Content Include="apm2.ico" />
+    <Content Include="Driver\Arduino MEGA 2560.inf">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
     <Content Include="hud.html">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
       <SubType>Designer</SubType>
@@ -1049,7 +1054,8 @@
   <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
-    <PostBuildEvent>rem macos.bat</PostBuildEvent>
+    <PostBuildEvent>
+    </PostBuildEvent>
   </PropertyGroup>
   <PropertyGroup>
     <PreBuildEvent>
diff --git a/Tools/ArdupilotMegaPlanner/ArdupilotMega.sln b/Tools/ArdupilotMegaPlanner/ArdupilotMega.sln
index 8c86aa7b2d4c7b50e14ae3351dcada65bad60df1..54de868e9ec1ea3a0babdcb51a1bc5253e63f9d2 100644
--- a/Tools/ArdupilotMegaPlanner/ArdupilotMega.sln
+++ b/Tools/ArdupilotMegaPlanner/ArdupilotMega.sln
@@ -2,9 +2,14 @@
 Microsoft Visual Studio Solution File, Format Version 11.00
 # Visual C# Express 2010
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArdupilotMega", "ArdupilotMega.csproj", "{A2E22272-95FE-47B6-B050-9AE7E2055BF5}"
+	ProjectSection(ProjectDependencies) = postProject
+		{76374F95-C343-4ACC-B86F-7ECFDD668F46} = {76374F95-C343-4ACC-B86F-7ECFDD668F46}
+	EndProjectSection
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater", "Updater\Updater.csproj", "{E64A1A41-A5B0-458E-8284-BB63705354DA}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wix", "wix\wix.csproj", "{76374F95-C343-4ACC-B86F-7ECFDD668F46}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -41,6 +46,18 @@ Global
 		{E64A1A41-A5B0-458E-8284-BB63705354DA}.Release|Win32.ActiveCfg = Release|x86
 		{E64A1A41-A5B0-458E-8284-BB63705354DA}.Release|x86.ActiveCfg = Release|x86
 		{E64A1A41-A5B0-458E-8284-BB63705354DA}.Release|x86.Build.0 = Release|x86
+		{76374F95-C343-4ACC-B86F-7ECFDD668F46}.Debug|Any CPU.ActiveCfg = Debug|x86
+		{76374F95-C343-4ACC-B86F-7ECFDD668F46}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+		{76374F95-C343-4ACC-B86F-7ECFDD668F46}.Debug|Mixed Platforms.Build.0 = Debug|x86
+		{76374F95-C343-4ACC-B86F-7ECFDD668F46}.Debug|Win32.ActiveCfg = Debug|x86
+		{76374F95-C343-4ACC-B86F-7ECFDD668F46}.Debug|x86.ActiveCfg = Debug|x86
+		{76374F95-C343-4ACC-B86F-7ECFDD668F46}.Debug|x86.Build.0 = Debug|x86
+		{76374F95-C343-4ACC-B86F-7ECFDD668F46}.Release|Any CPU.ActiveCfg = Release|x86
+		{76374F95-C343-4ACC-B86F-7ECFDD668F46}.Release|Mixed Platforms.ActiveCfg = Release|x86
+		{76374F95-C343-4ACC-B86F-7ECFDD668F46}.Release|Mixed Platforms.Build.0 = Release|x86
+		{76374F95-C343-4ACC-B86F-7ECFDD668F46}.Release|Win32.ActiveCfg = Release|x86
+		{76374F95-C343-4ACC-B86F-7ECFDD668F46}.Release|x86.ActiveCfg = Release|x86
+		{76374F95-C343-4ACC-B86F-7ECFDD668F46}.Release|x86.Build.0 = Release|x86
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
diff --git a/Tools/ArdupilotMegaPlanner/Common.cs b/Tools/ArdupilotMegaPlanner/Common.cs
index 826ae2117d09289302abea1253ebf4665c1c7fe5..03e53b26baaace1fd07242f3630dd3b4c4cdc7d9 100644
--- a/Tools/ArdupilotMegaPlanner/Common.cs
+++ b/Tools/ArdupilotMegaPlanner/Common.cs
@@ -386,7 +386,8 @@ namespace ArdupilotMega
             CH6_ACRO_KP = 25,
             CH6_YAW_RATE_KD = 26,
             CH6_LOITER_KI = 27,
-            CH6_LOITER_RATE_KI = 28
+            CH6_LOITER_RATE_KI = 28,
+            CH6_STABILIZE_KD = 29
         }
 
 
diff --git a/Tools/ArdupilotMegaPlanner/CommsSerialPort.cs b/Tools/ArdupilotMegaPlanner/CommsSerialPort.cs
index ae5d6ef67752a09c2f497fa01dc8795e02b96fa3..2fe153f2898fefaed848b2008eaa3035423c6c6a 100644
--- a/Tools/ArdupilotMegaPlanner/CommsSerialPort.cs
+++ b/Tools/ArdupilotMegaPlanner/CommsSerialPort.cs
@@ -40,14 +40,14 @@ namespace ArdupilotMega
 
         public new static string[] GetPortNames()
         {
-            string[] monoDevs = new string[0];
+            List<string> allPorts = new List<string>();
 
             if (Directory.Exists("/dev/"))
             {
                 if (Directory.Exists("/dev/serial/by-id/"))
-                    monoDevs = Directory.GetFiles("/dev/serial/by-id/", "*");
-                monoDevs = Directory.GetFiles("/dev/", "*ACM*");
-                monoDevs = Directory.GetFiles("/dev/", "ttyUSB*");
+                    allPorts.AddRange(Directory.GetFiles("/dev/serial/by-id/", "*"));
+                allPorts.AddRange(Directory.GetFiles("/dev/", "ttyACM*"));
+                allPorts.AddRange(Directory.GetFiles("/dev/", "ttyUSB*"));
             }
 
             string[] ports = System.IO.Ports.SerialPort.GetPortNames()
@@ -55,12 +55,9 @@ namespace ArdupilotMega
             .Select(FixBlueToothPortNameBug)
             .ToArray();
 
-            string[] allPorts = new string[monoDevs.Length + ports.Length];
+            allPorts.AddRange(ports);
 
-            monoDevs.CopyTo(allPorts, 0);
-            ports.CopyTo(allPorts, monoDevs.Length);
-
-            return allPorts;
+            return allPorts.ToArray();
         }
 
 
diff --git a/Tools/ArdupilotMegaPlanner/Controls/BackstageView/BackstageView.Designer.cs b/Tools/ArdupilotMegaPlanner/Controls/BackstageView/BackstageView.Designer.cs
index 07546e1ac80bfd28f726043f6eaaa655735a6782..66d11286360422516a408a2a10e3f063da54a85a 100644
--- a/Tools/ArdupilotMegaPlanner/Controls/BackstageView/BackstageView.Designer.cs
+++ b/Tools/ArdupilotMegaPlanner/Controls/BackstageView/BackstageView.Designer.cs
@@ -29,7 +29,7 @@
         private void InitializeComponent()
         {
             this.pnlPages = new System.Windows.Forms.Panel();
-            this.pnlMenu = new BackStageViewMenuPanel();
+            this.pnlMenu = new ArdupilotMega.Controls.BackstageView.BackStageViewMenuPanel();
             this.SuspendLayout();
             // 
             // pnlPages
@@ -37,10 +37,10 @@
             this.pnlPages.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
             | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
-            this.pnlPages.Location = new System.Drawing.Point(147, 0);
+            this.pnlPages.Location = new System.Drawing.Point(150, 0);
             this.pnlPages.MinimumSize = new System.Drawing.Size(100, 0);
             this.pnlPages.Name = "pnlPages";
-            this.pnlPages.Size = new System.Drawing.Size(243, 189);
+            this.pnlPages.Size = new System.Drawing.Size(297, 192);
             this.pnlPages.TabIndex = 0;
             // 
             // pnlMenu
@@ -49,7 +49,7 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.pnlMenu.Location = new System.Drawing.Point(0, 0);
             this.pnlMenu.Name = "pnlMenu";
-            this.pnlMenu.Size = new System.Drawing.Size(150, 170);
+            this.pnlMenu.Size = new System.Drawing.Size(150, 192);
             this.pnlMenu.TabIndex = 1;
             // 
             // BackstageView
@@ -60,7 +60,7 @@
             this.Controls.Add(this.pnlMenu);
             this.Controls.Add(this.pnlPages);
             this.Name = "BackstageView";
-            this.Size = new System.Drawing.Size(393, 192);
+            this.Size = new System.Drawing.Size(448, 192);
             this.ResumeLayout(false);
 
         }
diff --git a/Tools/ArdupilotMegaPlanner/Controls/BackstageView/BackstageViewButton.cs b/Tools/ArdupilotMegaPlanner/Controls/BackstageView/BackstageViewButton.cs
index 7f384a5bcd68edcda0fca6f34a0cf337e66a069f..a68c3c94e71a7cc93f634418b556adbb9b1b3065 100644
--- a/Tools/ArdupilotMegaPlanner/Controls/BackstageView/BackstageViewButton.cs
+++ b/Tools/ArdupilotMegaPlanner/Controls/BackstageView/BackstageViewButton.cs
@@ -22,10 +22,18 @@ namespace ArdupilotMega.Controls.BackstageView
 
         public BackstageViewButton()
         {
+            this.SuspendLayout();
+
             SetStyle(ControlStyles.SupportsTransparentBackColor, true);
             SetStyle(ControlStyles.Opaque, true);
             SetStyle(ControlStyles.ResizeRedraw, true);
             this.BackColor = Color.Transparent;
+
+            this.Width = 100;
+            this.Height = 30;
+
+            
+            this.ResumeLayout(false);
         }
 
         /// <summary>
@@ -58,6 +66,15 @@ namespace ArdupilotMega.Controls.BackstageView
             this.Parent.Invalidate(rectangleToClient);
         }
 
+        protected override void OnPaintBackground(PaintEventArgs pevent)
+        {
+            base.OnPaintBackground(pevent);
+        }
+
+        protected override void OnResize(EventArgs e)
+        {
+            base.OnResize(e);
+        }
 
         protected override void OnPaint(PaintEventArgs pevent)
         {
diff --git a/Tools/ArdupilotMegaPlanner/Driver/Arduino MEGA 2560.inf b/Tools/ArdupilotMegaPlanner/Driver/Arduino MEGA 2560.inf
new file mode 100644
index 0000000000000000000000000000000000000000..7053f3b95f9f6863f3ed36c2238f334783e2ff99
--- /dev/null
+++ b/Tools/ArdupilotMegaPlanner/Driver/Arduino MEGA 2560.inf	
@@ -0,0 +1,106 @@
+;************************************************************
+; Windows USB CDC ACM Setup File
+; Copyright (c) 2000 Microsoft Corporation
+
+
+[Version]
+Signature="$Windows NT$"
+Class=Ports
+ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
+Provider=%MFGNAME%
+LayoutFile=layout.inf
+CatalogFile=%MFGFILENAME%.cat
+DriverVer=11/15/2007,5.1.2600.0
+
+[Manufacturer]
+%MFGNAME%=DeviceList, NTamd64
+
+[DestinationDirs]
+DefaultDestDir=12
+
+
+;------------------------------------------------------------------------------
+;  Windows 2000/XP/Vista-32bit Sections
+;------------------------------------------------------------------------------
+
+[DriverInstall.nt]
+include=mdmcpq.inf
+CopyFiles=DriverCopyFiles.nt
+AddReg=DriverInstall.nt.AddReg
+
+[DriverCopyFiles.nt]
+usbser.sys,,,0x20
+
+[DriverInstall.nt.AddReg]
+HKR,,DevLoader,,*ntkern
+HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
+HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
+
+[DriverInstall.nt.Services]
+AddService=usbser, 0x00000002, DriverService.nt
+
+[DriverService.nt]
+DisplayName=%SERVICE%
+ServiceType=1
+StartType=3
+ErrorControl=1
+ServiceBinary=%12%\%DRIVERFILENAME%.sys
+
+;------------------------------------------------------------------------------
+;  Vista-64bit Sections
+;------------------------------------------------------------------------------
+
+[DriverInstall.NTamd64]
+include=mdmcpq.inf
+CopyFiles=DriverCopyFiles.NTamd64
+AddReg=DriverInstall.NTamd64.AddReg
+
+[DriverCopyFiles.NTamd64]
+%DRIVERFILENAME%.sys,,,0x20
+
+[DriverInstall.NTamd64.AddReg]
+HKR,,DevLoader,,*ntkern
+HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
+HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
+
+[DriverInstall.NTamd64.Services]
+AddService=usbser, 0x00000002, DriverService.NTamd64
+
+[DriverService.NTamd64]
+DisplayName=%SERVICE%
+ServiceType=1
+StartType=3
+ErrorControl=1
+ServiceBinary=%12%\%DRIVERFILENAME%.sys
+
+
+;------------------------------------------------------------------------------
+;  Vendor and Product ID Definitions
+;------------------------------------------------------------------------------
+; When developing your USB device, the VID and PID used in the PC side
+; application program and the firmware on the microcontroller must match.
+; Modify the below line to use your VID and PID.  Use the format as shown below.
+; Note: One INF file can be used for multiple devices with different VID and PIDs.
+; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
+;------------------------------------------------------------------------------
+[SourceDisksFiles]
+[SourceDisksNames]
+[DeviceList]
+%DESCRIPTION%=DriverInstall, USB\VID_2341&PID_0010
+
+[DeviceList.NTamd64]
+%DESCRIPTION%=DriverInstall, USB\VID_2341&PID_0010
+
+
+;------------------------------------------------------------------------------
+;  String Definitions
+;------------------------------------------------------------------------------
+;Modify these strings to customize your device
+;------------------------------------------------------------------------------
+[Strings]
+MFGFILENAME="CDC_vista"
+DRIVERFILENAME ="usbser"
+MFGNAME="Arduino LLC (www.arduino.cc)"
+INSTDISK="Arduino Mega 2560 Driver Installer"
+DESCRIPTION="Arduino Mega 2560"
+SERVICE="USB RS-232 Emulation Driver"
\ No newline at end of file
diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs
index 853d0d4ca1e0580a8b998d0b3822441514e31d43..a05f045ad80e8d90b02a31260b9ba3c1876c4891 100644
--- a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs
+++ b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs
@@ -593,29 +593,11 @@ namespace ArdupilotMega.GCSViews
             DialogResult dr = ofd.ShowDialog();
             if (dr == DialogResult.OK)
             {
-                StreamReader sr = new StreamReader(ofd.OpenFile());
-                while (!sr.EndOfStream)
-                {
-                    string line = sr.ReadLine();
-
-                    if (line.Contains("NOTE:"))
-                        CustomMessageBox.Show(line, "Saved Note");
-
-                    int index = line.IndexOf(',');
-
-                    int index2 = line.IndexOf(',', index + 1);
-
-                    if (index == -1)
-                        continue;
-
-                    if (index2 != -1)
-                        line = line.Replace(',', '.');
-
-                    string name = line.Substring(0, index);
-                    float value = float.Parse(line.Substring(index + 1), new System.Globalization.CultureInfo("en-US"));
-
-                    MAVLink.modifyParamForDisplay(true, name, ref value);
+                Hashtable param2 = loadParamFile(ofd.FileName);
 
+                foreach (string name in param2.Keys)
+                {
+                    string value = param2[name].ToString();
                     // set param table as well
                     foreach (DataGridViewRow row in Params.Rows)
                     {
@@ -647,7 +629,6 @@ namespace ArdupilotMega.GCSViews
                         }
                     }
                 }
-                sr.Close();
             }
         }
 
@@ -1125,39 +1106,65 @@ namespace ArdupilotMega.GCSViews
             DialogResult dr = ofd.ShowDialog();
             if (dr == DialogResult.OK)
             {
-                StreamReader sr = new StreamReader(ofd.OpenFile());
-                while (!sr.EndOfStream)
-                {
-                    string line = sr.ReadLine();
+                param2 = loadParamFile(ofd.FileName);
 
-                    if (line.Contains("NOTE:"))
-                        CustomMessageBox.Show(line, "Saved Note");
+                ParamCompare temp = new ParamCompare(this, param, param2);
+                ThemeManager.ApplyThemeTo(temp);
+                temp.ShowDialog();
+            }
+        }
 
-                    int index = line.IndexOf(',');
+        Hashtable loadParamFile(string Filename)
+        {
+            Hashtable param = new Hashtable();
 
-                    if (index == -1)
-                        continue;
+            StreamReader sr = new StreamReader(Filename);
+            while (!sr.EndOfStream)
+            {
+                string line = sr.ReadLine();
 
-                    string name = line.Substring(0, index);
-                    float value = float.Parse(line.Substring(index + 1), new System.Globalization.CultureInfo("en-US"));
+                if (line.Contains("NOTE:"))
+                    CustomMessageBox.Show(line, "Saved Note");
 
-                    MAVLink.modifyParamForDisplay(true, name, ref value);
+                if (line.StartsWith("#"))
+                    continue;
 
-                    if (name == "SYSID_SW_MREV")
-                        continue;
-                    if (name == "WP_TOTAL")
-                        continue;
-                    if (name == "CMD_TOTAL")
-                        continue;
+                string[] items = line.Split(new char[] {' ', ',', '\t' },StringSplitOptions.RemoveEmptyEntries);
 
-                    param2[name] = value;
-                }
-                sr.Close();
+                if (items.Length != 2)
+                    continue;
 
-                ParamCompare temp = new ParamCompare(this, param, param2);
-                ThemeManager.ApplyThemeTo(temp);
-                temp.ShowDialog();
+                string name = items[0];
+                float value = float.Parse(items[1], new System.Globalization.CultureInfo("en-US"));
+
+                MAVLink.modifyParamForDisplay(true, name, ref value);
+
+                if (name == "SYSID_SW_MREV")
+                    continue;
+                if (name == "WP_TOTAL")
+                    continue;
+                if (name == "CMD_TOTAL")
+                    continue;
+                if (name == "FENCE_TOTAL")
+                    continue;
+                if (name == "SYS_NUM_RESETS")
+                    continue;
+                if (name == "ARSPD_OFFSET")
+                    continue;
+                if (name == "GND_ABS_PRESS")
+                    continue;
+                if (name == "GND_TEMP")
+                    continue;
+                if (name == "CMD_INDEX")
+                    continue;
+                if (name == "LOG_LASTFILE")
+                    continue;
+
+                param[name] = value;
             }
+            sr.Close();
+
+            return param;
         }
 
         private void CHK_GDIPlus_CheckedChanged(object sender, EventArgs e)
diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs
index f28305e452d877a96d791674077c94f233422fb9..0310e66b2f600932f395af599f7218f64e7c7efd 100644
--- a/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs
+++ b/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs
@@ -49,6 +49,10 @@ namespace ArdupilotMega.GCSViews
         int simPort = 49000;
         int recvPort = 49005;
 
+        // gps buffer
+        int gpsbufferindex = 0;
+        ArdupilotMega.MAVLink.__mavlink_gps_raw_t[] gpsbuffer = new MAVLink.__mavlink_gps_raw_t[2];
+
         // set defaults
         int rollgain = 10000;
         int pitchgain = 10000;
@@ -1256,7 +1260,13 @@ namespace ArdupilotMega.GCSViews
             {
                 lastgpsupdate = DateTime.Now;
 
-                comPort.sendPacket(gps);
+                // save current fix = 3
+                gpsbuffer[gpsbufferindex % gpsbuffer.Length] = gps;
+
+                // return buffer index + 5 = (3 + 5) = 8 % 6 = 2
+                comPort.sendPacket(gpsbuffer[(gpsbufferindex + (gpsbuffer.Length - 1)) % gpsbuffer.Length]);
+
+                gpsbufferindex++;
             }
 #endif
         }
diff --git a/Tools/ArdupilotMegaPlanner/MAVLink.cs b/Tools/ArdupilotMegaPlanner/MAVLink.cs
index 8299c9e585f054c86495ab3dae968b443e00fb6f..380303e23920495019c77e8ea9a04b6079a18f79 100644
--- a/Tools/ArdupilotMegaPlanner/MAVLink.cs
+++ b/Tools/ArdupilotMegaPlanner/MAVLink.cs
@@ -2031,8 +2031,9 @@ namespace ArdupilotMega
                             }
                         }
                     }
-                    catch (Exception e) { log.Info("MAVLink readpacket read error: " + e.Message); break; }
+                    catch (Exception e) { log.Info("MAVLink readpacket read error: " + e.ToString()); break; }
 
+                    // check if looks like a mavlink packet and check for exclusions and write to console
                     if (temp[0] != 254 && temp[0] != 'U' || lastbad[0] == 'I' && lastbad[1] == 'M' || lastbad[1] == 'G' || lastbad[1] == 'A') // out of sync "AUTO" "GUIDED" "IMU"
                     {
                         if (temp[0] >= 0x20 && temp[0] <= 127 || temp[0] == '\n' || temp[0] == '\r')
@@ -2049,6 +2050,7 @@ namespace ArdupilotMega
                     // reset count on valid packet
                     readcount = 0;
 
+
                     if (temp[0] == 'U' || temp[0] == 254)
                     {
                         length = temp[1] + 6 + 2 - 2; // data + header + checksum - U - length
@@ -2058,8 +2060,13 @@ namespace ArdupilotMega
                             {
                                 if (sysid != temp[3] || compid != temp[4])
                                 {
-                                    log.InfoFormat("Mavlink Bad Packet (not addressed to this MAV) got {0} {1} vs {2} {3}", temp[3], temp[4], sysid, compid);
-                                    return new byte[0];
+                                    if (temp[3] == '3' && temp[4] == 'D')
+                                    {
+                                        // this is a 3dr radio rssi packet
+                                    } else {
+                                        log.InfoFormat("Mavlink Bad Packet (not addressed to this MAV) got {0} {1} vs {2} {3}", temp[3], temp[4], sysid, compid);
+                                        return new byte[0];
+                                    }
                                 }
                             }
 
@@ -2111,11 +2118,11 @@ namespace ArdupilotMega
             if (packetlosttimer.AddSeconds(10) < DateTime.Now)
             {
                 packetlosttimer = DateTime.Now;
-                packetslost = (int)(packetslost * 0.8f);
-                packetsnotlost = (int)(packetsnotlost * 0.8f);
+                packetslost = (packetslost * 0.8f);
+                packetsnotlost = (packetsnotlost * 0.8f);
             }
 
-            MainV2.cs.linkqualitygcs = (ushort)((packetsnotlost / (packetsnotlost + packetslost)) * 100);
+            MainV2.cs.linkqualitygcs = (ushort)((packetsnotlost / (packetsnotlost + packetslost)) * 100.0);
 
             if (bpstime.Second != DateTime.Now.Second && !logreadmode)
             {
@@ -2161,7 +2168,7 @@ namespace ArdupilotMega
 
             if (temp.Length < 5 || temp[temp.Length - 1] != (crc >> 8) || temp[temp.Length - 2] != (crc & 0xff))
             {
-                int packetno = 0;
+                int packetno = -1;
                 if (temp.Length > 5)
                 {
                     packetno = temp[5];
diff --git a/Tools/ArdupilotMegaPlanner/MainV2.cs b/Tools/ArdupilotMegaPlanner/MainV2.cs
index ecf883be8541077d8d8a6324c542bf03f6c7298e..6de12700b314dadd97822bcd9fcb67e0bb9363a1 100644
--- a/Tools/ArdupilotMegaPlanner/MainV2.cs
+++ b/Tools/ArdupilotMegaPlanner/MainV2.cs
@@ -23,6 +23,7 @@ using System.Net.Sockets;
 using IronPython.Hosting;
 using log4net;
 using ArdupilotMega.Controls;
+using System.Security.Cryptography;
 
 namespace ArdupilotMega
 {
@@ -1694,7 +1695,7 @@ namespace ArdupilotMega
 
                     if (fi.Length != response.ContentLength || response.Headers[HttpResponseHeader.ETag] != CurrentEtag)
                     {
-                        using (StreamWriter sw = new StreamWriter(path + ".etag"))
+                        using (StreamWriter sw = new StreamWriter(path + ".etag.new"))
                         {
                             sw.WriteLine(response.Headers[HttpResponseHeader.ETag]);
                             sw.Close();
@@ -1795,6 +1796,42 @@ namespace ArdupilotMega
 
         }
 
+
+
+        private string GetFileETag(string fileName, DateTime modifyDate)
+        {
+
+            string FileString;
+
+            System.Text.Encoder StringEncoder;
+
+            byte[] StringBytes;
+
+            MD5CryptoServiceProvider MD5Enc;
+
+            //use file name and modify date as the unique identifier
+
+            FileString = fileName + modifyDate.ToString("d", CultureInfo.InvariantCulture);
+
+            //get string bytes
+
+            StringEncoder = Encoding.UTF8.GetEncoder();
+
+            StringBytes = new byte[StringEncoder.GetByteCount(FileString.ToCharArray(), 0, FileString.Length, true)];
+
+            StringEncoder.GetBytes(FileString.ToCharArray(), 0, FileString.Length, StringBytes, 0, true);
+
+            //hash string using MD5 and return the hex-encoded hash
+
+            MD5Enc = new MD5CryptoServiceProvider();
+
+            byte[] hash = MD5Enc.ComputeHash((Stream)File.OpenRead(fileName));
+
+            return "\"" + BitConverter.ToString(hash).Replace("-", string.Empty) + "\"";
+
+        }
+
+
         protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
         {
             if (keyData == (Keys.Control | Keys.F))
@@ -1823,6 +1860,13 @@ namespace ArdupilotMega
                 frm.Show();
                 return true;
             }
+            if (keyData == (Keys.Control | Keys.W)) // test
+            {
+                Form frm = new GCSViews.ConfigurationView.Configuration();
+                ThemeManager.ApplyThemeTo(frm);
+                frm.Show();
+                return true;
+            }
             if (keyData == (Keys.Control | Keys.T)) // for override connect
             {
                 try
diff --git a/Tools/ArdupilotMegaPlanner/Msi/.gitignore b/Tools/ArdupilotMegaPlanner/Msi/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..197dac0b4840050d00324d31eb99667501657842
--- /dev/null
+++ b/Tools/ArdupilotMegaPlanner/Msi/.gitignore
@@ -0,0 +1,4 @@
+
+*.msi
+*.wixpdb
+*.wixobj
\ No newline at end of file
diff --git a/Tools/ArdupilotMegaPlanner/Msi/installer.bat b/Tools/ArdupilotMegaPlanner/Msi/installer.bat
new file mode 100644
index 0000000000000000000000000000000000000000..64a7b4d57c08af73d084881a3d5f2cc0bfc5f9ae
--- /dev/null
+++ b/Tools/ArdupilotMegaPlanner/Msi/installer.bat
@@ -0,0 +1,16 @@
+@echo off
+
+wix.exe ..\bin\release\
+
+del installer.wixobj
+
+"%wix%\bin\candle" installer.wxs -ext WiXNetFxExtension -ext WixDifxAppExtension -ext WixUIExtension.dll -ext WixUtilExtension
+
+
+"%wix%\bin\light" installer.wixobj "%wix%\bin\difxapp_x86.wixlib" -o APMPlannerx86.msi -ext WiXNetFxExtension -ext WixDifxAppExtension -ext WixUIExtension.dll -ext WixUtilExtension
+
+
+"%wix%\bin\light" installer.wixobj "%wix%\bin\difxapp_x64.wixlib" -o APMPlannerx64.msi -ext WiXNetFxExtension -ext WixDifxAppExtension -ext WixUIExtension.dll -ext WixUtilExtension
+
+
+pause
diff --git a/Tools/ArdupilotMegaPlanner/Msi/installer.wxs b/Tools/ArdupilotMegaPlanner/Msi/installer.wxs
new file mode 100644
index 0000000000000000000000000000000000000000..3b70d39505bd40c635b86e68b99da0eab83ad09e
--- /dev/null
+++ b/Tools/ArdupilotMegaPlanner/Msi/installer.wxs
@@ -0,0 +1,198 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension" xmlns:difx="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+
+    <Product Id="{625389D7-EB3C-4d77-A5F6-A285CF99437D}" Name="APM Planner" Language="1033" Version="1.1.60" Manufacturer="Michael Oborne" UpgradeCode="{625389D7-EB3C-4d77-A5F6-A285CF99437D}">
+        <Package Description="APM Planner Installer" Comments="Apm Planner Installer" Manufacturer="Michael Oborne" InstallerVersion="200" Compressed="yes" />
+
+<MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."/>
+
+
+        <PropertyRef Id="NETFRAMEWORK35" />
+
+        <Condition Message="This application requires .NET Framework 3.5. Please install the .NET Framework then run this installer again."><![CDATA[Installed OR NETFRAMEWORK35]]></Condition>
+
+        <Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
+
+        <Directory Id="TARGETDIR" Name="SourceDir">
+            <Directory Id="ProgramFilesFolder" Name="PFiles">
+                
+<Directory Id="APMPlanner" Name="APM Planner">
+<Component Id="InstallDirPermissions" Guid="{525389D7-EB3C-4d77-A5F6-A285CF99437D}" KeyPath="yes"> 
+                        <CreateFolder> 
+                            <Permission User="Everyone" GenericAll="yes" /> 
+                        </CreateFolder>
+                    </Component>
+<Component Id="_comp0" Guid="ac593651-82f6-4297-bb94-f8a233d91b6f">
+<File Id="_1" Source="..\bin\release\AeroSimRCAPMHil.zip" />
+<File Id="_2" Source="..\bin\release\alglibnet2.dll" />
+<File Id="_3" Source="..\bin\release\arducopter-xplane.zip" />
+<File Id="_4" Source="..\bin\release\ArdupilotMegaPlanner.exe" />
+<File Id="_5" Source="..\bin\release\ArdupilotMegaPlanner.exe.config" />
+<File Id="_6" Source="..\bin\release\ArdupilotMegaPlanner.pdb" />
+<File Id="_7" Source="..\bin\release\block_plane_0.dae" />
+<File Id="_8" Source="..\bin\release\BSE.Windows.Forms.dll" />
+<File Id="_9" Source="..\bin\release\Core.dll" />
+<File Id="_10" Source="..\bin\release\dataflashlog.xml" />
+<File Id="_11" Source="..\bin\release\DirectShowLib-2005.dll" />
+<File Id="_12" Source="..\bin\release\GMap.NET.Core.dll" />
+<File Id="_13" Source="..\bin\release\GMap.NET.WindowsForms.dll" />
+<File Id="_14" Source="..\bin\release\hud.html" />
+<File Id="_15" Source="..\bin\release\ICSharpCode.SharpZipLib.dll" />
+<File Id="_16" Source="..\bin\release\Ionic.Zip.Reduced.dll" />
+<File Id="_17" Source="..\bin\release\IronPython.dll" />
+<File Id="_18" Source="..\bin\release\IronPython.Modules.dll" />
+<File Id="_19" Source="..\bin\release\JSBSim.exe" />
+<File Id="_20" Source="..\bin\release\KMLib.dll" />
+<File Id="_21" Source="..\bin\release\log4net.dll" />
+<File Id="_22" Source="..\bin\release\mavcmd.xml" />
+<File Id="_23" Source="..\bin\release\MAVLink.xml" />
+<File Id="_24" Source="..\bin\release\MetaDataExtractor.dll" />
+<File Id="_25" Source="..\bin\release\Microsoft.Dynamic.dll" />
+<File Id="_26" Source="..\bin\release\Microsoft.Scripting.Core.dll" />
+<File Id="_27" Source="..\bin\release\Microsoft.Scripting.Debugging.dll" />
+<File Id="_28" Source="..\bin\release\Microsoft.Scripting.dll" />
+<File Id="_29" Source="..\bin\release\Microsoft.Scripting.ExtensionAttribute.dll" />
+<File Id="_30" Source="..\bin\release\netDxf.dll" />
+<File Id="_31" Source="..\bin\release\OpenTK.dll" />
+<File Id="_32" Source="..\bin\release\OpenTK.GLControl.dll" />
+<File Id="_33" Source="..\bin\release\quadhil.xml" />
+<File Id="_34" Source="..\bin\release\SharpKml.dll" />
+<File Id="_35" Source="..\bin\release\System.Data.SQLite.dll" />
+<File Id="_36" Source="..\bin\release\System.Speech.dll" />
+<File Id="_37" Source="..\bin\release\Updater.exe" />
+<File Id="_38" Source="..\bin\release\Updater.exe.config" />
+<File Id="_39" Source="..\bin\release\Updater.pdb" />
+<File Id="_40" Source="..\bin\release\ZedGraph.dll" />
+</Component>
+<Directory Id="Driver" Name="Driver">
+<Component Id="_comp40" Guid="2fdf06ca-6e78-41c1-a558-0b0970ef8cdd">
+<File Id="_41" Source="..\bin\release\Driver\Arduino MEGA 2560.inf" />
+</Component>
+</Directory>
+<Directory Id="es_ES" Name="es-ES">
+<Component Id="_comp41" Guid="7c2d0e6e-be62-414e-87d3-15c3408a6689">
+<File Id="_42" Source="..\bin\release\es-ES\ArdupilotMegaPlanner.resources.dll" />
+</Component>
+</Directory>
+<Directory Id="fr" Name="fr">
+<Component Id="_comp42" Guid="a96af704-563a-4606-902c-f5ada5f0e2e4">
+<File Id="_43" Source="..\bin\release\fr\ArdupilotMegaPlanner.resources.dll" />
+</Component>
+</Directory>
+<Directory Id="it_IT" Name="it-IT">
+<Component Id="_comp43" Guid="f25da795-c709-42ed-b395-68b30354db54">
+<File Id="_44" Source="..\bin\release\it-IT\ArdupilotMegaPlanner.resources.dll" />
+</Component>
+</Directory>
+<Directory Id="m3u" Name="m3u">
+<Component Id="_comp44" Guid="201b2c11-e385-4176-ba7f-cff62934e41f">
+<File Id="_45" Source="..\bin\release\m3u\both.m3u" />
+<File Id="_46" Source="..\bin\release\m3u\hud.m3u" />
+<File Id="_47" Source="..\bin\release\m3u\map.m3u" />
+<File Id="_48" Source="..\bin\release\m3u\networklink.kml" />
+</Component>
+</Directory>
+<Directory Id="pl" Name="pl">
+<Component Id="_comp48" Guid="91e14b63-64b9-43d5-9f3c-dc3eccac202f">
+<File Id="_49" Source="..\bin\release\pl\ArdupilotMegaPlanner.resources.dll" />
+</Component>
+</Directory>
+<Directory Id="Resources" Name="Resources">
+<Component Id="_comp49" Guid="16f71db5-f216-4ce9-8379-1c5d8e9cfc1a">
+<File Id="_50" Source="..\bin\release\Resources\MAVCmd.txt" />
+<File Id="_51" Source="..\bin\release\Resources\Welcome_to_Michael_Oborne.rtf" />
+</Component>
+</Directory>
+<Directory Id="ru_RU" Name="ru-RU">
+<Component Id="_comp51" Guid="41050916-508f-4f5e-b547-5374fe279b0f">
+<File Id="_52" Source="..\bin\release\ru-RU\ArdupilotMegaPlanner.resources.dll" />
+</Component>
+</Directory>
+<Directory Id="zh_Hans" Name="zh-Hans">
+<Component Id="_comp52" Guid="bbcbc38d-f1d3-4686-895d-9db643ac93aa">
+<File Id="_53" Source="..\bin\release\zh-Hans\ArdupilotMegaPlanner.resources.dll" />
+</Component>
+</Directory>
+<Directory Id="zh_TW" Name="zh-TW">
+<Component Id="_comp53" Guid="1abb66a4-ec2e-46a5-8ec7-df5ead6615ac">
+<File Id="_54" Source="..\bin\release\zh-TW\ArdupilotMegaPlanner.resources.dll" />
+</Component>
+</Directory>
+
+                    
+                    <Directory Id="drivers" Name="Drivers">
+                        <Component Id="MyDriver" Guid="{6AC8226E-A005-437e-A3CD-0FC32D9A346F}">
+                            <File Id="apm2inf"  Source="..\Driver\Arduino MEGA 2560.inf" />
+                            <difx:Driver AddRemovePrograms='no' Legacy="yes" PlugAndPlayPrompt="no" />
+                        </Component>
+                    </Directory>
+                </Directory>
+            </Directory>
+
+            <Directory Id="ProgramMenuFolder">
+                <Directory Id="ApplicationProgramsFolder" Name="APM Planner" />
+            </Directory>
+
+        </Directory>
+
+        <DirectoryRef Id="ApplicationProgramsFolder">
+            <Component Id="ApplicationShortcut" Guid="{8BC628BA-08A0-43d6-88C8-D4C007AC4607}">
+                <Shortcut Id="ApplicationStartMenuShortcut" Name="APM Planner" Description="Ardupilot Mega Planner" Target="[APMPlanner]ArdupilotMegaPlanner.exe" WorkingDirectory="APMPlanner" />
+                <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall" />
+
+                <Shortcut Id="UninstallProduct" Name="Uninstall APM Planner" Description="Uninstalls My Application" Target="[System64Folder]msiexec.exe" Arguments="/x [ProductCode]" />
+
+
+
+                <RegistryValue Root="HKCU" Key="Software\MichaelOborne\APMPlanner" Name="installed" Type="integer" Value="1" KeyPath="yes" />
+
+
+
+
+            </Component>
+        </DirectoryRef>
+
+
+        <Feature Id="MyFeature" Title="My 1st Feature" Level="1">
+            <ComponentRef Id="InstallDirPermissions" />
+
+<ComponentRef Id="_comp0" />
+<ComponentRef Id="_comp40" />
+<ComponentRef Id="_comp41" />
+<ComponentRef Id="_comp42" />
+<ComponentRef Id="_comp43" />
+<ComponentRef Id="_comp44" />
+<ComponentRef Id="_comp48" />
+<ComponentRef Id="_comp49" />
+<ComponentRef Id="_comp51" />
+<ComponentRef Id="_comp52" />
+<ComponentRef Id="_comp53" />
+
+            
+            <ComponentRef Id="ApplicationShortcut" />
+            <ComponentRef Id="MyDriver" />
+        </Feature>
+
+        
+            <!-- Step 2: Add UI to your installer / Step 4: Trigger the custom action -->
+    <Property Id="WIXUI_INSTALLDIR" Value="APMPlanner" />
+
+    <UI>
+        <UIRef Id="WixUI_InstallDir" />
+        <Publish Dialog="ExitDialog" 
+            Control="Finish" 
+            Event="DoAction" 
+            Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
+    </UI>
+    <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch APM Planner" />
+
+    <!-- Step 3: Include the custom action -->
+    <Property Id="WixShellExecTarget" Value="[#_4]" />
+    <CustomAction Id="LaunchApplication" 
+        BinaryKey="WixCA" 
+        DllEntry="WixShellExec"
+        Impersonate="yes" />
+    </Product>
+    
+</Wix>
diff --git a/Tools/ArdupilotMegaPlanner/Msi/originstaller.wxs b/Tools/ArdupilotMegaPlanner/Msi/originstaller.wxs
new file mode 100644
index 0000000000000000000000000000000000000000..111a7cbfd5f28eea3e55afcdd014e0572df9c063
--- /dev/null
+++ b/Tools/ArdupilotMegaPlanner/Msi/originstaller.wxs
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension" xmlns:difx="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+
+    <Product Id="{625389D7-EB3C-4d77-A5F6-A285CF99437D}" Name="APM Planner" Language="1033" Version="1.0.0.0" Manufacturer="Michael Oborne" UpgradeCode="{625389D7-EB3C-4d77-A5F6-A285CF99437D}">
+        <Package Description="APM Planner Installer" Comments="Apm Planner Installer" Manufacturer="Michael Oborne" InstallerVersion="200" Compressed="yes" />
+
+        <PropertyRef Id="NETFRAMEWORK35" />
+
+        <Condition Message="This application requires .NET Framework 3.5. Please install the .NET Framework then run this installer again."><![CDATA[Installed OR NETFRAMEWORK35]]></Condition>
+
+
+        <Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
+
+        <Directory Id="TARGETDIR" Name="SourceDir">
+            <Directory Id="ProgramFilesFolder" Name="PFiles">
+                <Directory Id="APMPlanner" Name="APM Planner">
+                    <Component Id="InstallDirPermissions" Guid="{525389D7-EB3C-4d77-A5F6-A285CF99437D}" KeyPath="yes"> 
+                        <CreateFolder> 
+                            <Permission User="Everyone" GenericAll="yes" /> 
+                        </CreateFolder>
+                    </Component> 
+                    <Component Id="Planner" Guid="{625389D7-EB3C-4d77-A5F6-A285CF99437D}">
+                    
+                        <File Id="gdbinit" Source=".gdbinit" />
+
+                        <File Id="alglibnet2dll" Source="alglibnet2.dll" />
+
+                        <File Id="ArdupilotMegaPlanner.exe" Source="ArdupilotMegaPlanner.exe">
+                            <netfx:NativeImage Id="ngen_ArdupilotMegaPlannerexe"/>
+                        </File>
+                        <File Id="ArdupilotMegaPlannerexeetag" Source="ArdupilotMegaPlanner.exe.etag" />
+                        <File Id="ArdupilotMegaPlannerexeconfig" Source="ArdupilotMegaPlanner.exe.config" />
+
+
+                        <File Id="ArdupilotMegaPlannerpdb" Source="ArdupilotMegaPlanner.pdb" />
+                   
+                        <File Id="block_plane_0dae" Source="block_plane_0.dae" />
+
+                        <File Id="BSEWindowsFormsdll" Source="BSE.Windows.Forms.dll" />
+
+                        <File Id="Coredll" Source="Core.dll" />
+
+                        <File Id="dataflashlogxml" Source="dataflashlog.xml" />
+
+                        <File Id="DirectShowLib2005dll" Source="DirectShowLib-2005.dll" />
+
+                        <File Id="GMapNETCoredll" Source="GMap.NET.Core.dll" />
+
+                        <File Id="GMapNETWindowsFormsdll" Source="GMap.NET.WindowsForms.dll" />
+
+                        <File Id="hudhtml" Source="hud.html" />
+
+                        <File Id="ICSharpCodeSharpZipLibdll" Source="ICSharpCode.SharpZipLib.dll" />
+
+                        <File Id="IonicZipReduceddll" Source="Ionic.Zip.Reduced.dll" />
+
+                        <File Id="IronPythondll" Source="IronPython.dll" />
+
+                        <File Id="IronPythonModulesdll" Source="IronPython.Modules.dll" />
+
+                        <File Id="KMLibdll" Source="KMLib.dll" />
+
+                        <File Id="log4netdll" Source="log4net.dll" />
+
+                        <File Id="mavcmdxml" Source="mavcmd.xml" />
+
+                        <File Id="MAVLinkxml" Source="MAVLink.xml" />
+
+                        <File Id="MetaDataExtractordll" Source="MetaDataExtractor.dll" />
+
+                        <File Id="MicrosoftDirectXDirectInputdll" Source="Microsoft.DirectX.DirectInput.dll" />
+
+                        <File Id="MicrosoftDirectXdll" Source="Microsoft.DirectX.dll" />
+
+                        <File Id="MicrosoftDynamicdll" Source="Microsoft.Dynamic.dll" />
+
+                        <File Id="MicrosoftScriptingCoredll" Source="Microsoft.Scripting.Core.dll" />
+
+                        <File Id="MicrosoftScriptingDebugging.dll" Source="Microsoft.Scripting.Debugging.dll" />
+
+                        <File Id="MicrosoftScriptingdll" Source="Microsoft.Scripting.dll" />
+
+                        <File Id="MicrosoftScriptingExtensionAttribute.dll" Source="Microsoft.Scripting.ExtensionAttribute.dll" />
+
+                        <File Id="netDxfdll" Source="netDxf.dll" />
+
+                        <File Id="OpenTKdll" Source="OpenTK.dll" />
+                        <File Id="OpenTKdllconfig" Source="OpenTK.dll.config" />
+
+
+                        <File Id="OpenTKGLControldll" Source="OpenTK.GLControl.dll" />
+
+                        <File Id="quadhilxml" Source="quadhil.xml" />
+
+                        <File Source="runme" />
+
+
+                        <File Id="SharpKmldll" Source="SharpKml.dll" />
+
+
+                        <File Id="SystemDataSQLitedll" Source="System.Data.SQLite.dll" />
+
+                        <File Id="SystemSpeechdll" Source="System.Speech.dll" />
+
+                        <File Id="Updaterexe" Source="Updater.exe" />
+                        <File Id="Updaterexeconfig" Source="Updater.exe.config" />
+
+
+                        <File Id="ZedGraphdll" Source="ZedGraph.dll" />
+
+                        <File Id="installerwxs" Source="installer.wxs" />
+                        <File Id="installerbat" Source="installer.bat" />
+
+
+                    </Component>
+                    
+                    <Directory Id="drivers" Name="Drivers">
+                        <Component Id="MyDriver" Guid="{6AC8226E-A005-437e-A3CD-0FC32D9A346F}">
+                            <File Id="apm2inf"  Source="Driver\Arduino MEGA 2560.inf" />
+                            <difx:Driver AddRemovePrograms='no' Legacy="yes" PlugAndPlayPrompt="no" />
+                        </Component>
+                    </Directory>
+                </Directory>
+            </Directory>
+
+            <Directory Id="ProgramMenuFolder">
+                <Directory Id="ApplicationProgramsFolder" Name="APM Planner" />
+            </Directory>
+
+        </Directory>
+
+        <DirectoryRef Id="ApplicationProgramsFolder">
+            <Component Id="ApplicationShortcut" Guid="{8BC628BA-08A0-43d6-88C8-D4C007AC4607}">
+                <Shortcut Id="ApplicationStartMenuShortcut" Name="APM Planner" Description="Ardupilot Mega Planner" Target="[APMPlanner]ArdupilotMegaPlanner.exe" WorkingDirectory="APMPlanner" />
+                <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall" />
+
+                <Shortcut Id="UninstallProduct" Name="Uninstall APM Planner" Description="Uninstalls My Application" Target="[System64Folder]msiexec.exe" Arguments="/x [ProductCode]" />
+
+
+
+                <RegistryValue Root="HKCU" Key="Software\MichaelOborne\APMPlanner" Name="installed" Type="integer" Value="1" KeyPath="yes" />
+
+
+
+
+            </Component>
+        </DirectoryRef>
+
+
+        <Feature Id="MyFeature" Title="My 1st Feature" Level="1">
+            <ComponentRef Id="InstallDirPermissions" />
+            <ComponentRef Id="Planner" />
+            <ComponentRef Id="ApplicationShortcut" />
+            <ComponentRef Id="MyDriver" />
+        </Feature>
+
+        
+            <!-- Step 2: Add UI to your installer / Step 4: Trigger the custom action -->
+    <UI>
+        <UIRef Id="WixUI_Minimal" />
+        <Publish Dialog="ExitDialog" 
+            Control="Finish" 
+            Event="DoAction" 
+            Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
+    </UI>
+    <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch APM Planner" />
+
+    <!-- Step 3: Include the custom action -->
+    <Property Id="WixShellExecTarget" Value="[#ArdupilotMegaPlanner.exe]" />
+    <CustomAction Id="LaunchApplication" 
+        BinaryKey="WixCA" 
+        DllEntry="WixShellExec"
+        Impersonate="yes" />
+    </Product>
+
+    
+    
+    
+</Wix>
diff --git a/Tools/ArdupilotMegaPlanner/Msi/wix.exe.config b/Tools/ArdupilotMegaPlanner/Msi/wix.exe.config
new file mode 100644
index 0000000000000000000000000000000000000000..e59af44de2ddb14170137575f1bb09790c6a877c
--- /dev/null
+++ b/Tools/ArdupilotMegaPlanner/Msi/wix.exe.config
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<configuration>
+<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
diff --git a/Tools/ArdupilotMegaPlanner/Msi/wix.pdb b/Tools/ArdupilotMegaPlanner/Msi/wix.pdb
new file mode 100644
index 0000000000000000000000000000000000000000..6dc9934ea7b74ecfbed52623defbbc9c6536421b
Binary files /dev/null and b/Tools/ArdupilotMegaPlanner/Msi/wix.pdb differ
diff --git a/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs b/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs
index f695ace3a65c85e666f5b1c6b51c3fd51bfeee53..c21a96831da78c53d52da9a374f15c7aa18ba1eb 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.59")]
+[assembly: AssemblyFileVersion("1.1.60")]
 [assembly: NeutralResourcesLanguageAttribute("")]
diff --git a/Tools/ArdupilotMegaPlanner/Properties/app.manifest b/Tools/ArdupilotMegaPlanner/Properties/app.manifest
index 177b7df33f9632204e2dad45e9322c4830afc9ae..8df620839827e7727f092f50d4160df7c02653f2 100644
--- a/Tools/ArdupilotMegaPlanner/Properties/app.manifest
+++ b/Tools/ArdupilotMegaPlanner/Properties/app.manifest
@@ -19,8 +19,8 @@
         <requestedExecutionLevel level="asInvoker" uiAccess="false" />
       </requestedPrivileges>
       <applicationRequestMinimum>
-        <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
         <defaultAssemblyRequest permissionSetReference="Custom" />
+        <PermissionSet class="System.Security.PermissionSet" version="1" ID="Custom" SameSite="site" Unrestricted="true" />
       </applicationRequestMinimum>
     </security>
   </trustInfo>
diff --git a/Tools/ArdupilotMegaPlanner/Radio/3DRradio.cs b/Tools/ArdupilotMegaPlanner/Radio/3DRradio.cs
index cd1791859a800521115439e054ae53283f6b9f2a..19d2f1f2013a0a42bbafeb2b07e2fb190a3572ba 100644
--- a/Tools/ArdupilotMegaPlanner/Radio/3DRradio.cs
+++ b/Tools/ArdupilotMegaPlanner/Radio/3DRradio.cs
@@ -75,7 +75,8 @@ namespace ArdupilotMega
                 uploader_LogEvent("In Bootloader Mode");
                 bootloadermode = true;
             }
-            catch {
+            catch
+            {
                 comPort.Close();
                 comPort.BaudRate = MainV2.comPort.BaseStream.BaudRate;
                 comPort.Open();
@@ -188,13 +189,14 @@ namespace ArdupilotMega
         {
             ArdupilotMega.ICommsSerial comPort = new SerialPort();
 
-            try {
-            comPort.PortName = MainV2.comPort.BaseStream.PortName;
-            comPort.BaudRate = MainV2.comPort.BaseStream.BaudRate;
+            try
+            {
+                comPort.PortName = MainV2.comPort.BaseStream.PortName;
+                comPort.BaudRate = MainV2.comPort.BaseStream.BaudRate;
 
-            comPort.ReadTimeout = 4000;
+                comPort.ReadTimeout = 4000;
 
-            comPort.Open();
+                comPort.Open();
 
 
             }
@@ -547,7 +549,7 @@ namespace ArdupilotMega
                 }
             }
 
-            Console.WriteLine("responce " + level + " " + ans.Replace('\0',' '));
+            Console.WriteLine("responce " + level + " " + ans.Replace('\0', ' '));
 
             // try again
             if (ans == "" && level == 0)
@@ -571,7 +573,7 @@ namespace ArdupilotMega
             // check for config responce "OK"
             Console.WriteLine("Connect btr " + comPort.BytesToRead + " baud " + comPort.BaudRate);
             string conn = comPort.ReadExisting();
-            Console.WriteLine("Connect first responce " + conn.Replace('\0',' ') + " " + conn.Length);
+            Console.WriteLine("Connect first responce " + conn.Replace('\0', ' ') + " " + conn.Length);
             if (conn.Contains("OK"))
             {
                 //return true;
diff --git a/Tools/ArdupilotMegaPlanner/Setup/Setup.cs b/Tools/ArdupilotMegaPlanner/Setup/Setup.cs
index 1bb21aee79f01b8b657f5be49c16ee146c3cf717..348c1cd0ce2c15259607ab484c8fb6a71900eb72 100644
--- a/Tools/ArdupilotMegaPlanner/Setup/Setup.cs
+++ b/Tools/ArdupilotMegaPlanner/Setup/Setup.cs
@@ -1719,8 +1719,7 @@ namespace ArdupilotMega.Setup
 #else
                 MainV2.comPort.doAction(MAVLink.MAV_ACTION.MAV_ACTION_CALIBRATE_ACC);
 #endif
-
-                BUT_levelac2.Text = "Complete";
+                BUT_levelplane.Text = "Complete";
             }
             catch
             {
diff --git a/Tools/ArdupilotMegaPlanner/bin/Release/.gitignore b/Tools/ArdupilotMegaPlanner/bin/Release/.gitignore
index 7ddb7730c77e4ce5e3ef87679be0104232a24485..de16b06a7a9e999c1b216d891d6459f4883c6a55 100644
--- a/Tools/ArdupilotMegaPlanner/bin/Release/.gitignore
+++ b/Tools/ArdupilotMegaPlanner/bin/Release/.gitignore
@@ -1,3 +1,4 @@
 *.pdb
 *.etag
-*.new
\ No newline at end of file
+*.new
+*.log
\ No newline at end of file
diff --git a/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.pdb b/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.pdb
index 3a1d3667b732364a3e9553cabf75239267dafc1b..bbb6da8b86018129116e28bd7c17a79bd7122a9f 100644
Binary files a/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.pdb and b/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.pdb differ
diff --git a/Tools/ArdupilotMegaPlanner/bin/Release/Driver/Arduino MEGA 2560.inf b/Tools/ArdupilotMegaPlanner/bin/Release/Driver/Arduino MEGA 2560.inf
new file mode 100644
index 0000000000000000000000000000000000000000..7053f3b95f9f6863f3ed36c2238f334783e2ff99
--- /dev/null
+++ b/Tools/ArdupilotMegaPlanner/bin/Release/Driver/Arduino MEGA 2560.inf	
@@ -0,0 +1,106 @@
+;************************************************************
+; Windows USB CDC ACM Setup File
+; Copyright (c) 2000 Microsoft Corporation
+
+
+[Version]
+Signature="$Windows NT$"
+Class=Ports
+ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
+Provider=%MFGNAME%
+LayoutFile=layout.inf
+CatalogFile=%MFGFILENAME%.cat
+DriverVer=11/15/2007,5.1.2600.0
+
+[Manufacturer]
+%MFGNAME%=DeviceList, NTamd64
+
+[DestinationDirs]
+DefaultDestDir=12
+
+
+;------------------------------------------------------------------------------
+;  Windows 2000/XP/Vista-32bit Sections
+;------------------------------------------------------------------------------
+
+[DriverInstall.nt]
+include=mdmcpq.inf
+CopyFiles=DriverCopyFiles.nt
+AddReg=DriverInstall.nt.AddReg
+
+[DriverCopyFiles.nt]
+usbser.sys,,,0x20
+
+[DriverInstall.nt.AddReg]
+HKR,,DevLoader,,*ntkern
+HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
+HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
+
+[DriverInstall.nt.Services]
+AddService=usbser, 0x00000002, DriverService.nt
+
+[DriverService.nt]
+DisplayName=%SERVICE%
+ServiceType=1
+StartType=3
+ErrorControl=1
+ServiceBinary=%12%\%DRIVERFILENAME%.sys
+
+;------------------------------------------------------------------------------
+;  Vista-64bit Sections
+;------------------------------------------------------------------------------
+
+[DriverInstall.NTamd64]
+include=mdmcpq.inf
+CopyFiles=DriverCopyFiles.NTamd64
+AddReg=DriverInstall.NTamd64.AddReg
+
+[DriverCopyFiles.NTamd64]
+%DRIVERFILENAME%.sys,,,0x20
+
+[DriverInstall.NTamd64.AddReg]
+HKR,,DevLoader,,*ntkern
+HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
+HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
+
+[DriverInstall.NTamd64.Services]
+AddService=usbser, 0x00000002, DriverService.NTamd64
+
+[DriverService.NTamd64]
+DisplayName=%SERVICE%
+ServiceType=1
+StartType=3
+ErrorControl=1
+ServiceBinary=%12%\%DRIVERFILENAME%.sys
+
+
+;------------------------------------------------------------------------------
+;  Vendor and Product ID Definitions
+;------------------------------------------------------------------------------
+; When developing your USB device, the VID and PID used in the PC side
+; application program and the firmware on the microcontroller must match.
+; Modify the below line to use your VID and PID.  Use the format as shown below.
+; Note: One INF file can be used for multiple devices with different VID and PIDs.
+; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
+;------------------------------------------------------------------------------
+[SourceDisksFiles]
+[SourceDisksNames]
+[DeviceList]
+%DESCRIPTION%=DriverInstall, USB\VID_2341&PID_0010
+
+[DeviceList.NTamd64]
+%DESCRIPTION%=DriverInstall, USB\VID_2341&PID_0010
+
+
+;------------------------------------------------------------------------------
+;  String Definitions
+;------------------------------------------------------------------------------
+;Modify these strings to customize your device
+;------------------------------------------------------------------------------
+[Strings]
+MFGFILENAME="CDC_vista"
+DRIVERFILENAME ="usbser"
+MFGNAME="Arduino LLC (www.arduino.cc)"
+INSTDISK="Arduino Mega 2560 Driver Installer"
+DESCRIPTION="Arduino Mega 2560"
+SERVICE="USB RS-232 Emulation Driver"
\ No newline at end of file
diff --git a/Tools/ArdupilotMegaPlanner/srtm.cs b/Tools/ArdupilotMegaPlanner/srtm.cs
index 7583ab71c3c743f79758761736899082343e3e6c..3a860c37eeb4a66494ea42c0bc68786c213f5e13 100644
--- a/Tools/ArdupilotMegaPlanner/srtm.cs
+++ b/Tools/ArdupilotMegaPlanner/srtm.cs
@@ -24,6 +24,9 @@ namespace ArdupilotMega
 
         public static int getAltitude(double lat, double lng, double zoom)
         {
+            if (!Directory.Exists(datadirectory))
+                Directory.CreateDirectory(datadirectory);
+
             short alt = 0;
 
             lat += 0.00083333333333333;
diff --git a/Tools/ArdupilotMegaPlanner/temp.Designer.cs b/Tools/ArdupilotMegaPlanner/temp.Designer.cs
index ec582ef476a5ae8ceb61e7bbfb6647b7274b5dcc..767443ebc44368746d1461e69fdd913df24fe8a2 100644
--- a/Tools/ArdupilotMegaPlanner/temp.Designer.cs
+++ b/Tools/ArdupilotMegaPlanner/temp.Designer.cs
@@ -198,7 +198,7 @@
             // 
             // BUT_lang_edit
             // 
-            this.BUT_lang_edit.Location = new System.Drawing.Point(365, 164);
+            this.BUT_lang_edit.Location = new System.Drawing.Point(323, 164);
             this.BUT_lang_edit.Name = "BUT_lang_edit";
             this.BUT_lang_edit.Size = new System.Drawing.Size(75, 23);
             this.BUT_lang_edit.TabIndex = 16;
@@ -208,7 +208,7 @@
             // 
             // BUT_georefimage
             // 
-            this.BUT_georefimage.Location = new System.Drawing.Point(263, 164);
+            this.BUT_georefimage.Location = new System.Drawing.Point(221, 164);
             this.BUT_georefimage.Name = "BUT_georefimage";
             this.BUT_georefimage.Size = new System.Drawing.Size(96, 23);
             this.BUT_georefimage.TabIndex = 0;
@@ -217,7 +217,7 @@
             // 
             // BUT_follow_me
             // 
-            this.BUT_follow_me.Location = new System.Drawing.Point(527, 164);
+            this.BUT_follow_me.Location = new System.Drawing.Point(485, 164);
             this.BUT_follow_me.Name = "BUT_follow_me";
             this.BUT_follow_me.Size = new System.Drawing.Size(75, 23);
             this.BUT_follow_me.TabIndex = 17;
@@ -227,7 +227,7 @@
             // 
             // BUT_ant_track
             // 
-            this.BUT_ant_track.Location = new System.Drawing.Point(446, 164);
+            this.BUT_ant_track.Location = new System.Drawing.Point(404, 164);
             this.BUT_ant_track.Name = "BUT_ant_track";
             this.BUT_ant_track.Size = new System.Drawing.Size(75, 23);
             this.BUT_ant_track.TabIndex = 18;
@@ -237,7 +237,7 @@
             // 
             // BUT_magcalib
             // 
-            this.BUT_magcalib.Location = new System.Drawing.Point(161, 164);
+            this.BUT_magcalib.Location = new System.Drawing.Point(119, 164);
             this.BUT_magcalib.Name = "BUT_magcalib";
             this.BUT_magcalib.Size = new System.Drawing.Size(96, 23);
             this.BUT_magcalib.TabIndex = 19;
diff --git a/Tools/ArdupilotMegaPlanner/temp.cs b/Tools/ArdupilotMegaPlanner/temp.cs
index fd5c9c8c08d66b43ec4d4d7208bfcddbe2a0d537..219e468aec1494758af7641678bde7e9e83903fa 100644
--- a/Tools/ArdupilotMegaPlanner/temp.cs
+++ b/Tools/ArdupilotMegaPlanner/temp.cs
@@ -15,10 +15,16 @@ using GMap.NET.WindowsForms;
 using GMap.NET.CacheProviders;
 using log4net;
 
+using System.Security.Permissions;
+
 namespace ArdupilotMega
 {
     public partial class temp : Form
     {
+        [DllImport("DIFXApi.dll", CharSet = CharSet.Unicode)]
+        public static extern Int32 DriverPackagePreinstall(string DriverPackageInfPath, Int32 Flags);
+
+
         private static readonly ILog log =
           LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
         public temp()
@@ -891,5 +897,13 @@ namespace ArdupilotMega
         {
             MagCalib.ProcessLog();
         }
+
+        void driverinstall()
+        {
+            int result = DriverPackagePreinstall(@"\Driver\XYZ.inf", 0);
+            if (result != 0)
+                MessageBox.Show("Driver installation failed.");
+
+        }
     }
 }
diff --git a/Tools/ArdupilotMegaPlanner/wix/Program.cs b/Tools/ArdupilotMegaPlanner/wix/Program.cs
new file mode 100644
index 0000000000000000000000000000000000000000..c08e4452dbd94408f667b5aa63521fb72de13e5f
--- /dev/null
+++ b/Tools/ArdupilotMegaPlanner/wix/Program.cs
@@ -0,0 +1,235 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+using System.Windows.Forms;
+using System.Diagnostics;
+
+namespace wix
+{
+    class Program
+    {
+        static int no = 0;
+
+        static StreamWriter sw;
+
+        static List<string> components = new List<string>();
+
+        static string mainexeid = "";
+
+        static void Main(string[] args)
+        {
+            if (args.Length == 0)
+            {
+                Console.WriteLine("Bad Directory");
+                return;
+            }
+
+            string path = args[0];
+
+            string file = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar+ "installer.wxs";
+
+            sw = new StreamWriter(file);
+
+            header();
+
+            sw.WriteLine("<Directory Id=\"APMPlanner\" Name=\"APM Planner\">");
+
+            sw.WriteLine(@"<Component Id=""InstallDirPermissions"" Guid=""{525389D7-EB3C-4d77-A5F6-A285CF99437D}"" KeyPath=""yes""> 
+                        <CreateFolder> 
+                            <Permission User=""Everyone"" GenericAll=""yes"" /> 
+                        </CreateFolder>
+                    </Component>");
+
+            //sw.WriteLine("<File Id=\"_" + no + "\" Source=\"" + file + "\" />");
+            
+
+            dodirectory(path, 0);
+
+
+            footer();
+
+            sw.Close();
+
+            /*
+            System.Diagnostics.Process P = new System.Diagnostics.Process();
+            P.StartInfo.FileName = "cmd.exe";
+                
+            P.StartInfo.Arguments =  " /c \"" + Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + "installer.bat\"";
+            P.StartInfo.WorkingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
+            P.Start();
+            */
+            //Console.ReadLine();
+        }
+
+        static void header()
+        {
+            string newid = System.Guid.NewGuid().ToString();
+
+            newid = "{625389D7-EB3C-4d77-A5F6-A285CF99437D}";
+
+            StreamReader sr = new StreamReader(File.OpenRead("../Properties/AssemblyInfo.cs"));
+
+            string version = "0";
+
+            while (!sr.EndOfStream) {
+                string line = sr.ReadLine();
+                if (line.Contains("AssemblyFileVersion"))
+                {
+                    string[] items = line.Split(new char[] { '"' },StringSplitOptions.RemoveEmptyEntries);
+                    version = items[1];
+                    break;
+                }
+            }
+            sr.Close();
+
+            string data = @"<?xml version=""1.0"" encoding=""utf-8""?>
+<Wix xmlns=""http://schemas.microsoft.com/wix/2006/wi"" xmlns:netfx=""http://schemas.microsoft.com/wix/NetFxExtension"" xmlns:difx=""http://schemas.microsoft.com/wix/DifxAppExtension"">
+
+
+    <Product Id=""" + newid + @""" Name=""APM Planner"" Language=""1033"" Version="""+version+@""" Manufacturer=""Michael Oborne"" UpgradeCode=""{625389D7-EB3C-4d77-A5F6-A285CF99437D}"">
+        <Package Description=""APM Planner Installer"" Comments=""Apm Planner Installer"" Manufacturer=""Michael Oborne"" InstallerVersion=""200"" Compressed=""yes"" />
+
+<MajorUpgrade DowngradeErrorMessage=""A later version of [ProductName] is already installed. Setup will now exit.""/>
+
+
+        <PropertyRef Id=""NETFRAMEWORK35"" />
+
+        <Condition Message=""This application requires .NET Framework 3.5. Please install the .NET Framework then run this installer again.""><![CDATA[Installed OR NETFRAMEWORK35]]></Condition>
+
+        <Media Id=""1"" Cabinet=""product.cab"" EmbedCab=""yes"" />
+
+        <Directory Id=""TARGETDIR"" Name=""SourceDir"">
+            <Directory Id=""ProgramFilesFolder"" Name=""PFiles"">
+                ";
+
+            sw.WriteLine(data);
+        }
+
+        static void footer()
+        {
+            string data = @"
+                    
+                    <Directory Id=""drivers"" Name=""Drivers"">
+                        <Component Id=""MyDriver"" Guid=""{6AC8226E-A005-437e-A3CD-0FC32D9A346F}"">
+                            <File Id=""apm2inf""  Source=""..\Driver\Arduino MEGA 2560.inf"" />
+                            <difx:Driver AddRemovePrograms='no' Legacy=""yes"" PlugAndPlayPrompt=""no"" />
+                        </Component>
+                    </Directory>
+                </Directory>
+            </Directory>
+
+            <Directory Id=""ProgramMenuFolder"">
+                <Directory Id=""ApplicationProgramsFolder"" Name=""APM Planner"" />
+            </Directory>
+
+        </Directory>
+
+        <DirectoryRef Id=""ApplicationProgramsFolder"">
+            <Component Id=""ApplicationShortcut"" Guid=""{8BC628BA-08A0-43d6-88C8-D4C007AC4607}"">
+                <Shortcut Id=""ApplicationStartMenuShortcut"" Name=""APM Planner"" Description=""Ardupilot Mega Planner"" Target=""[APMPlanner]ArdupilotMegaPlanner.exe"" WorkingDirectory=""APMPlanner"" />
+                <RemoveFolder Id=""ApplicationProgramsFolder"" On=""uninstall"" />
+
+                <Shortcut Id=""UninstallProduct"" Name=""Uninstall APM Planner"" Description=""Uninstalls My Application"" Target=""[System64Folder]msiexec.exe"" Arguments=""/x [ProductCode]"" />
+
+
+
+                <RegistryValue Root=""HKCU"" Key=""Software\MichaelOborne\APMPlanner"" Name=""installed"" Type=""integer"" Value=""1"" KeyPath=""yes"" />
+
+
+
+
+            </Component>
+        </DirectoryRef>
+
+
+        <Feature Id=""MyFeature"" Title=""My 1st Feature"" Level=""1"">
+            <ComponentRef Id=""InstallDirPermissions"" />
+";
+            sw.WriteLine(data);
+
+            foreach (string comp in components)
+            {
+                sw.WriteLine(@"<ComponentRef Id="""+comp+@""" />");
+            }
+
+data = @"
+            
+            <ComponentRef Id=""ApplicationShortcut"" />
+            <ComponentRef Id=""MyDriver"" />
+        </Feature>
+
+        
+            <!-- Step 2: Add UI to your installer / Step 4: Trigger the custom action -->
+    <Property Id=""WIXUI_INSTALLDIR"" Value=""APMPlanner"" />
+
+    <UI>
+        <UIRef Id=""WixUI_InstallDir"" />
+        <Publish Dialog=""ExitDialog"" 
+            Control=""Finish"" 
+            Event=""DoAction"" 
+            Value=""LaunchApplication"">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
+    </UI>
+    <Property Id=""WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT"" Value=""Launch APM Planner"" />
+
+    <!-- Step 3: Include the custom action -->
+    <Property Id=""WixShellExecTarget"" Value=""[#" + mainexeid + @"]"" />
+    <CustomAction Id=""LaunchApplication"" 
+        BinaryKey=""WixCA"" 
+        DllEntry=""WixShellExec""
+        Impersonate=""yes"" />
+    </Product>
+    
+</Wix>";
+
+            sw.WriteLine(data);
+        }
+
+        static void dodirectory(string path, int level = 1)
+        {
+            string[] dirs = Directory.GetDirectories(path);
+
+            if (level != 0)
+                sw.WriteLine("<Directory Id=\"" + Path.GetFileName(path).Replace('-', '_') + "\" Name=\"" + Path.GetFileName(path) + "\">");
+
+            string[] files = Directory.GetFiles(path);
+
+            sw.WriteLine("<Component Id=\"_comp"+no+"\" Guid=\""+ System.Guid.NewGuid().ToString() +"\">");
+
+            components.Add("_comp"+no);
+
+            foreach (string filepath in files)
+            {
+                if (filepath.EndsWith("config.xml") || filepath.Contains("ArdupilotPlanner.log"))
+                    continue;
+                no++;
+                sw.WriteLine("<File Id=\"_" + no + "\" Source=\"" + filepath + "\" />");
+
+                if (filepath.EndsWith("ArdupilotMegaPlanner.exe")) {
+                    mainexeid = "_" + no;
+                }
+            }
+
+            sw.WriteLine("</Component>");
+
+            foreach (string dir in dirs)
+            {
+                if (dir.EndsWith("gmapcache") || dir.EndsWith("srtm"))
+                    continue;
+                dodirectory(dir);
+            }
+
+            if (level != 0)
+                sw.WriteLine("</Directory>");
+        }
+
+        static string fixname(string name)
+        {
+            name = name.Replace("-", "_");
+            name = name.Replace(" ", "_");
+            name = name.Replace(" ", "_");
+
+            return name;
+        }
+    }
+}
diff --git a/Tools/ArdupilotMegaPlanner/wix/Properties/AssemblyInfo.cs b/Tools/ArdupilotMegaPlanner/wix/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000000000000000000000000000000000..145a4d08304c6466e1490a03ebb22d29ac2f7f75
--- /dev/null
+++ b/Tools/ArdupilotMegaPlanner/wix/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("wix")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("wix")]
+[assembly: AssemblyCopyright("Copyright ©  2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("072e1c12-4a62-4be2-bcff-01fd33b14f95")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Tools/ArdupilotMegaPlanner/wix/app.config b/Tools/ArdupilotMegaPlanner/wix/app.config
new file mode 100644
index 0000000000000000000000000000000000000000..e59af44de2ddb14170137575f1bb09790c6a877c
--- /dev/null
+++ b/Tools/ArdupilotMegaPlanner/wix/app.config
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<configuration>
+<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
diff --git a/Tools/ArdupilotMegaPlanner/wix/wix.csproj b/Tools/ArdupilotMegaPlanner/wix/wix.csproj
new file mode 100644
index 0000000000000000000000000000000000000000..e20f1052437966b75075f00cbc7334b907a81883
--- /dev/null
+++ b/Tools/ArdupilotMegaPlanner/wix/wix.csproj
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{76374F95-C343-4ACC-B86F-7ECFDD668F46}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>wix</RootNamespace>
+    <AssemblyName>wix</AssemblyName>
+    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+    <TargetFrameworkProfile>
+    </TargetFrameworkProfile>
+    <FileAlignment>512</FileAlignment>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <PlatformTarget>x86</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <PlatformTarget>x86</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\Msi\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="app.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+      <Visible>False</Visible>
+      <ProductName>Windows Installer 3.1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file