First attempt at a useful total-power plotter.

This commit is contained in:
Joe Taylor 2022-09-08 15:27:01 -04:00
parent 32a823afa7
commit b73120dd48
6 changed files with 55 additions and 5 deletions

View File

@ -1531,7 +1531,7 @@ void MainWindow::dataSink(qint64 frames)
if(m_ihsym <=0) return; if(m_ihsym <=0) return;
if(ui) ui->signal_meter_widget->setValue(m_px,m_pxmax); // Update thermometer if(ui) ui->signal_meter_widget->setValue(m_px,m_pxmax); // Update thermometer
if(m_monitoring || m_diskData) { if(m_monitoring || m_diskData) {
m_wideGraph->dataSink2(s,m_df3,m_ihsym,m_diskData); m_wideGraph->dataSink2(s,m_df3,m_ihsym,m_diskData,m_px);
} }
if(m_mode=="MSK144") return; if(m_mode=="MSK144") return;
@ -3166,6 +3166,7 @@ void MainWindow::on_ClrAvgButton_clicked()
if(m_mode=="Echo") { if(m_mode=="Echo") {
echocom_.nsum=0; echocom_.nsum=0;
m_echoGraph->clearAvg(); m_echoGraph->clearAvg();
m_wideGraph->restartTotalPower();
} else { } else {
if(m_msgAvgWidget != NULL) { if(m_msgAvgWidget != NULL) {
if(m_msgAvgWidget->isVisible()) m_msgAvgWidget->displayAvg(""); if(m_msgAvgWidget->isVisible()) m_msgAvgWidget->displayAvg("");

View File

@ -167,6 +167,8 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed)
static QPoint LineBuf[MAX_SCREENSIZE]; static QPoint LineBuf[MAX_SCREENSIZE];
static QPoint LineBuf2[MAX_SCREENSIZE]; static QPoint LineBuf2[MAX_SCREENSIZE];
static QPoint LineBuf3[MAX_SCREENSIZE]; static QPoint LineBuf3[MAX_SCREENSIZE];
static QPoint LineBuf4[MAX_SCREENSIZE];
j=0; j=0;
j0=int(m_startFreq/m_fftBinWidth + 0.5); j0=int(m_startFreq/m_fftBinWidth + 0.5);
int iz=XfromFreq(5000.0); int iz=XfromFreq(5000.0);
@ -231,7 +233,7 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed)
} }
if(i==iz-1 and !m_bQ65_Sync) { if(i==iz-1 and !m_bQ65_Sync and !m_bTotalPower) {
painter2D.drawPolyline(LineBuf,j); painter2D.drawPolyline(LineBuf,j);
} }
LineBuf[j].setX(i); LineBuf[j].setX(i);
@ -320,6 +322,17 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed)
painter2D.drawText(m_w-100,m_h2/2,t); painter2D.drawText(m_w-100,m_h2/2,t);
} }
} }
if(m_bTotalPower) {
painter2D.setPen(Qt::green);
int yy=m_h2 - 10*(m_pdB-20);
LineBuf4[m_x].setX(m_x);
LineBuf4[m_x].setY(yy);
painter2D.drawPolyline(LineBuf4,m_x);
m_x++;
if(m_x > m_w) m_x=0;
}
update(); //trigger a new paintEvent update(); //trigger a new paintEvent
m_bScaleOK=true; m_bScaleOK=true;
} }
@ -874,3 +887,13 @@ void CPlotter::setDiskUTC(int nutc)
{ {
m_nUTC=nutc; m_nUTC=nutc;
} }
void CPlotter::drawTotalPower(float pdB)
{
m_pdB=pdB;
}
void CPlotter::restartTotalPower()
{
m_x=0;
}

View File

@ -34,6 +34,7 @@ public:
QSize sizeHint() const Q_DECL_OVERRIDE; QSize sizeHint() const Q_DECL_OVERRIDE;
void draw(float swide[], bool bScroll, bool bRed); //Update the waterfall void draw(float swide[], bool bScroll, bool bRed); //Update the waterfall
void drawTotalPower(float pdB);
void replot(); void replot();
void SetRunningState(bool running); void SetRunningState(bool running);
void setPlotZero(int plotZero); void setPlotZero(int plotZero);
@ -81,12 +82,15 @@ public:
bool Reference() const {return m_bReference;} bool Reference() const {return m_bReference;}
void setQ65_Sync(bool b) {m_bQ65_Sync = b;} void setQ65_Sync(bool b) {m_bQ65_Sync = b;}
bool Q65_Sync() const {return m_bQ65_Sync;} bool Q65_Sync() const {return m_bQ65_Sync;}
void setTotalPower(bool b) {m_bTotalPower = b;}
bool TotalPower() const {return m_bTotalPower;}
void drawRed(int ia, int ib, float swide[]); void drawRed(int ia, int ib, float swide[]);
void setVHF(bool bVHF); void setVHF(bool bVHF);
void setRedFile(QString fRed); void setRedFile(QString fRed);
void setFST4_FreqRange(int fLow,int fHigh); void setFST4_FreqRange(int fLow,int fHigh);
void setSingleDecode(bool b); void setSingleDecode(bool b);
void setDiskUTC(int nutc); void setDiskUTC(int nutc);
void restartTotalPower();
bool scaleOK () const {return m_bScaleOK;} bool scaleOK () const {return m_bScaleOK;}
signals: signals:
@ -116,12 +120,14 @@ private:
bool m_bReference; bool m_bReference;
bool m_bReference0; bool m_bReference0;
bool m_bQ65_Sync; bool m_bQ65_Sync;
bool m_bTotalPower;
bool m_bVHF; bool m_bVHF;
bool m_bSingleDecode; bool m_bSingleDecode;
bool m_bFirst=true; bool m_bFirst=true;
bool m_bResized; bool m_bResized;
float m_fSpan; float m_fSpan;
float m_pdB;
qint32 m_plotZero; qint32 m_plotZero;
qint32 m_plotGain; qint32 m_plotGain;
@ -137,6 +143,7 @@ private:
qint32 m_nfa; qint32 m_nfa;
qint32 m_nfb; qint32 m_nfb;
qint32 m_nUTC; qint32 m_nUTC;
qint32 m_x=0;
QPixmap m_WaterfallPixmap; QPixmap m_WaterfallPixmap;
QPixmap m_2DPixmap; QPixmap m_2DPixmap;

View File

@ -71,11 +71,13 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) :
ui->widePlot->setLinearAvg(m_settings->value("LinearAvg",false).toBool()); ui->widePlot->setLinearAvg(m_settings->value("LinearAvg",false).toBool());
ui->widePlot->setReference(m_settings->value("Reference",false).toBool()); ui->widePlot->setReference(m_settings->value("Reference",false).toBool());
ui->widePlot->setQ65_Sync(m_settings->value("Q65_Sync",false).toBool()); ui->widePlot->setQ65_Sync(m_settings->value("Q65_Sync",false).toBool());
ui->widePlot->setTotalPower(m_settings->value("TotalPower",false).toBool());
if(ui->widePlot->current()) ui->spec2dComboBox->setCurrentIndex(0); if(ui->widePlot->current()) ui->spec2dComboBox->setCurrentIndex(0);
if(ui->widePlot->cumulative()) ui->spec2dComboBox->setCurrentIndex(1); if(ui->widePlot->cumulative()) ui->spec2dComboBox->setCurrentIndex(1);
if(ui->widePlot->linearAvg()) ui->spec2dComboBox->setCurrentIndex(2); if(ui->widePlot->linearAvg()) ui->spec2dComboBox->setCurrentIndex(2);
if(ui->widePlot->Reference()) ui->spec2dComboBox->setCurrentIndex(3); if(ui->widePlot->Reference()) ui->spec2dComboBox->setCurrentIndex(3);
if(ui->widePlot->Q65_Sync()) ui->spec2dComboBox->setCurrentIndex(4); if(ui->widePlot->Q65_Sync()) ui->spec2dComboBox->setCurrentIndex(4);
if(ui->widePlot->TotalPower()) ui->spec2dComboBox->setCurrentIndex(5);
int nbpp=m_settings->value("BinsPerPixel",2).toInt(); int nbpp=m_settings->value("BinsPerPixel",2).toInt();
ui->widePlot->setBinsPerPixel(nbpp); ui->widePlot->setBinsPerPixel(nbpp);
ui->sbPercent2dPlot->setValue(m_Percent2DScreen); ui->sbPercent2dPlot->setValue(m_Percent2DScreen);
@ -133,6 +135,7 @@ void WideGraph::saveSettings() //saveS
m_settings->setValue ("LinearAvg", ui->widePlot->linearAvg()); m_settings->setValue ("LinearAvg", ui->widePlot->linearAvg());
m_settings->setValue ("Reference", ui->widePlot->Reference()); m_settings->setValue ("Reference", ui->widePlot->Reference());
m_settings->setValue ("Q65_Sync", ui->widePlot->Q65_Sync()); m_settings->setValue ("Q65_Sync", ui->widePlot->Q65_Sync());
m_settings->setValue ("TotalPower", ui->widePlot->TotalPower());
m_settings->setValue ("BinsPerPixel", ui->widePlot->binsPerPixel ()); m_settings->setValue ("BinsPerPixel", ui->widePlot->binsPerPixel ());
m_settings->setValue ("StartFreq", ui->widePlot->startFreq ()); m_settings->setValue ("StartFreq", ui->widePlot->startFreq ());
m_settings->setValue ("WaterfallPalette", m_waterfallPalette); m_settings->setValue ("WaterfallPalette", m_waterfallPalette);
@ -148,11 +151,12 @@ void WideGraph::drawRed(int ia, int ib)
ui->widePlot->drawRed(ia,ib,m_swide); ui->widePlot->drawRed(ia,ib,m_swide);
} }
void WideGraph::dataSink2(float s[], float df3, int ihsym, int ndiskdata) //dataSink2 void WideGraph::dataSink2(float s[], float df3, int ihsym, int ndiskdata, float pdB) //dataSink2
{ {
static float splot[NSMAX]; static float splot[NSMAX];
int nbpp = ui->widePlot->binsPerPixel(); int nbpp = ui->widePlot->binsPerPixel();
if(ui->widePlot->TotalPower()) ui->widePlot->drawTotalPower(pdB);
//Average spectra over specified number, m_waterfallAvg //Average spectra over specified number, m_waterfallAvg
if (m_n==0) { if (m_n==0) {
for (int i=0; i<NSMAX; i++) for (int i=0; i<NSMAX; i++)
@ -313,6 +317,7 @@ void WideGraph::on_spec2dComboBox_currentIndexChanged(int index)
ui->widePlot->setLinearAvg(false); ui->widePlot->setLinearAvg(false);
ui->widePlot->setReference(false); ui->widePlot->setReference(false);
ui->widePlot->setQ65_Sync(false); ui->widePlot->setQ65_Sync(false);
ui->widePlot->setTotalPower(false);
ui->smoSpinBox->setEnabled(false); ui->smoSpinBox->setEnabled(false);
switch (index) switch (index)
{ {
@ -332,7 +337,10 @@ void WideGraph::on_spec2dComboBox_currentIndexChanged(int index)
case 4: case 4:
ui->widePlot->setQ65_Sync(true); ui->widePlot->setQ65_Sync(true);
break; break;
} case 5:
ui->widePlot->setTotalPower(true);
break;
}
replot(); replot();
} }
@ -540,3 +548,8 @@ void WideGraph::setDiskUTC(int nutc)
{ {
ui->widePlot->setDiskUTC(nutc); ui->widePlot->setDiskUTC(nutc);
} }
void WideGraph::restartTotalPower()
{
ui->widePlot->restartTotalPower();
}

View File

@ -26,7 +26,7 @@ public:
explicit WideGraph(QSettings *, QWidget *parent = 0); explicit WideGraph(QSettings *, QWidget *parent = 0);
~WideGraph (); ~WideGraph ();
void dataSink2(float s[], float df3, int ihsym, int ndiskdata); void dataSink2(float s[], float df3, int ihsym, int ndiskdata, float pdB);
void setRxFreq(int n); void setRxFreq(int n);
int rxFreq(); int rxFreq();
int nStartFreq(); int nStartFreq();
@ -51,6 +51,7 @@ public:
void setFST4_FreqRange(int fLow,int fHigh); void setFST4_FreqRange(int fLow,int fHigh);
void setSingleDecode(bool b); void setSingleDecode(bool b);
void setDiskUTC(int nutc); void setDiskUTC(int nutc);
void restartTotalPower();
signals: signals:
void freezeDecode2(int n); void freezeDecode2(int n);

View File

@ -340,6 +340,11 @@
<string>Q65_Sync</string> <string>Q65_Sync</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>Total power (dB)</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="0" column="2">