From a77c0418f3963f703d7d8bc090cc0633ee7ac0e6 Mon Sep 17 00:00:00 2001 From: Michael Carpenter Date: Fri, 31 May 2013 08:45:44 -0400 Subject: [PATCH] Fixed some some graphical glitches in the new RC calibration screen --- src/ui/QGCVehicleConfig.cc | 10 ++- src/ui/QGCVehicleConfig.ui | 121 +++++++++++++++++++++++++++-- src/ui/designer/QGCRadioChannelDisplay.cpp | 4 +- 3 files changed, 126 insertions(+), 9 deletions(-) diff --git a/src/ui/QGCVehicleConfig.cc b/src/ui/QGCVehicleConfig.cc index 9d2bb6b..61d917b 100644 --- a/src/ui/QGCVehicleConfig.cc +++ b/src/ui/QGCVehicleConfig.cc @@ -49,6 +49,8 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) : ui->rollWidget->setName("Roll"); ui->yawWidget->setOrientation(Qt::Horizontal); ui->yawWidget->setName("Yaw"); + ui->pitchWidget->setName("Pitch"); + ui->throttleWidget->setName("Throttle"); ui->radio5Widget->setOrientation(Qt::Horizontal); ui->radio5Widget->setName("Radio 5"); ui->radio6Widget->setOrientation(Qt::Horizontal); @@ -72,6 +74,7 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) : ui->rcCalibrationButton->setCheckable(true); connect(ui->rcCalibrationButton, SIGNAL(clicked(bool)), this, SLOT(toggleCalibrationRC(bool))); connect(ui->setButton, SIGNAL(clicked()), this, SLOT(writeParameters())); + connect(ui->refreshButton,SIGNAL(clicked()),mav,SLOT(requestParameters())); connect(ui->rcModeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setRCModeIndex(int))); //connect(ui->setTrimButton, SIGNAL(clicked()), this, SLOT(setTrimPositions())); @@ -840,13 +843,18 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active) updateStatus(QString("Reading from system %1").arg(mav->getUASName())); // Since a system is now connected, enable the VehicleConfig UI. - ui->tabWidget->setEnabled(true); + //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); + if (mav->getAutopilotTypeName() == "ARDUPILOTMEGA") + { + ui->readButton->hide(); + ui->writeButton->hide(); + } } void QGCVehicleConfig::resetCalibrationRC() diff --git a/src/ui/QGCVehicleConfig.ui b/src/ui/QGCVehicleConfig.ui index 524cf85..c1692c0 100644 --- a/src/ui/QGCVehicleConfig.ui +++ b/src/ui/QGCVehicleConfig.ui @@ -800,8 +800,8 @@ p, li { white-space: pre-wrap; } 0 0 - 364 - 537 + 20 + 20 @@ -1062,11 +1062,120 @@ p, li { white-space: pre-wrap; } - - - Store to EEPROM + + + + + false + + + Copy current parameters in non-permanent memory of the aircraft to permanent memory. Transmit your parameters first to write these. + + + + + + Write (ROM) + + + + + + + false + + + Set current parameters in non-permanent onboard memory. + + + + + + Set (UAS) + + + + + + + false + + + Copy parameters from permanent memory to non-permanent current memory of aircraft. DOES NOT update the parameters in this view, click refresh after copying them to get them. + + + + + + + + + Read (ROM) + + + + + + + false + + + Load parameters currently in non-permanent memory of aircraft. + + + + + + Get (UAS) + + + + + + + false + + + Load parameters from a file on this computer in the view. To write them to the aircraft, use transmit after loading them. + + + + + + Load (File) + + + + + + + false + + + Save parameters in this view to a file on this computer. + + + + + + Save (File) + + + + + + + + + Qt::Horizontal - + + + 40 + 20 + + + diff --git a/src/ui/designer/QGCRadioChannelDisplay.cpp b/src/ui/designer/QGCRadioChannelDisplay.cpp index f280d6d..21c724f 100644 --- a/src/ui/designer/QGCRadioChannelDisplay.cpp +++ b/src/ui/designer/QGCRadioChannelDisplay.cpp @@ -31,7 +31,7 @@ void QGCRadioChannelDisplay::paintEvent(QPaintEvent *event) painter.drawRect(0,0,width()-1,(height()-1) - (painter.fontMetrics().height() * 2)); painter.setBrush(Qt::SolidPattern); painter.setPen(QColor::fromRgb(50,255,50)); - int newval = (height()-2-(painter.fontMetrics().height() * 2)) * ((float)m_value / 3000.0); + int newval = (height()-2-(painter.fontMetrics().height() * 2)) * ((float)m_value / 3001.0); int newvaly = (height()-2-(painter.fontMetrics().height() * 2)) - newval; painter.drawRect(1,newvaly,width()-3,((height()-2) - newvaly - (painter.fontMetrics().height() * 2))); QString valstr = QString::number(m_value); @@ -64,7 +64,7 @@ void QGCRadioChannelDisplay::paintEvent(QPaintEvent *event) painter.drawRect(0,0,width()-1,(height()-1) - (painter.fontMetrics().height() * 2)); painter.setBrush(Qt::SolidPattern); painter.setPen(QColor::fromRgb(50,255,50)); - painter.drawRect(1,1,(width()-1) * ((float)m_value / 3000.0),(height()-3) - (painter.fontMetrics().height() * 2)); + painter.drawRect(1,1,(width()-3) * ((float)m_value / 3000.0),(height()-3) - (painter.fontMetrics().height() * 2)); painter.setPen(QColor::fromRgb(255,255,255)); QString valstr = QString::number(m_value); painter.drawText((width()/2.0) - (painter.fontMetrics().width(m_name)/2.0),((height()-3) - (painter.fontMetrics().height()*1)),m_name);