From ea507b6ec8ca72b335560eecba6c9d17132787e3 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Sun, 8 Jan 2017 23:58:09 +0000 Subject: [PATCH] Use the settings frequency list as a source for cal frequencies Some default time signals have been added to the frequency list so a base set can be obtained by resetting the frequency list, alternatively they can be added ad hoc in the normal fashion. FreqCal mode behavior is to select the lowest cal frequency upon entering FreqCal mode and cycling through each cal frequency repeatedly. Ctrl+F10 jumps directly to the next higher frequency. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7463 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- FrequencyList.cpp | 23 ++++++++++++++++++++++- FrequencyList.hpp | 4 +++- mainwindow.cpp | 19 ++++++++++++------- mainwindow.h | 2 ++ 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/FrequencyList.cpp b/FrequencyList.cpp index f3750eab6..20dacebd5 100644 --- a/FrequencyList.cpp +++ b/FrequencyList.cpp @@ -32,26 +32,37 @@ namespace {474200, Modes::JT65}, {474200, Modes::JT9}, {474200, Modes::WSPR}, + {660000, Modes::FreqCal}, + {880000, Modes::FreqCal}, + {1210000, Modes::FreqCal}, {1836600, Modes::WSPR}, {1838000, Modes::JT65}, {1840000, Modes::JT9}, + {2500000, Modes::FreqCal}, + {3330000, Modes::FreqCal}, {3576000, Modes::JT65}, {3578000, Modes::JT9}, {3592600, Modes::WSPR}, {5357000, Modes::JT65}, + {5000000, Modes::FreqCal}, {5287200, Modes::WSPR}, {7038600, Modes::WSPR}, {7076000, Modes::JT65}, {7078000, Modes::JT9}, + {7850000, Modes::FreqCal}, + {10000000, Modes::FreqCal}, {10138000, Modes::JT65}, {10138700, Modes::WSPR}, {10140000, Modes::JT9}, {14095600, Modes::WSPR}, {14076000, Modes::JT65}, {14078000, Modes::JT9}, + {14670000, Modes::FreqCal}, + {15000000, Modes::FreqCal}, {18102000, Modes::JT65}, {18104000, Modes::JT9}, {18104600, Modes::WSPR}, + {20000000, Modes::FreqCal}, {21076000, Modes::JT65}, {21078000, Modes::JT9}, {21094600, Modes::WSPR}, @@ -573,16 +584,26 @@ QMimeData * FrequencyList::impl::mimeData (QModelIndexList const& items) const return mime_data; } -auto FrequencyList::const_iterator::operator * () -> Item const& +auto FrequencyList::const_iterator::operator * () const -> Item const& { return parent_->frequency_list ().at(parent_->mapToSource (parent_->index (row_, 0)).row ()); } +auto FrequencyList::const_iterator::operator -> () const -> Item const * +{ + return &parent_->frequency_list ().at(parent_->mapToSource (parent_->index (row_, 0)).row ()); +} + bool FrequencyList::const_iterator::operator != (const_iterator const& rhs) const { return parent_ != rhs.parent_ || row_ != rhs.row_; } +bool FrequencyList::const_iterator::operator == (const_iterator const& rhs) const +{ + return parent_ == rhs.parent_ && row_ == rhs.row_; +} + auto FrequencyList::const_iterator::operator ++ () -> const_iterator& { ++row_; diff --git a/FrequencyList.hpp b/FrequencyList.hpp index 382768857..1eaaf0226 100644 --- a/FrequencyList.hpp +++ b/FrequencyList.hpp @@ -64,8 +64,10 @@ public: { } - Item const& operator * (); + Item const& operator * () const; + Item const * operator -> () const; bool operator != (const_iterator const&) const; + bool operator == (const_iterator const&) const; const_iterator& operator ++ (); private: diff --git a/mainwindow.cpp b/mainwindow.cpp index 0a5556ff5..f6b7766cf 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -44,7 +44,6 @@ #include "Radio.hpp" #include "Bands.hpp" #include "TransceiverFactory.hpp" -#include "FrequencyList.hpp" #include "StationList.hpp" #include "LiveFrequencyValidator.hpp" #include "MessageClient.hpp" @@ -220,6 +219,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, m_nWSPRdecodes {0}, m_k0 {9999999}, m_nPick {0}, + m_current_frequency_list_iter {m_config.frequencies ()->end ()}, m_TRperiodFast {-1}, m_nTx73 {0}, m_btxok {false}, @@ -4546,6 +4546,7 @@ void MainWindow::on_actionFreqCal_triggered() m_mode="FreqCal"; ui->actionFreqCal->setChecked(true); switch_mode(Modes::FreqCal); + m_current_frequency_list_iter = m_config.frequencies ()->begin (); m_wideGraph->setMode(m_mode); statusChanged(); m_TRperiod=30; @@ -4560,6 +4561,7 @@ void MainWindow::on_actionFreqCal_triggered() setup_status_bar (true); // 18:15:47 0 1 1500 1550.349 0.100 3.5 10.2 ui->decodedTextLabel->setText(" UTC Freq CAL Offset fMeas DF Level S/N"); + on_actionFrequency_calibration_triggered (); } void MainWindow::switch_mode (Mode mode) @@ -6096,12 +6098,15 @@ void MainWindow::on_actionErase_reference_spectrum_triggered() void MainWindow::on_actionFrequency_calibration_triggered() { - static int n=-1; - double fMHz[]={0.660,0.880,1.210,2.500,3.330,5.000, - 7.850,10.000,14.670,15.000,20.000}; - m_freqNominal=1000000.0*fMHz[++n] - m_RxFreq + 0.5; - if(n>=10) n=-1; - on_bandComboBox_activated(-1); + if (m_current_frequency_list_iter != m_config.frequencies ()->end ()) + { + setRig (m_current_frequency_list_iter->frequency_ - m_RxFreq + 0.5); + if (++m_current_frequency_list_iter == m_config.frequencies ()->end ()) + { + // loop back to beginning + m_current_frequency_list_iter = m_config.frequencies ()->begin (); + } + } } void MainWindow::on_sbCQTxFreq_valueChanged(int) diff --git a/mainwindow.h b/mainwindow.h index ce25acaf7..8dc76e59b 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -25,6 +25,7 @@ #include "commons.h" #include "Radio.hpp" #include "Modes.hpp" +#include "FrequencyList.hpp" #include "Configuration.hpp" #include "WSPRBandHopping.hpp" #include "Transceiver.hpp" @@ -378,6 +379,7 @@ private: qint32 m_FtolIndex; qint32 m_Ftol; qint32 m_RxFreq; + FrequencyList::const_iterator m_current_frequency_list_iter; qint32 m_TRperiodFast; qint32 m_nTx73; qint32 m_UTCdisk;