diff --git a/lib/avecho.f90 b/lib/avecho.f90 index 476e4321e..645a96db4 100644 --- a/lib/avecho.f90 +++ b/lib/avecho.f90 @@ -94,5 +94,6 @@ subroutine avecho(id2,ndop,nfrit,nauto,nqual,f1,xlevel,snrdb,db_err, & call pctile(blue(ia:ib),ib-ia+1,50,bblue) blue=blue-bblue -900 return +900 call sleep_msec(10) !Avoid the "blue Decode button" syndrome + return end subroutine avecho diff --git a/widgets/echograph.cpp b/widgets/echograph.cpp index 4bcaa7173..94ccb7aa2 100644 --- a/widgets/echograph.cpp +++ b/widgets/echograph.cpp @@ -2,6 +2,7 @@ #include "commons.h" #include <QSettings> #include <QApplication> +#include <QDebug> #include "echoplot.h" #include "ui_echograph.h" #include "moc_echograph.cpp" @@ -36,6 +37,7 @@ EchoGraph::EchoGraph(QSettings * settings, QWidget *parent) : ui->binsPerPixelSpinBox->setValue(n); ui->echoPlot->m_blue=m_settings->value("BlueCurve",false).toBool(); m_nColor=m_settings->value("EchoColors",0).toInt(); + ui->cbBaseline->setChecked(m_settings->value("Baseline",false).toBool()); m_settings->endGroup(); ui->echoPlot->setColors(m_nColor); } @@ -62,6 +64,7 @@ void EchoGraph::saveSettings() m_settings->setValue("EchoBPP",ui->echoPlot->m_binsPerPixel); m_settings->setValue("BlueCurve",ui->echoPlot->m_blue); m_settings->setValue("EchoColors",m_nColor); + m_settings->setValue("Baseline",ui->cbBaseline->isChecked()); m_settings->endGroup(); } @@ -101,3 +104,23 @@ void EchoGraph::on_pbColors_clicked() m_nColor = (m_nColor+1) % 6; ui->echoPlot->setColors(m_nColor); } + +void EchoGraph::on_cbBaseline_toggled(bool b) +{ + ui->echoPlot->setBaseline(b); +} + +bool EchoGraph::baseline() +{ + return ui->cbBaseline->isChecked(); +} + +void EchoGraph::clearAvg() +{ + for(int i=0; i<4096; i++) { + echocom_.blue[i]=0; + echocom_.red[i]=0; + } + echocom_.nsum=0; + plotSpec(); +} diff --git a/widgets/echograph.h b/widgets/echograph.h index 6e91782f1..329456804 100644 --- a/widgets/echograph.h +++ b/widgets/echograph.h @@ -23,6 +23,8 @@ public: void plotSpec(); void saveSettings(); + void clearAvg(); + bool baseline(); private slots: void on_smoothSpinBox_valueChanged(int n); @@ -30,6 +32,7 @@ private slots: void on_zeroSlider_valueChanged(int value); void on_binsPerPixelSpinBox_valueChanged(int n); void on_pbColors_clicked(); + void on_cbBaseline_toggled(bool b); private: QSettings * m_settings; diff --git a/widgets/echograph.ui b/widgets/echograph.ui index 470a2cc8c..0990db563 100644 --- a/widgets/echograph.ui +++ b/widgets/echograph.ui @@ -189,6 +189,29 @@ </property> </spacer> </item> + <item> + <widget class="QCheckBox" name="cbBaseline"> + <property name="text"> + <string>Baseline</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Preferred</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> <item> <widget class="QSpinBox" name="smoothSpinBox"> <property name="minimumSize"> diff --git a/widgets/echoplot.cpp b/widgets/echoplot.cpp index 34fc33865..65feb7a8e 100644 --- a/widgets/echoplot.cpp +++ b/widgets/echoplot.cpp @@ -127,7 +127,7 @@ void EPlotter::draw() //draw() painter2D.setPen(penBlue); j=0; for(i=0; i<m_w; i++) { - y = 0.9*m_h2 - gain*(m_h/10.0)*(blue[i0+i]) - 0.01*m_h2*m_plotZero; + y = 0.9*m_h2 - gain*(m_h/10.0)*blue[i0+i] - 0.01*m_h2*m_plotZero; LineBuf[j].setX(i); LineBuf[j].setY(y); j++; @@ -145,12 +145,19 @@ void EPlotter::draw() //draw() j=0; for(int i=0; i<m_w; i++) { - y = 0.9*m_h2 - gain*(m_h/10.0)*(red[i0+i]) - 0.01*m_h2*m_plotZero; + y = 0.9*m_h2 - gain*(m_h/10.0)*red[i0+i] - 0.01*m_h2*m_plotZero; LineBuf[j].setX(i); LineBuf[j].setY(y); j++; } painter2D.drawPolyline(LineBuf,j); + + if(m_bBaseline) { + // Draw the baseline + y = 0.9*m_h2 - 0.01*m_h2*m_plotZero; + painter2D.drawLine(0,y,m_w,y); + } + update(); //trigger a new paintEvent } @@ -323,3 +330,9 @@ void EPlotter::setColors(qint32 n) //setSmooth() int EPlotter::plotWidth(){return m_2DPixmap.width();} void EPlotter::UpdateOverlay() {DrawOverlay();} + +void EPlotter::setBaseline(bool b) +{ + m_bBaseline=b; + draw(); +} diff --git a/widgets/echoplot.h b/widgets/echoplot.h index a7492b974..44286fb67 100644 --- a/widgets/echoplot.h +++ b/widgets/echoplot.h @@ -36,6 +36,7 @@ public: qint32 m_binsPerPixel; qint32 m_nColor; bool m_blue; + bool m_bBaseline; void draw(); //Update the Echo plot void SetRunningState(bool running); @@ -49,6 +50,7 @@ public: void setSmooth(int n); int getSmooth(); void setColors(qint32 n); + void setBaseline(bool b); // void SetPercent2DScreen(int percent){m_Percent2DScreen=percent;} diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index fa1874dbe..e32d9e5ca 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -1061,9 +1061,9 @@ void MainWindow::not_GA_warning_message () MessageBox::critical_message (this, "This is a pre-release version of WSJT-X 2.6.0 made\n" "available for testing purposes. By design it will\n" - "be nonfunctional after Nov 30, 2022."); + "be nonfunctional after Dec 31, 2022."); auto now = QDateTime::currentDateTimeUtc (); - if (now >= QDateTime {{2022, 11, 30}, {23, 59, 59, 999}, Qt::UTC}) { + if (now >= QDateTime {{2022, 12, 31}, {23, 59, 59, 999}, Qt::UTC}) { Q_EMIT finished (); } } @@ -1619,15 +1619,20 @@ void MainWindow::dataSink(qint64 frames) } if(m_monitoring or m_auto or m_diskData) { - QString t; - t = t.asprintf("%5.2f %7d %7.1f %7d %7d %7d %7.1f %7.1f",xlevel,nDopTotal,width,echocom_.nsum, - nqual,qRound(dfreq),sigdb,dBerr); QString t0; if(m_diskData) { t0=t0.asprintf("%06d ",m_UTCdisk); } else { t0=QDateTime::currentDateTimeUtc().toString("hhmmss "); } + int n=t0.toInt(); + int nsec=((n/10000)*3600) + (((n/100)%100)*60) + (n%100); + if(!m_echoRunning) m_echoSec0=nsec; + n=(nsec-m_echoSec0 + 864000)%86400; + m_echoRunning=true; + QString t; + t = t.asprintf("%6d %5.2f %7d %7.1f %7d %7d %7d %7.1f %7.1f",n,xlevel, + nDopTotal,width,echocom_.nsum,nqual,qRound(dfreq),sigdb,dBerr); t = t0 + t; if (ui) ui->decodedTextBrowser->appendText(t); } @@ -2013,6 +2018,7 @@ void MainWindow::on_monitorButton_clicked (bool checked) } else { ui->monitorButton->setChecked (false); // disallow } + if(m_mode=="Echo") m_echoRunning=false; } void MainWindow::monitor (bool state) @@ -2050,6 +2056,7 @@ void MainWindow::on_autoButton_clicked (bool checked) echocom_.nsum=0; } m_tAutoOn=QDateTime::currentMSecsSinceEpoch()/1000; + if(m_mode=="Echo") m_echoRunning=false; } void MainWindow::on_sbTxPercent_valueChanged (int n) @@ -3152,6 +3159,7 @@ void MainWindow::on_ClrAvgButton_clicked() m_nclearave=1; if(m_mode=="Echo") { echocom_.nsum=0; + m_echoGraph->clearAvg(); } else { if(m_msgAvgWidget != NULL) { if(m_msgAvgWidget->isVisible()) m_msgAvgWidget->displayAvg(""); @@ -4706,6 +4714,7 @@ void MainWindow::guiUpdate() ui->txb1->setEnabled(true); } } + if(m_mode=="Echo" and !m_monitoring and !m_auto and !m_diskData) m_echoRunning=false; //Once per second (onesec) if(nsec != m_sec0) { @@ -7106,7 +7115,7 @@ void MainWindow::on_actionEcho_triggered() m_bFastMode=false; m_bFast9=false; WSPR_config(true); - ui->lh_decodes_headings_label->setText(" UTC Level Doppler Width N Q DF SNR dBerr"); + ui->lh_decodes_headings_label->setText(" UTC Tsec Level Doppler Width N Q DF SNR dBerr"); // 01234567890123456789012345678901234567 displayWidgets(nWidgets("00000000000000000010001000000000000000")); fast_config(false); @@ -7690,7 +7699,7 @@ void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const& if (old_state.online () == false && s.online () == true) { // initializing - on_monitorButton_clicked (!m_config.monitor_off_at_startup ()); + on_monitorButton_clicked (!(m_config.monitor_off_at_startup() or m_mode=="Echo")); } if (s.frequency () != old_state.frequency () || s.split () != m_splitMode) { @@ -10003,8 +10012,6 @@ void MainWindow::on_jt65Button_clicked() void MainWindow::on_actionCopy_to_WSJTX_txt_triggered() { - qDebug() << ui->decodedTextBrowser->toPlainText(); - static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("WSJT-X.txt")}; if(!f.open(QIODevice::Text | QIODevice::WriteOnly)) { MessageBox::warning_message (this, tr ("WSJT-X.txt file error"), diff --git a/widgets/mainwindow.h b/widgets/mainwindow.h index d3a6e0060..0c7cf3647 100644 --- a/widgets/mainwindow.h +++ b/widgets/mainwindow.h @@ -507,6 +507,7 @@ private: qint32 m_points=-99; qint32 m_score=0; qint32 m_fDop=0; + qint32 m_echoSec0=0; bool m_btxok; //True if OK to transmit bool m_diskData; @@ -736,7 +737,8 @@ private: QThread::Priority m_audioThreadPriority; bool m_bandEdited; bool m_splitMode; - bool m_monitoring; + bool m_monitoring=false; + bool m_echoRunning=false; bool m_tx_when_ready; bool m_transmitting; bool m_tune;