2012-04-05 21:50:04 -03:00
|
|
|
|
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;
|
|
|
|
|
using ArdupilotMega.Controls.BackstageView;
|
2012-04-29 21:32:33 -03:00
|
|
|
|
using ArdupilotMega.Utilities;
|
2012-04-05 21:50:04 -03:00
|
|
|
|
|
|
|
|
|
namespace ArdupilotMega.GCSViews.ConfigurationView
|
|
|
|
|
{
|
2012-04-25 07:10:11 -03:00
|
|
|
|
public partial class Setup : MyUserControl
|
2012-04-05 21:50:04 -03:00
|
|
|
|
{
|
|
|
|
|
public Setup()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2012-07-16 10:37:35 -03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void Setup_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
2012-04-05 21:50:04 -03:00
|
|
|
|
|
2012-04-25 07:10:11 -03:00
|
|
|
|
if (MainV2.comPort.BaseStream.IsOpen)
|
|
|
|
|
{
|
2012-07-01 06:51:22 -03:00
|
|
|
|
AddPagesForConnectedState();
|
2012-07-22 04:51:05 -03:00
|
|
|
|
// backstageView.AddSpacer(20);
|
2012-07-01 06:51:22 -03:00
|
|
|
|
}
|
2012-07-16 10:37:35 -03:00
|
|
|
|
|
2012-07-01 06:51:22 -03:00
|
|
|
|
// These pages work when not connected to an APM
|
|
|
|
|
AddBackstageViewPage(new ArdupilotMega._3DRradio(), "3DR Radio");
|
|
|
|
|
AddBackstageViewPage(new ArdupilotMega.Antenna.Tracker(), "Antenna Tracker");
|
2012-07-22 04:51:05 -03:00
|
|
|
|
//backstageView.AddSpacer(15);
|
2012-07-01 06:51:22 -03:00
|
|
|
|
AddBackstageViewPage(new ConfigPlanner(), "Planner");
|
2012-04-25 07:10:11 -03:00
|
|
|
|
|
2012-07-01 06:51:22 -03:00
|
|
|
|
this.backstageView.ActivatePage(backstageView.Pages[0]);
|
2012-04-25 07:10:11 -03:00
|
|
|
|
|
2012-07-25 10:44:24 -03:00
|
|
|
|
ThemeManager.ApplyThemeTo(this);
|
|
|
|
|
|
2012-07-01 06:51:22 -03:00
|
|
|
|
if (!MainV2.comPort.BaseStream.IsOpen)
|
|
|
|
|
{
|
2012-07-22 04:51:05 -03:00
|
|
|
|
Common.MessageShowAgain("Config Connect", @"Please connect (click Connect Button) before using setup.
|
|
|
|
|
If you are just setting up 3DR radios, you may continue without connecting.");
|
2012-07-01 06:51:22 -03:00
|
|
|
|
}
|
|
|
|
|
}
|
2012-04-25 07:10:11 -03:00
|
|
|
|
|
|
|
|
|
|
2012-07-01 06:51:22 -03:00
|
|
|
|
// Add the pages that can only be shown when we are connected to an APM
|
|
|
|
|
private void AddPagesForConnectedState()
|
|
|
|
|
{
|
|
|
|
|
/****************************** Common **************************/
|
2012-04-06 05:27:26 -03:00
|
|
|
|
|
2012-07-01 06:51:22 -03:00
|
|
|
|
AddBackstageViewPage(new ConfigRadioInput(), "Radio Calibration");
|
|
|
|
|
AddBackstageViewPage(new ConfigFlightModes(), "Flight Modes");
|
|
|
|
|
AddBackstageViewPage(new ConfigHardwareOptions(), "Hardware Options");
|
|
|
|
|
AddBackstageViewPage(new ConfigBatteryMonitoring(), "Battery Monitor");
|
2012-04-25 07:10:11 -03:00
|
|
|
|
|
|
|
|
|
|
2012-07-01 06:51:22 -03:00
|
|
|
|
/******************************HELI **************************/
|
|
|
|
|
if (MainV2.comPort.param["H_GYR_ENABLE"] != null) // heli
|
|
|
|
|
{
|
2012-07-25 10:44:24 -03:00
|
|
|
|
AddBackstageViewPage(new ConfigMount(), "Camera Gimbal");
|
2012-07-12 11:06:22 -03:00
|
|
|
|
|
2012-07-01 06:51:22 -03:00
|
|
|
|
AddBackstageViewPage(new ConfigAccelerometerCalibrationQuad(), "ArduCopter Level");
|
2012-04-24 10:49:27 -03:00
|
|
|
|
|
2012-07-01 06:51:22 -03:00
|
|
|
|
AddBackstageViewPage(new ConfigTradHeli(), "Heli Setup");
|
2012-04-06 05:27:26 -03:00
|
|
|
|
|
2012-07-22 04:51:05 -03:00
|
|
|
|
var configpanel = new Controls.ConfigPanel(Application.StartupPath + System.IO.Path.DirectorySeparatorChar + "ArduCopterConfig.xml");
|
2012-07-01 06:51:22 -03:00
|
|
|
|
AddBackstageViewPage(configpanel, "ArduCopter Pids");
|
2012-04-06 05:27:26 -03:00
|
|
|
|
|
2012-07-01 06:51:22 -03:00
|
|
|
|
AddBackstageViewPage(new ConfigArducopter(), "ArduCopter Config");
|
2012-07-25 10:44:24 -03:00
|
|
|
|
AddBackstageViewPage(new ConfigAP_Limits(), "GeoFence");
|
2012-07-01 06:51:22 -03:00
|
|
|
|
}
|
|
|
|
|
/****************************** ArduCopter **************************/
|
|
|
|
|
else if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2)
|
|
|
|
|
{
|
2012-07-25 10:44:24 -03:00
|
|
|
|
//AddBackstageViewPage(new ConfigCameraStab(), "Camera Gimbal");
|
|
|
|
|
|
|
|
|
|
AddBackstageViewPage(new ConfigMount(), "Camera Gimbal");
|
2012-07-12 11:06:22 -03:00
|
|
|
|
|
2012-07-01 06:51:22 -03:00
|
|
|
|
AddBackstageViewPage(new ConfigAccelerometerCalibrationQuad(), "ArduCopter Level");
|
2012-04-25 07:10:11 -03:00
|
|
|
|
|
2012-07-22 04:51:05 -03:00
|
|
|
|
var configpanel = new Controls.ConfigPanel(Application.StartupPath + System.IO.Path.DirectorySeparatorChar + "ArduCopterConfig.xml");
|
2012-07-01 06:51:22 -03:00
|
|
|
|
AddBackstageViewPage(configpanel, "ArduCopter Pids");
|
2012-04-15 10:51:07 -03:00
|
|
|
|
|
2012-07-01 06:51:22 -03:00
|
|
|
|
AddBackstageViewPage(new ConfigArducopter(), "ArduCopter Config");
|
2012-07-16 10:37:35 -03:00
|
|
|
|
AddBackstageViewPage(new ConfigAP_Limits(), "GeoFence");
|
2012-07-01 06:51:22 -03:00
|
|
|
|
}
|
|
|
|
|
/****************************** ArduPlane **************************/
|
|
|
|
|
else if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane)
|
2012-04-15 10:51:07 -03:00
|
|
|
|
{
|
2012-07-01 06:51:22 -03:00
|
|
|
|
AddBackstageViewPage(new ConfigAccelerometerCalibrationPlane(), "ArduPlane Level");
|
|
|
|
|
AddBackstageViewPage(new ConfigArduplane(), "ArduPlane Pids");
|
2012-04-15 10:51:07 -03:00
|
|
|
|
}
|
2012-07-01 06:51:22 -03:00
|
|
|
|
/****************************** ArduRover **************************/
|
|
|
|
|
else if (MainV2.cs.firmware == MainV2.Firmwares.ArduRover)
|
|
|
|
|
{
|
|
|
|
|
//AddBackstageViewPage(new ConfigAccelerometerCalibrationPlane(), "ArduRover Level"));
|
|
|
|
|
AddBackstageViewPage(new ConfigArdurover(), "ArduRover Pids");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AddBackstageViewPage(new ConfigFriendlyParams { ParameterMode = ParameterMetaDataConstants.Standard }, "Standard Params");
|
|
|
|
|
AddBackstageViewPage(new ConfigFriendlyParams { ParameterMode = ParameterMetaDataConstants.Advanced }, "Advanced Params");
|
|
|
|
|
AddBackstageViewPage(new ConfigRawParams(), "Parameter List");
|
2012-04-06 05:27:26 -03:00
|
|
|
|
}
|
|
|
|
|
|
2012-07-22 04:51:05 -03:00
|
|
|
|
private void AddBackstageViewPage(UserControl userControl, string headerText)
|
2012-07-01 06:51:22 -03:00
|
|
|
|
{
|
2012-07-22 04:51:05 -03:00
|
|
|
|
backstageView.AddPage(userControl, headerText);
|
2012-07-01 06:51:22 -03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-04-06 05:27:26 -03:00
|
|
|
|
private void Setup_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
backstageView.Close();
|
2012-04-05 21:50:04 -03:00
|
|
|
|
}
|
|
|
|
|
}
|
2012-04-06 05:27:26 -03:00
|
|
|
|
}
|