2012-04-19 21:05:33 -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-24 10:49:27 -03:00
|
|
|
|
using ArdupilotMega.Controls;
|
2012-04-19 21:05:33 -03:00
|
|
|
|
|
|
|
|
|
namespace ArdupilotMega.GCSViews.ConfigurationView
|
|
|
|
|
{
|
|
|
|
|
public partial class ConfigAccelerometerCalibrationQuad : BackStageViewContentPanel
|
|
|
|
|
{
|
|
|
|
|
public ConfigAccelerometerCalibrationQuad()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void pictureBoxQuadX_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
MainV2.comPort.setParam("FRAME", 1f);
|
|
|
|
|
CustomMessageBox.Show("Set to x");
|
2012-04-30 07:48:52 -03:00
|
|
|
|
|
|
|
|
|
lbl_frame.Text = "X";
|
2012-04-19 21:05:33 -03:00
|
|
|
|
}
|
|
|
|
|
catch { CustomMessageBox.Show("Set frame failed"); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BUT_levelac2_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
#if MAVLINK10
|
|
|
|
|
int fixme; // needs to be accel only
|
|
|
|
|
MainV2.comPort.doCommand(MAVLink.MAV_CMD.PREFLIGHT_CALIBRATION,1,1,1,1,1,1,1);
|
|
|
|
|
#else
|
|
|
|
|
MainV2.comPort.doAction(MAVLink.MAV_ACTION.MAV_ACTION_CALIBRATE_ACC);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
BUT_levelac2.Text = "Complete";
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
CustomMessageBox.Show("Failed to level : ac2 2.0.37+ is required");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void pictureBoxQuad_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
MainV2.comPort.setParam("FRAME", 0f);
|
|
|
|
|
CustomMessageBox.Show("Set to +");
|
2012-04-30 07:48:52 -03:00
|
|
|
|
lbl_frame.Text = "+";
|
2012-04-19 21:05:33 -03:00
|
|
|
|
}
|
|
|
|
|
catch { CustomMessageBox.Show("Set frame failed"); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ConfigAccelerometerCalibration_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!MainV2.comPort.BaseStream.IsOpen)
|
|
|
|
|
{
|
|
|
|
|
this.Enabled = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2)
|
|
|
|
|
{
|
|
|
|
|
this.Enabled = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.Enabled = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-04-30 07:48:52 -03:00
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
lbl_frame.Text = ((float)MainV2.comPort.param["FRAME"] == 0) ? "+" : "X";
|
|
|
|
|
}
|
|
|
|
|
catch { lbl_frame.Text = "Invalid Frame"; }
|
2012-04-19 21:05:33 -03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|