diff --git a/src/ui/QGCVehicleConfig.cc b/src/ui/QGCVehicleConfig.cc index 62685cdbea8ab879006cd71c84d8e9c925a7a927..9d2bb6b98d5eef400bea66a77b83c4329f315789 100644 --- a/src/ui/QGCVehicleConfig.cc +++ b/src/ui/QGCVehicleConfig.cc @@ -45,6 +45,19 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) : setObjectName("QGC_VEHICLECONFIG"); ui->setupUi(this); + ui->rollWidget->setOrientation(Qt::Horizontal); + ui->rollWidget->setName("Roll"); + ui->yawWidget->setOrientation(Qt::Horizontal); + ui->yawWidget->setName("Yaw"); + ui->radio5Widget->setOrientation(Qt::Horizontal); + ui->radio5Widget->setName("Radio 5"); + ui->radio6Widget->setOrientation(Qt::Horizontal); + ui->radio6Widget->setName("Radio 6"); + ui->radio7Widget->setOrientation(Qt::Horizontal); + ui->radio7Widget->setName("Radio 7"); + ui->radio8Widget->setOrientation(Qt::Horizontal); + ui->radio8Widget->setName("Radio 8"); + connect(ui->rcMenuButton,SIGNAL(clicked()),this,SLOT(rcMenuButtonClicked())); connect(ui->sensorMenuButton,SIGNAL(clicked()),this,SLOT(sensorMenuButtonClicked())); connect(ui->generalMenuButton,SIGNAL(clicked()),this,SLOT(generalMenuButtonClicked())); @@ -60,7 +73,7 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) : connect(ui->rcCalibrationButton, SIGNAL(clicked(bool)), this, SLOT(toggleCalibrationRC(bool))); 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())); + //connect(ui->setTrimButton, SIGNAL(clicked()), this, SLOT(setTrimPositions())); /* Connect RC mapping assignments */ connect(ui->rollSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setRollChan(int))); @@ -184,17 +197,46 @@ void QGCVehicleConfig::detectChannelInversion() void QGCVehicleConfig::startCalibrationRC() { + QMessageBox::information(0,"Warning!","You are about to start radio calibration.\nPlease ensure all motor power is disconnected AND all props are removed from the vehicle.\nAlso ensure transmitter and reciever are powered and connected\n\nClick OK to confirm"); + QMessageBox::information(0,"Information","Click OK, then move all sticks to their extreme positions, watching the min/max values to ensure you get the most range from your controller. This includes all switches"); ui->rcTypeComboBox->setEnabled(false); ui->rcCalibrationButton->setText(tr("Stop RC Calibration")); resetCalibrationRC(); calibrationEnabled = true; + ui->rollWidget->showMinMax(); + ui->pitchWidget->showMinMax(); + ui->yawWidget->showMinMax(); + ui->throttleWidget->showMinMax(); + ui->radio5Widget->showMinMax(); + ui->radio6Widget->showMinMax(); + ui->radio7Widget->showMinMax(); + ui->radio8Widget->showMinMax(); } void QGCVehicleConfig::stopCalibrationRC() { + QMessageBox::information(0,"Trims","Ensure all sticks are centeres and throttle is in the downmost position, click OK to continue"); calibrationEnabled = false; ui->rcTypeComboBox->setEnabled(true); ui->rcCalibrationButton->setText(tr("Start RC Calibration")); + ui->rollWidget->hideMinMax(); + ui->pitchWidget->hideMinMax(); + ui->yawWidget->hideMinMax(); + ui->throttleWidget->hideMinMax(); + ui->radio5Widget->hideMinMax(); + ui->radio6Widget->hideMinMax(); + ui->radio7Widget->hideMinMax(); + ui->radio8Widget->hideMinMax(); + QString statusstr; + statusstr = "Below you will find the detected radio calibration information that will be sent to the autopilot\n"; + statusstr += "Normal values are around 1100 to 1900, with disconnected channels reading very close to 1500\n\n"; + statusstr += "Channel\tMin\tCenter\tMax\n"; + statusstr += "--------------------\n"; + for (int i=0;i<8;i++) + { + statusstr += QString::number(i) + "\t" + QString::number(rcMin[i]) + "\t" + QString::number(rcValue[i]) + "\t" + QString::number(rcMax[i]) + "\n"; + } + QMessageBox::information(0,"Status",statusstr); } void QGCVehicleConfig::loadQgcConfig(bool primary) @@ -811,8 +853,8 @@ void QGCVehicleConfig::resetCalibrationRC() { for (unsigned int i = 0; i < chanMax; ++i) { - rcMin[i] = 1200; - rcMax[i] = 1800; + rcMin[i] = 1500; + rcMax[i] = 1500; } } @@ -1291,57 +1333,76 @@ void QGCVehicleConfig::updateView() { if (rc_mode == RC_MODE_1) { - ui->rollSlider->setValue(rcRoll * 50 + 50); - ui->pitchSlider->setValue(rcThrottle * 100); - ui->yawSlider->setValue(rcYaw * 50 + 50); - ui->throttleSlider->setValue(rcPitch * 50 + 50); + //ui->rollSlider->setValue(rcRoll * 50 + 50); + //ui->pitchSlider->setValue(rcThrottle * 100); + //ui->yawSlider->setValue(rcYaw * 50 + 50); + //ui->throttleSlider->setValue(rcPitch * 50 + 50); } else if (rc_mode == RC_MODE_2) { - ui->rollSlider->setValue(rcRoll * 50 + 50); - ui->pitchSlider->setValue(rcPitch * 50 + 50); - ui->yawSlider->setValue(rcYaw * 50 + 50); - ui->throttleSlider->setValue(rcThrottle * 100); + //ui->rollSlider->setValue(rcRoll * 50 + 50); + //ui->pitchSlider->setValue(rcPitch * 50 + 50); + //ui->yawSlider->setValue(rcYaw * 50 + 50); + //ui->throttleSlider->setValue(rcThrottle * 100); } else if (rc_mode == RC_MODE_3) { - ui->rollSlider->setValue(rcYaw * 50 + 50); - ui->pitchSlider->setValue(rcThrottle * 100); - ui->yawSlider->setValue(rcRoll * 50 + 50); - ui->throttleSlider->setValue(rcPitch * 50 + 50); + //ui->rollSlider->setValue(rcYaw * 50 + 50); + //ui->pitchSlider->setValue(rcThrottle * 100); + //ui->yawSlider->setValue(rcRoll * 50 + 50); + //ui->throttleSlider->setValue(rcPitch * 50 + 50); } else if (rc_mode == RC_MODE_4) { - ui->rollSlider->setValue(rcYaw * 50 + 50); - ui->pitchSlider->setValue(rcPitch * 50 + 50); - ui->yawSlider->setValue(rcRoll * 50 + 50); - ui->throttleSlider->setValue(rcThrottle * 100); + //ui->rollSlider->setValue(rcYaw * 50 + 50); + //ui->pitchSlider->setValue(rcPitch * 50 + 50); + //ui->yawSlider->setValue(rcRoll * 50 + 50); + //ui->throttleSlider->setValue(rcThrottle * 100); } + ui->rollWidget->setValue(rcValue[0]); + ui->pitchWidget->setValue(rcValue[1]); + ui->yawWidget->setValue(rcValue[2]); + ui->throttleWidget->setValue(rcValue[3]); ui->chanLabel->setText(QString("%1/%2").arg(rcValue[rcMapping[0]]).arg(rcRoll, 5, 'f', 2, QChar(' '))); ui->chanLabel_2->setText(QString("%1/%2").arg(rcValue[rcMapping[1]]).arg(rcPitch, 5, 'f', 2, QChar(' '))); ui->chanLabel_3->setText(QString("%1/%2").arg(rcValue[rcMapping[2]]).arg(rcYaw, 5, 'f', 2, QChar(' '))); ui->chanLabel_4->setText(QString("%1/%2").arg(rcValue[rcMapping[3]]).arg(rcThrottle, 5, 'f', 2, QChar(' '))); - ui->modeSwitchSlider->setValue(rcMode * 50 + 50); + ui->rollWidget->setMin(rcMin[0]); + ui->rollWidget->setMax(rcMax[0]); + + ui->pitchWidget->setMin(rcMin[1]); + ui->pitchWidget->setMax(rcMax[1]); + + ui->yawWidget->setMin(rcMin[2]); + ui->yawWidget->setMax(rcMax[2]); + + ui->throttleWidget->setMin(rcMin[3]); + ui->throttleWidget->setMax(rcMax[3]); + + //ui->modeSwitchSlider->setValue(rcMode * 50 + 50); ui->chanLabel_5->setText(QString("%1/%2").arg(rcValue[rcMapping[4]]).arg(rcMode, 5, 'f', 2, QChar(' '))); if (rcValue[rcMapping[5]] != UINT16_MAX) { - ui->aux1Slider->setValue(rcAux1 * 50 + 50); + //ui->aux1Slider->setValue(rcAux1 * 50 + 50); + ui->radio5Widget->setValue(rcAux1); ui->chanLabel_6->setText(QString("%1/%2").arg(rcValue[rcMapping[5]]).arg(rcAux1, 5, 'f', 2, QChar(' '))); } else { ui->chanLabel_6->setText(tr("---")); } if (rcValue[rcMapping[6]] != UINT16_MAX) { - ui->aux2Slider->setValue(rcAux2 * 50 + 50); + //ui->aux2Slider->setValue(rcAux2 * 50 + 50); + ui->radio6Widget->setValue(rcAux2); ui->chanLabel_7->setText(QString("%1/%2").arg(rcValue[rcMapping[6]]).arg(rcAux2, 5, 'f', 2, QChar(' '))); } else { ui->chanLabel_7->setText(tr("---")); } if (rcValue[rcMapping[7]] != UINT16_MAX) { - ui->aux3Slider->setValue(rcAux3 * 50 + 50); + //ui->aux3Slider->setValue(rcAux3 * 50 + 50); + ui->radio7Widget->setValue(rcAux3); ui->chanLabel_8->setText(QString("%1/%2").arg(rcValue[rcMapping[7]]).arg(rcAux3, 5, 'f', 2, QChar(' '))); } else { ui->chanLabel_8->setText(tr("---")); diff --git a/src/ui/QGCVehicleConfig.ui b/src/ui/QGCVehicleConfig.ui index 7bef1a28b5d40d1d3b8e1a6230a7acee730c02eb..524cf85f5615077e51b83c52d4dfd00898696f56 100644 --- a/src/ui/QGCVehicleConfig.ui +++ b/src/ui/QGCVehicleConfig.ui @@ -6,7 +6,7 @@ 0 0 - 1151 + 1372 602 @@ -19,7 +19,7 @@ Form - + @@ -123,103 +123,457 @@ Config - - - - - 0 + + + 0 + + + + + + 9 + 9 + 68 + 16 + - - - - - 9 - 9 - 68 - 16 - - - - RC Calibration - - - - - - 270 - 410 - 51 - 211 - - - - - + + RC Calibration + + + + + + 100 + 10 + 211 + 30 + + + + + + + false + + + false + - - - false - - - false - - - - Select transmitter model - - - + + Select transmitter model + + + + + + + true + - - - true - - - - Mode 1 - - - - - Mode 2 - - - - - Mode 3 - - - - - Mode 4 - - - + + Mode 1 + - - - - - - - - 0000 - - - Qt::AlignCenter - - + + + Mode 2 + + + + + Mode 3 + + + + + Mode 4 + - - - - Invert + + + + + + + + 20 + 50 + 421 + 100 + + + + + + + 0000 + + + Qt::AlignCenter + + + + + + + Invert + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Yaw / Rudder + + + + + + + 0000 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Invert + + + + + + + Invert + + + + + + + 1 + + + 8 + + + + + + + 0000 + + + Qt::AlignCenter + + + + + + + 0000 + + + Qt::AlignCenter + + + + + + + Pitch / Elevator + + + + + + + 0000 + + + Qt::AlignCenter + + + + + + + Aux 2 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 0000 + + + Qt::AlignCenter + + + + + + + Invert + + + + + + + 1 + + + 8 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Throttle + + + + + + + Invert + + + + + + + 1 + + + 8 + + + + + + + 1 + + + 8 + + + + + + + Mode Switch + + + + + + + 0000 + + + Qt::AlignCenter + + + + + + + 1 + + + 8 + + + + + + + 1 + + + 8 + + + + + + + Aux 1 + + + + + + + 1 + + + 8 + + + + + + + 0000 + + + Qt::AlignCenter + + + + + + + Aux 3 + + + + + + + Invert + + + + + + + 1 + + + 8 + + + + + + + Invert + + + + + + + Invert + + + + + + + Roll / Ailerons + + + + + + + + + 40 + 520 + 314 + 23 + + + + Start Calibration + + + + + + 20 + 160 + 721 + 341 + + + + + + + + + + 250 + 40 + + + + + 250 + 40 + - - + + Qt::Horizontal @@ -231,25 +585,12 @@ Config - - - - Yaw / Rudder - - - - - - - 0000 - - - Qt::AlignCenter - - - - - + + + + + + Qt::Horizontal @@ -261,76 +602,24 @@ Config - - - - Invert - - - - - - - Invert - - - - - - - 1 - - - 8 - - - - - - - 0000 - - - Qt::AlignCenter - - - - - - - 0000 - - - Qt::AlignCenter - - - - - - - Pitch / Elevator - - - - - - - 0000 - - - Qt::AlignCenter + + + + + 50 + 200 + - - - - - - Aux 2 + + + 50 + 200 + - - + + Qt::Horizontal @@ -342,35 +631,24 @@ Config - - - - 0000 - - - Qt::AlignCenter - - - - - - - Invert - - - - - - - 1 + + + + + 50 + 200 + - - 8 + + + 50 + 200 + - - + + Qt::Horizontal @@ -382,890 +660,411 @@ Config - - - - Throttle - - - - - - - Invert - - - - - - - 1 - - - 8 - - - - - - - 1 - - - 8 - - - - - - - Mode Switch - - - - - - - 0000 - - - Qt::AlignCenter - - - - - - - 1 - - - 8 - - - - - - - 1 - - - 8 - - - - - - - Aux 1 - - - - - - - 1 - - - 8 - - - - - - - 0000 - - - Qt::AlignCenter - - - - - - - Aux 3 - - - - - - - Invert - - - - - - - 1 - - - 8 - - - - - - - Invert - - - - - - - Invert - - - - - - - Roll / Ailerons - - - - - - - - - - - + + + + - 200 - 200 + 250 + 40 - - - - - :/files/images/rc_stick.svg - - - true - - - Qt::AlignCenter - - - - - - - 0 - - - 100 - - - 0 - - - Qt::Horizontal - - - - - - - 0 - - - 100 - - - 0 - - - Qt::Vertical - - - - - - - - - - - - 1 - 1 - - - 200 - 200 + 250 + 40 - + + + + + - 10 - 10 + 250 + 40 - + - 100 - 100 + 250 + 40 - - - - - :/files/images/rc_stick.svg - - - true - - - Qt::AlignCenter - - - - - 0 - - - 100 - - - 0 + + + + + 250 + 40 + - - Qt::Horizontal + + + 250 + 40 + - - - - 0 - - - 100 - - - 0 + + + + + 250 + 40 + - - Qt::Vertical + + + 250 + 40 + + + + + - - - - - - - 0 - - - 100 - - - Qt::Vertical - - - - - - - 0 - - - 100 - - - Qt::Vertical - - - - - - - 0 - - - 100 - - - Qt::Vertical - - - - - - - 0 - - - 100 - - - Qt::Vertical - - - - - - - - - - - Start Calibration - - - - - - - Set Trim - - - - - - + + + + 250 + 40 + + + + + 250 + 40 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Sensor Calibration + - - - + + + - - - Sensor Calibration + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p></body></html> - + - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p></body></html> + + + true + + + + 0 + 0 + 364 + 537 + + + + + + + + - - - - - - true - - - - - 0 - 0 - 20 - 20 - - - - - - - - - - - - - - - + + + + + + + + + General Config + + + + + - - - General Config + + + Qt::Horizontal - + + + 40 + 20 + + + - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Load Platform Defaults - - - - + - - - - - Configuration - - - - 0 + + + Load Platform Defaults + + + + + + + + + + + Configuration + + + + 0 + + + + + true - - - - true + + + + 0 + 0 + 16 + 16 + + + + + 0 - - - - 0 - 0 - 16 - 16 - - - - - 0 - - - - - - - - - - - - - - - Configuration - - - - 0 + + + + + + + + + + + + + + Configuration + + + + 0 + + + + + true - - - - true + + + + 0 + 0 + 16 + 16 + + + + + 0 - - - - 0 - 0 - 16 - 16 - - - - - 0 - - - - - - - - - - - - + + + + + + + + + - - - + + + + + + + + + Advanced Config + + + + + - - - Advanced Config + + + Qt::Horizontal - + + + 40 + 20 + + + - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Load Platform Defaults - - - - + - - - - - Configuration - - - - 0 + + + Load Platform Defaults + + + + + + + + + + + Configuration + + + + 0 + + + + + true - - - - true + + + + 0 + 0 + 16 + 16 + + + + + 0 - - - - 0 - 0 - 16 - 16 - - - - - 0 - - - - - - - - - - - - - - - Configuration - - - - 0 + + + + + + + + + + + + + + Configuration + + + + 0 + + + + + true - - - - true + + + + 0 + 0 + 16 + 16 + + + + + 0 - - - - 0 - 0 - 16 - 16 - - - - - 0 - - - - - - - - - - - - + + + + + + + + + - - - - - - - No pending changes - - - - - - - Store to EEPROM - - - - + + + + - - - - - - Qt::Horizontal - - - - 30 - 20 - - - - - - - - 0 - - - QLayout::SetDefaultConstraint - - - - - - Qt::Vertical - - - - 20 - 0 - - - - + - - - 0 - 0 - - No pending changes - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 6 - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - false - - - Load parameters currently in non-permanent memory of aircraft. - - - - - - Get (UAS) - - - - - - false - - - Set current parameters in non-permanent onboard memory. - - - - - - Set (UAS) - - - - - - - - - 6 - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - 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) - - - - - - - - - 6 - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - 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 - - - Copy current parameters in non-permanent memory of the aircraft to permanent memory. Transmit your parameters first to write these. - - - - + - Write (ROM) + Store to EEPROM @@ -1283,8 +1082,6 @@ p, li { white-space: pre-wrap; } 1 - - - + diff --git a/src/ui/designer/QGCRadioChannelDisplay.cpp b/src/ui/designer/QGCRadioChannelDisplay.cpp index 155ba73995c629e1e70eff81731949230a2705a8..f280d6d5b5c2ba38da0285cf37fac8dccb7e4949 100644 --- a/src/ui/designer/QGCRadioChannelDisplay.cpp +++ b/src/ui/designer/QGCRadioChannelDisplay.cpp @@ -2,13 +2,18 @@ #include QGCRadioChannelDisplay::QGCRadioChannelDisplay(QWidget *parent) : QWidget(parent) { - m_showMinMax = true; - m_min = 500; - m_max = 1600; + m_showMinMax = false; + m_min = 0; + m_max = 0; m_value = 1500; m_orientation = Qt::Vertical; m_name = "Yaw"; } +void QGCRadioChannelDisplay::setName(QString name) +{ + m_name = name; + update(); +} void QGCRadioChannelDisplay::setOrientation(Qt::Orientation orient) { @@ -26,8 +31,33 @@ 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) * ((float)m_value / 3000.0); - painter.drawRect(1,newval,width()-3,((height()-2) - newval) - (painter.fontMetrics().height() * 2)); + int newval = (height()-2-(painter.fontMetrics().height() * 2)) * ((float)m_value / 3000.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); + painter.setPen(QColor::fromRgb(255,255,255)); + painter.drawText((width()/2.0) - (painter.fontMetrics().width(m_name)/2.0),((height()-3) - (painter.fontMetrics().height()*1)),m_name); + painter.drawText((width()/2.0) - (painter.fontMetrics().width(valstr)/2.0),((height()-3) - (painter.fontMetrics().height() * 0)),valstr); + if (m_showMinMax) + { + painter.setBrush(Qt::NoBrush); + painter.setPen(QColor::fromRgb(255,0,0)); + int maxyval = (height()-3 - (painter.fontMetrics().height() * 2)) - (((height()-3-(painter.fontMetrics().height() * 2)) * ((float)m_max / 3000.0))); + int minyval = (height()-3 - (painter.fontMetrics().height() * 2)) - (((height()-3-(painter.fontMetrics().height() * 2)) * ((float)m_min / 3000.0))); + painter.drawRect(2, + maxyval, + width()-3, + minyval - maxyval); + QString minstr = QString::number(m_min); + painter.drawText((width() / 2.0) - (painter.fontMetrics().width("min")/2.0),minyval,"min"); + painter.drawText((width() / 2.0) - (painter.fontMetrics().width(minstr)/2.0),minyval + painter.fontMetrics().height(),minstr); + + QString maxstr = QString::number(m_max); + painter.drawText((width() / 2.0) - (painter.fontMetrics().width("max")/2.0),maxyval,"max"); + painter.drawText((width() / 2.0) - (painter.fontMetrics().width(maxstr)/2.0),maxyval + painter.fontMetrics().height(),maxstr); + + //painter.drawRect(width() * ,2,((width()-1) * ((float)m_max / 3000.0)) - (width() * ((float)m_min / 3000.0)),(height()-5) - (painter.fontMetrics().height() * 2)); + } } else { @@ -58,7 +88,18 @@ void QGCRadioChannelDisplay::paintEvent(QPaintEvent *event) void QGCRadioChannelDisplay::setValue(int value) { - m_value = value; + if (value < 0) + { + m_value = 0; + } + else if (value > 3000) + { + m_value = 3000; + } + else + { + m_value = value; + } update(); } diff --git a/src/ui/designer/QGCRadioChannelDisplay.h b/src/ui/designer/QGCRadioChannelDisplay.h index b28fc44d2bba7c3561beabe2b702382c07e5d75c..be8958a23a8bd9e63e718ebaa3ef356f4a8b6e4f 100644 --- a/src/ui/designer/QGCRadioChannelDisplay.h +++ b/src/ui/designer/QGCRadioChannelDisplay.h @@ -14,6 +14,7 @@ public: void hideMinMax(); void setMin(int value); void setMax(int value); + void setName(QString name); int value() { return m_value; } int min() { return m_min; } int max() { return m_max; }