Meter peak hold

#34
1.4.0
PianetaRadio 2022-12-09 00:00:47 +01:00 zatwierdzone przez GitHub
rodzic d2db142e34
commit 0e19ee12cd
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 45 dodań i 21 usunięć

Wyświetl plik

@ -162,11 +162,20 @@ MainWindow::MainWindow(QWidget *parent)
}
//Light QFile darkStyleFile(":qdarkstyle/light/lightstyle.qss");
//Meter Peak hold
ui->progressBar_Smeter->setPeak(guiConf.peakHold);
QApplication::setWheelScrollLines(10); //Mouse wheel scroll step
//* Init
//Meter
ui->progressBar_Smeter->setTx(false);
ui->progressBar_Smeter->setMaxValue(100);
ui->progressBar_Smeter->setGateValue(80);
ui->progressBar_Smeter->setValue(-54);
ui->progressBar_Smeter->resetPeakValue();
ui->progressBar_Smeter->setPeakFactor(rigCom.rigRefresh/1000.0/2);
QApplication::setWheelScrollLines(10); //Mouse wheel scroll step
//VFO
ui->lineEdit_vfoMain->setValue(0);
ui->lineEdit_vfoSub->setValue(0);
}
MainWindow::~MainWindow()
@ -263,7 +272,9 @@ void MainWindow::guiInit()
ui->comboBox_AGC->addItem(rig_stragclevel(RIG_AGC_SLOW));
}
//* Meter comboBox
//* Meters & Sub-meter comboBox
//ui->progressBar_Smeter->setMaxValue(5); //FIXME tx_range_list
ui->progressBar_Smeter->setPeak(guiConf.peakHold);
ui->comboBox_Meter->clear();
if (rig_has_get_level(my_rig, RIG_METER_SWR)) ui->comboBox_Meter->addItem("SWR");
if (rig_has_get_level(my_rig, RIG_METER_ALC)) ui->comboBox_Meter->addItem("ALC");
@ -535,25 +546,33 @@ void MainWindow::guiUpdate()
if (rigGet.ptt == RIG_PTT_ON)
{
//ui->pushButton_PTT->setChecked(true);
if (rigGet.vfoTx == rigGet.vfoSub) ui->label_vfoSub->setStyleSheet("QLabel {background-color: red}");
else ui->label_vfoMain->setStyleSheet("QLabel {background-color: red}");
ui->progressBar_Smeter->setTx(true);
if (!ui->progressBar_Smeter->getTx())
{
ui->progressBar_Smeter->setTx(true);
ui->progressBar_Smeter->setValue(0);
ui->progressBar_Smeter->resetPeakValue();
}
ui->progressBar_Smeter->setValue(rigGet.powerMeter.f*100);
ui->progressBar_subMeter->setValue(rigGet.subMeter.f);
}
else //RIG_PTT_OFF
{
//ui->pushButton_PTT->setChecked(false);
if (rigGet.vfoTx == rigGet.vfoSub) ui->label_vfoSub->setStyleSheet("QLabel {}");
else ui->label_vfoMain->setStyleSheet("QLabel {}");
ui->progressBar_Smeter->setTx(false);
if (ui->progressBar_Smeter->getTx())
{
ui->progressBar_Smeter->setTx(false);
ui->progressBar_Smeter->setValue(-54);
ui->progressBar_Smeter->resetPeakValue();
if (rigSet.meter == RIG_LEVEL_SWR) ui->progressBar_subMeter->setValue(1.0);
else ui->progressBar_subMeter->setValue(0.0);
}
ui->progressBar_Smeter->setValue(rigGet.sMeter.i);
if (rigSet.meter == RIG_LEVEL_SWR) ui->progressBar_subMeter->setValue(1.0);
else ui->progressBar_subMeter->setValue(0.0);
}
//* Levels

Wyświetl plik

@ -38,8 +38,8 @@ SMeter::SMeter(QWidget *parent) : QWidget(parent)
meterTx = false;
currentValue = -54;
peakValue = currentValue;
currentValue = minValue;
peakValue = minValue;
peakFactor = 0.1;
peakHold = true;
@ -157,10 +157,6 @@ void SMeter::drawPeak(QPainter *painter)
QRect rect(initX - 2, height()/3+2+1, 2, height()/3-4-2);
painter->drawRect(rect);
//QPointF topPot = QPointF(initX, height()/3+2+1);
//QPointF bottomPot = QPointF(initX, height()*2/3-2-1);
//painter->drawLine(topPot, bottomPot);
painter->restore();
}
@ -319,7 +315,6 @@ void SMeter::drawScaleSMeter(QPainter *painter)
void SMeter::setMinValue(double value)
{
minValue = value;
update();
}
void SMeter::setMaxValue(double value)
@ -336,19 +331,16 @@ void SMeter::setGateValue(double value)
void SMeter::setLongStep(double value)
{
longStep = value;
update();
}
void SMeter::setShortStep(double value)
{
shortStep = value;
update();
}
void SMeter::setPrecision(int value)
{
precision = value;
update();
}
void SMeter::setBgColor(QColor color)
@ -374,7 +366,7 @@ void SMeter::setScaleColor(QColor color)
void SMeter::setValue(double value)
{
currentValue = value;
update();
update(1, height()/3+2+1, width()-14, height()/3-4-2);
}
void SMeter::setValue(int value)
@ -387,6 +379,11 @@ void SMeter::setTx(bool Tx)
meterTx = Tx;
}
bool SMeter::getTx()
{
return meterTx;
}
void SMeter::setPeak(bool Peak)
{
peakHold = Peak;
@ -396,3 +393,9 @@ void SMeter::setPeakFactor(double factor)
{
peakFactor = factor;
}
void SMeter::resetPeakValue()
{
if (meterTx) peakValue = minValue;
else peakValue = -54;
}

Wyświetl plik

@ -46,8 +46,10 @@ public slots:
void setValue(int value);
void setTx(bool Tx);
bool getTx();
void setPeak(bool Peak);
void setPeakFactor(double factor);
void resetPeakValue();
protected:
void paintEvent(QPaintEvent *);