Commit 13dcbfae authored by dongfang's avatar dongfang

Lorenz merge

parents 59a57d53 89696feb
......@@ -177,6 +177,7 @@ void QGCToolBar::createUI()
addLink(LinkManager::instance()->getLinks().last());
// XXX implies that connect button is always active for the last used link
connect(LinkManager::instance(), SIGNAL(newLink(LinkInterface*)), this, SLOT(addLink(LinkInterface*)));
connect(LinkManager::instance(), SIGNAL(linkRemoved(LinkInterface*)), this, SLOT(removeLink(LinkInterface*)));
// Update label if required
if (LinkManager::instance()->getLinks().count() < 3) {
......
......@@ -58,7 +58,7 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) :
ui->rcCalibrationButton->setCheckable(true);
connect(ui->rcCalibrationButton, SIGNAL(clicked(bool)), this, SLOT(toggleCalibrationRC(bool)));
connect(ui->storeButton, SIGNAL(clicked()), this, SLOT(writeParameters()));
connect(ui->setButton, SIGNAL(clicked()), this, SLOT(writeParameters()));
connect(ui->rcModeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setRCModeIndex(int)));
connect(ui->setTrimButton, SIGNAL(clicked()), this, SLOT(setTrimPositions()));
......@@ -199,6 +199,7 @@ void QGCVehicleConfig::stopCalibrationRC()
void QGCVehicleConfig::loadQgcConfig(bool primary)
{
Q_UNUSED(primary);
QDir autopilotdir(qApp->applicationDirPath() + "/files/" + mav->getAutopilotTypeName().toLower());
QDir generaldir = QDir(autopilotdir.absolutePath() + "/general/widgets");
QDir vehicledir = QDir(autopilotdir.absolutePath() + "/" + mav->getSystemTypeName().toLower() + "/widgets");
......@@ -368,7 +369,6 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
}
}
// Load calibration
//TODO: Handle this more gracefully, maybe have it scan the directory for multiple calibration entries?
tool = new QGCToolWidget("", this);
......@@ -385,7 +385,6 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
delete tool;
}
tool = new QGCToolWidget("", this);
tool->addUAS(mav);
if (tool->loadSettings(autopilotdir.absolutePath() + "/" + mav->getSystemTypeName().toLower() + "/calibration/calibration.qgw", false))
......@@ -399,16 +398,12 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
} else {
delete tool;
}
//description.txt
QFile sensortipsfile(autopilotdir.absolutePath() + "/general/calibration/description.txt");
sensortipsfile.open(QIODevice::ReadOnly);
ui->sensorTips->setHtml(sensortipsfile.readAll());
sensortipsfile.close();
}
void QGCVehicleConfig::menuButtonClicked()
{
......@@ -739,10 +734,8 @@ void QGCVehicleConfig::loadConfig()
}
xml.readNext();
}
if (mav)
{
mav->getParamManager()->setParamInfo(paramTooltips);
}
mav->getParamManager()->setParamInfo(paramTooltips);
doneLoadingConfig = true;
mav->requestParameters(); //Config is finished, lets do a parameter request to ensure none are missed if someone else started requesting before we were finished.
}
......@@ -796,18 +789,24 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active)
mav->getParamManager()->setParamInfo(paramTooltips);
}
// mav->requestParameters();
QString defaultsDir = qApp->applicationDirPath() + "/files/" + mav->getAutopilotTypeName().toLower() + "/widgets/";
qDebug() << "CALIBRATION!! System Type Name:" << mav->getSystemTypeName();
//Load configuration after 1ms. This allows it to go into the event loop, and prevents application hangups due to the
//amount of time it actually takes to load the configuration windows.
QTimer::singleShot(1,this,SLOT(loadConfig()));
updateStatus(QString("Reading from system %1").arg(mav->getUASName()));
// Since a system is now connected, enable the VehicleConfig UI.
ui->tabWidget->setEnabled(true);
ui->setButton->setEnabled(true);
ui->refreshButton->setEnabled(true);
ui->readButton->setEnabled(true);
ui->writeButton->setEnabled(true);
ui->loadFileButton->setEnabled(true);
ui->saveFileButton->setEnabled(true);
}
void QGCVehicleConfig::resetCalibrationRC()
{
for (unsigned int i = 0; i < chanMax; ++i)
......@@ -1125,9 +1124,9 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete
if (minTpl.exactMatch(parameterName)) {
bool ok;
int index = parameterName.mid(2, 1).toInt(&ok) - 1;
unsigned int index = parameterName.mid(2, 1).toInt(&ok) - 1;
//qDebug() << "PARAM:" << parameterName << "index:" << index;
if (ok && (index >= 0) && (index < chanMax))
if (ok && index < chanMax)
{
rcMin[index] = value.toInt();
}
......@@ -1135,8 +1134,8 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete
if (maxTpl.exactMatch(parameterName)) {
bool ok;
int index = parameterName.mid(2, 1).toInt(&ok) - 1;
if (ok && (index >= 0) && (index < chanMax))
unsigned int index = parameterName.mid(2, 1).toInt(&ok) - 1;
if (ok && index < chanMax)
{
rcMax[index] = value.toInt();
}
......@@ -1144,8 +1143,8 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete
if (trimTpl.exactMatch(parameterName)) {
bool ok;
int index = parameterName.mid(2, 1).toInt(&ok) - 1;
if (ok && (index >= 0) && (index < chanMax))
unsigned int index = parameterName.mid(2, 1).toInt(&ok) - 1;
if (ok && index < chanMax)
{
rcTrim[index] = value.toInt();
}
......@@ -1153,8 +1152,8 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete
if (revTpl.exactMatch(parameterName)) {
bool ok;
int index = parameterName.mid(2, 1).toInt(&ok) - 1;
if (ok && (index >= 0) && (index < chanMax))
unsigned int index = parameterName.mid(2, 1).toInt(&ok) - 1;
if (ok && index < chanMax)
{
rcRev[index] = (value.toInt() == -1) ? true : false;
updateInvertedCheckboxes(index);
......
This diff is collapsed.
......@@ -6,7 +6,6 @@ DockWidgetTitleBarEventFilter::DockWidgetTitleBarEventFilter(QObject *parent) :
}
bool DockWidgetTitleBarEventFilter::eventFilter(QObject *object,QEvent *event)
{
qDebug() << event->type();
if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease)
{
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment