From e802e27f02789c28fd6241bcf97a4589519de08d Mon Sep 17 00:00:00 2001 From: Allan Bazinet Date: Thu, 24 Oct 2024 21:25:49 -0700 Subject: [PATCH] Use float precision for dial frequency --- mainwindow.cpp | 2 +- plotter.cpp | 14 +++++++------- plotter.h | 16 ++++++++-------- widegraph.cpp | 4 ++-- widegraph.h | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index d619b2ba..d9428369 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -7961,7 +7961,7 @@ void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const& aprsSetLocal(); } statusChanged(); - m_wideGraph->setDialFreq(m_freqNominal / 1.e6); + m_wideGraph->setDialFreq(m_freqNominal / 1.e6f); } } else { m_freqTxNominal = s.split () ? s.tx_frequency () : s.frequency (); diff --git a/plotter.cpp b/plotter.cpp index f39bacbe..87dbcce8 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -23,13 +23,13 @@ namespace // 30 meter band: 10.130-10.140 RTTY // 10.140-10.150 Packet - constexpr double BAND_30M_START = 10.13; - constexpr double BAND_30M_END = 10.15; + constexpr float BAND_30M_START = 10.13f; + constexpr float BAND_30M_END = 10.15f; - // The WSPR range is 200Hz in the 30m band, starting at 10.1401 MHz. + // The WSPR range starts at 10.1401 MHz and runs for 200 Hz. - constexpr double WSPR_RANGE = 200.0; - constexpr double WSPR_START = 10.1401; + constexpr float WSPR_START = 10.1401f; + constexpr int WSPR_RANGE = 200; // FFT bin width, as with NSPS, a constant; see the JT9 documentation // for the reasoning behind the values used here, but in short, since @@ -672,9 +672,9 @@ CPlotter::setFreq(int const freq) } void -CPlotter::setDialFreq(double const d) +CPlotter::setDialFreq(float const dialFreq) { - m_dialFreq = d; + m_dialFreq = dialFreq; drawOverlay(); update(); } diff --git a/plotter.h b/plotter.h index 7de09e94..1abff6f5 100644 --- a/plotter.h +++ b/plotter.h @@ -80,7 +80,7 @@ public: void setPlot2dGain(int n); void setBinsPerPixel(int n); void setPeriod(int n); - void setDialFreq(double d); + void setDialFreq(float); void setBand(QString const & band); void setFilterCenter(int center); void setFilterWidth(int width); @@ -139,11 +139,8 @@ private: QSize m_size; QString m_band; - bool m_filterEnabled = false; - bool m_paintEventBusy = false; - bool m_scaleOK = false; - bool m_replot = false; - bool m_flatten = false; + float m_fSpan = 2000.0f; + float m_dialFreq = 0.0f; int m_nSubMode = 0; int m_filterCenter = 0; @@ -168,8 +165,11 @@ private: int m_j = 0; int m_TRperiod = 15; - float m_fSpan = 2000.0f; - double m_dialFreq = 0.0; + bool m_filterEnabled = false; + bool m_paintEventBusy = false; + bool m_scaleOK = false; + bool m_replot = false; + bool m_flatten = false; }; #endif // PLOTTER_H diff --git a/widegraph.cpp b/widegraph.cpp index eb2196e8..52fdeae1 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -706,9 +706,9 @@ WideGraph::on_spec2dComboBox_currentIndexChanged(int const index) } void -WideGraph::setDialFreq(double const d) +WideGraph::setDialFreq(float const dialFreq) { - ui->widePlot->setDialFreq(d); + ui->widePlot->setDialFreq(dialFreq); } void diff --git a/widegraph.h b/widegraph.h index a9d59ce5..f0b89be5 100644 --- a/widegraph.h +++ b/widegraph.h @@ -93,7 +93,7 @@ signals: void drifted(int, int); public slots: - void setDialFreq(double); + void setDialFreq(float); void setTimeControlsVisible(bool); bool timeControlsVisible() const; void setControlsVisible(bool, bool = true);