From fdfb655b0610fdbbe12499e7891211a4e3b117c1 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Mon, 25 Feb 2019 15:04:05 -0500 Subject: [PATCH] Option to select "Low sidelobes" or "Most sensitive" for waterfall spectra. --- Configuration.cpp | 7 ++++++ Configuration.hpp | 2 ++ Configuration.ui | 56 ++++++++++++++++++++++++++++++++++++------ lib/symspec.f90 | 36 ++++++++++++--------------- widgets/mainwindow.cpp | 8 +++--- 5 files changed, 79 insertions(+), 30 deletions(-) diff --git a/Configuration.cpp b/Configuration.cpp index 8fcb5cee1..059c514c8 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -630,6 +630,7 @@ private: bool udpWindowToFront_; bool udpWindowRestore_; DataMode data_mode_; + bool bLowSidelobes_; bool pwrBandTxMemory_; bool pwrBandTuneMemory_; @@ -720,6 +721,7 @@ bool Configuration::accept_udp_requests () const {return m_->accept_udp_requests QString Configuration::n1mm_server_name () const {return m_->n1mm_server_name_;} auto Configuration::n1mm_server_port () const -> port_type {return m_->n1mm_server_port_;} bool Configuration::broadcast_to_n1mm () const {return m_->broadcast_to_n1mm_;} +bool Configuration::lowSidelobes() const {return m_->bLowSidelobes_;} bool Configuration::udpWindowToFront () const {return m_->udpWindowToFront_;} bool Configuration::udpWindowRestore () const {return m_->udpWindowRestore_;} Bands * Configuration::bands () {return &m_->bands_;} @@ -1285,6 +1287,8 @@ void Configuration::impl::initialize_models () ui_->udpWindowRestore->setChecked(udpWindowRestore_); ui_->calibration_intercept_spin_box->setValue (calibration_.intercept); ui_->calibration_slope_ppm_spin_box->setValue (calibration_.slope_ppm); + ui_->rbLowSidelobes->setChecked(bLowSidelobes_); + if(!bLowSidelobes_) ui_->rbMaxSensitivity->setChecked(true); if (rig_params_.ptt_port.isEmpty ()) { @@ -1476,6 +1480,7 @@ void Configuration::impl::read_settings () rig_params_.audio_source = settings_->value ("TXAudioSource", QVariant::fromValue (TransceiverFactory::TX_audio_source_front)).value (); rig_params_.ptt_port = settings_->value ("PTTport").toString (); data_mode_ = settings_->value ("DataMode", QVariant::fromValue (data_mode_none)).value (); + bLowSidelobes_ = settings_->value("LowSidelobes",true).toBool(); prompt_to_log_ = settings_->value ("PromptToLog", false).toBool (); autoLog_ = settings_->value ("AutoLog", false).toBool (); decodes_from_top_ = settings_->value ("DecodesFromTop", false).toBool (); @@ -1577,6 +1582,7 @@ void Configuration::impl::write_settings () settings_->setValue ("CATStopBits", QVariant::fromValue (rig_params_.stop_bits)); settings_->setValue ("CATHandshake", QVariant::fromValue (rig_params_.handshake)); settings_->setValue ("DataMode", QVariant::fromValue (data_mode_)); + settings_->setValue ("LowSidelobes",bLowSidelobes_); settings_->setValue ("PromptToLog", prompt_to_log_); settings_->setValue ("AutoLog", autoLog_); settings_->setValue ("DecodesFromTop", decodes_from_top_); @@ -2035,6 +2041,7 @@ void Configuration::impl::accept () watchdog_ = ui_->tx_watchdog_spin_box->value (); TX_messages_ = ui_->TX_messages_check_box->isChecked (); data_mode_ = static_cast (ui_->TX_mode_button_group->checkedId ()); + bLowSidelobes_ = ui_->rbLowSidelobes->isChecked(); save_directory_ = ui_->save_path_display_label->text (); azel_directory_ = ui_->azel_path_display_label->text (); enable_VHF_features_ = ui_->enable_VHF_features_check_box->isChecked (); diff --git a/Configuration.hpp b/Configuration.hpp index 9aa0c286b..991e126fb 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -137,6 +137,7 @@ public: bool twoPass() const; bool bFox() const; bool bHound() const; + bool bLowSidelobes() const; bool x2ToneSpacing() const; bool x4ToneSpacing() const; bool MyDx() const; @@ -152,6 +153,7 @@ public: port_type n1mm_server_port () const; bool valid_n1mm_info () const; bool broadcast_to_n1mm() const; + bool lowSidelobes() const; bool accept_udp_requests () const; bool udpWindowToFront () const; bool udpWindowRestore () const; diff --git a/Configuration.ui b/Configuration.ui index 9bc5f35aa..e2c0b3819 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -17,7 +17,7 @@ - 0 + 7 @@ -2821,6 +2821,48 @@ Right click for insert and delete options. + + + + + 0 + 50 + + + + Waterfall spectra + + + + + 10 + 20 + 91 + 17 + + + + Low sidelobes + + + true + + + + + + 120 + 20 + 92 + 17 + + + + Most sensitive + + + + @@ -3036,13 +3078,13 @@ Right click for insert and delete options. - - - - - - + + + + + + diff --git a/lib/symspec.f90 b/lib/symspec.f90 index 20bf4dbf1..78215e209 100644 --- a/lib/symspec.f90 +++ b/lib/symspec.f90 @@ -1,13 +1,14 @@ -subroutine symspec(shared_data,k,ntrperiod,nsps,ingain,nminw,pxdb,s, & - df3,ihsym,npts8,pxdbmax) +subroutine symspec(shared_data,k,ntrperiod,nsps,ingain,bLowSidelobes, & + nminw,pxdb,s,df3,ihsym,npts8,pxdbmax) ! Input: -! k pointer to the most recent new data -! ntrperiod T/R sequence length, minutes -! nsps samples per symbol, at 12000 Hz -! ndiskdat 0/1 to indicate if data from disk -! nb 0/1 status of noise blanker (off/on) -! nbslider NB setting, 0-100 +! k pointer to the most recent new data +! ntrperiod T/R sequence length, minutes +! nsps samples per symbol, at 12000 Hz +! bLowSidelobes true to use windowed FFTs +! ndiskdat 0/1 to indicate if data from disk +! nb 0/1 status of noise blanker (off/on) +! nbslider NB setting, 0-100 ! Output: ! pxdb raw power (0-90 dB) @@ -29,6 +30,7 @@ subroutine symspec(shared_data,k,ntrperiod,nsps,ingain,nminw,pxdb,s, & real*4 tmp(NSMAX) complex cx(0:MAXFFT3/2) integer nch(7) + logical*1 bLowSidelobes common/spectra/syellow(NSMAX),ref(0:3456),filter(0:3456) data k0/99999999/,nfft3z/0/ @@ -48,23 +50,17 @@ subroutine symspec(shared_data,k,ntrperiod,nsps,ingain,nminw,pxdb,s, & if(nfft3.ne.nfft3z) then ! Compute new window pi=4.0*atan(1.0) -! width=0.25*nsps -! do i=1,nfft3 -! z=(i-nfft3/2)/width -! w3(i)=exp(-z*z) -! enddo ! Coefficients taken from equation 37 of NUSC report: ! "Some windows with very good sidelobe behavior: application to ! discrete Hilbert Transform, by Albert Nuttall" -! a0=0.3635819 a1=-0.4891775; a2=0.1365995; a3=-0.0106411; do i=1,nfft3 - w3(i)=a0+a1*cos(2*pi*(i-1)/(nfft3))+ & - a2*cos(4*pi*(i-1)/(nfft3))+ & - a3*cos(6*pi*(i-1)/(nfft3)) + w3(i)=a0+a1*cos(2*pi*(i-1)/(nfft3))+ & + a2*cos(4*pi*(i-1)/(nfft3))+ & + a3*cos(6*pi*(i-1)/(nfft3)) enddo nfft3z=nfft3 endif @@ -99,10 +95,10 @@ subroutine symspec(shared_data,k,ntrperiod,nsps,ingain,nminw,pxdb,s, & enddo ihsym=ihsym+1 - xc(0:nfft3-1)=w3(1:nfft3)*xc(0:nfft3-1) !Apply window w3 - call four2a(xc,nfft3,1,-1,0) !Real-to-complex FFT + if(bLowSidelobes) xc(0:nfft3-1)=w3(1:nfft3)*xc(0:nfft3-1) !Apply window + call four2a(xc,nfft3,1,-1,0) !Real-to-complex FFT - df3=12000.0/nfft3 !JT9-1: 0.732 Hz = 0.42 * tone spacing + df3=12000.0/nfft3 !JT9: 0.732 Hz = 0.42 * tone spacing iz=min(NSMAX,nint(5000.0/df3)) fac=(1.0/nfft3)**2 do i=1,iz diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 78b70229a..60daea9aa 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -86,8 +86,8 @@ extern "C" { //----------------------------------------------------- C and Fortran routines void symspec_(struct dec_data *, int* k, int* ntrperiod, int* nsps, int* ingain, - int* minw, float* px, float s[], float* df3, int* nhsym, int* npts8, - float *m_pxmax); + bool* bLowSidelobes, int* minw, float* px, float s[], float* df3, + int* nhsym, int* npts8, float *m_pxmax); void hspec_(short int d2[], int* k, int* nutc0, int* ntrperiod, int* nrxfreq, int* ntol, int* nContest, bool* bmsk144, bool* btrain, double const pcoeffs[], int* ingain, @@ -1364,7 +1364,9 @@ void MainWindow::dataSink(qint64 frames) int nsps=m_nsps; if(m_bFastMode) nsps=6912; int nsmo=m_wideGraph->smoothYellow()-1; - symspec_(&dec_data,&k,&trmin,&nsps,&m_inGain,&nsmo,&m_px,s,&m_df3,&m_ihsym,&m_npts8,&m_pxmax); + bool bLowSidelobes=m_config.lowSidelobes(); + symspec_(&dec_data,&k,&trmin,&nsps,&m_inGain,&bLowSidelobes,&nsmo,&m_px,s, + &m_df3,&m_ihsym,&m_npts8,&m_pxmax); if(m_mode=="WSPR") wspr_downsample_(dec_data.d2,&k); if(m_ihsym <=0) return; if(ui) ui->signal_meter_widget->setValue(m_px,m_pxmax); // Update thermometer