Commit 174962a1 authored by tstellanova's avatar tstellanova

Fixing rc calibration and realtime display

parent 00b6d2fc
This diff is collapsed.
......@@ -57,8 +57,8 @@ public slots:
/** Render the data updated */
void updateView();
void updateRcWidgetValues();
void handleRcParameterChange(QString parameterName, QVariant value);
void updateMinMax();
/** Set the RC channel */
void setRollChan(int channel) {
......@@ -180,7 +180,7 @@ protected:
float rcAux2; ///< PPM input channel used as aux 2 input
float rcAux3; ///< PPM input channel used as aux 3 input
bool rcCalChanged; ///< Set if the calibration changes (and needs to be written)
bool changed; ///< Set if any of the input data changed
bool dataModelChanged; ///< Set if any of the input data changed
QTimer updateTimer; ///< Controls update intervals
enum RC_MODE rc_mode; ///< Mode of the remote control, according to usual convention
QList<QGCToolWidget*> toolWidgets; ///< Configurable widgets
......
This diff is collapsed.
#include "QGCRadioChannelDisplay.h"
#include <QPainter>
#define DIMMEST_COLOR QColor::fromRgb(0,100,0)
#define MIDBRIGHT_COLOR QColor::fromRgb(0,180,0)
#define BRIGHTEST_COLOR QColor::fromRgb(64,255,0)
QGCRadioChannelDisplay::QGCRadioChannelDisplay(QWidget *parent) : QWidget(parent)
{
m_showMinMax = false;
......@@ -53,9 +58,9 @@ void QGCRadioChannelDisplay::paintEvent(QPaintEvent *event)
if (m_orientation == Qt::Vertical)
{
QLinearGradient gradientBrush(0, 0, this->width(), this->height());
gradientBrush.setColorAt(1.0,QColor::fromRgb(0,128,0));
gradientBrush.setColorAt(0.5,QColor::fromRgb(0,200,0));
gradientBrush.setColorAt(0.0, QColor::fromRgb(64,255,0));
gradientBrush.setColorAt(1.0,DIMMEST_COLOR);
gradientBrush.setColorAt(0.5,MIDBRIGHT_COLOR);
gradientBrush.setColorAt(0.0, BRIGHTEST_COLOR);
//draw border
painter.drawRect(0,0,width()-1,(height()-1) - twiceFontHeight);
......@@ -105,9 +110,9 @@ void QGCRadioChannelDisplay::paintEvent(QPaintEvent *event)
else //horizontal orientation
{
QLinearGradient hGradientBrush(0, 0, this->width(), this->height());
hGradientBrush.setColorAt(0.0,QColor::fromRgb(0,128,0));
hGradientBrush.setColorAt(0.5,QColor::fromRgb(0,200,0));
hGradientBrush.setColorAt(1.0, QColor::fromRgb(64,255,0));
hGradientBrush.setColorAt(0.0,DIMMEST_COLOR);
hGradientBrush.setColorAt(0.5,MIDBRIGHT_COLOR);
hGradientBrush.setColorAt(1.0, BRIGHTEST_COLOR);
//draw the value
painter.drawRect(0,0,width()-1,(height()-1) - twiceFontHeight);
......@@ -178,6 +183,19 @@ void QGCRadioChannelDisplay::hideMinMax()
update();
}
void QGCRadioChannelDisplay::setValueAndRange(int val, int min, int max)
{
setValue(val);
setMinMax(min,max);
}
void QGCRadioChannelDisplay::setMinMax(int min, int max)
{
setMin(min);
setMax(max);
}
void QGCRadioChannelDisplay::setMin(int value)
{
m_min = value;
......
......@@ -12,6 +12,8 @@ public:
void setValue(int value);
void showMinMax();
void hideMinMax();
void setValueAndRange(int val, int min, int max);
void setMinMax(int min, int max);
void setMin(int value);
void setMax(int value);
void setName(QString name);
......
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