From 1f50408b295ef87219ef47ce012bee80a30f41d8 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Mon, 1 Jun 2015 19:31:40 +0000 Subject: [PATCH] Fix regression in applying transverter offset Somehow I had decided that the offset could be determined from the frequency coming from the rig, this is of course impossible so the code now reverts to saving the offset used for the last frequency set and sticks with it until another frequency is set. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5485 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- Configuration.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Configuration.cpp b/Configuration.cpp index c5afb6001..5e215daae 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -471,6 +471,7 @@ private: FrequencyList next_frequencies_; StationList stations_; StationList next_stations_; + FrequencyDelta current_offset_; QAction * frequency_delete_action_; QAction * frequency_insert_action_; @@ -703,6 +704,7 @@ Configuration::impl::impl (Configuration * self, QSettings * settings, QWidget * , next_frequencies_ {&bands_} , stations_ {&bands_} , next_stations_ {&bands_} + , current_offset_ {0} , frequency_dialog_ {new FrequencyDialog {&modes_, this}} , station_dialog_ {new StationDialog {&next_stations_, &bands_, this}} , rig_active_ {false} @@ -2122,7 +2124,12 @@ void Configuration::impl::transceiver_frequency (Frequency f) cached_rig_state_.mode (mode); // apply any offset & calibration - Q_EMIT frequency (apply_calibration (f + stations_.offset (f)), mode); + // we store the offset here for use in feedback from the rig, we + // cannot absolutely determine if the offset should apply but by + // simply picking an offset when the Rx frequency is set and + // sticking to it we get sane behaviour + current_offset_ = stations_.offset (f); + Q_EMIT frequency (apply_calibration (f + current_offset_), mode); } } @@ -2137,7 +2144,12 @@ void Configuration::impl::transceiver_tx_frequency (Frequency f) if (cached_rig_state_.split ()) { // apply and offset and calibration - f = apply_calibration (f + stations_.offset (f)); + // we store the offset here for use in feedback from the + // rig, we cannot absolutely determine if the offset should + // apply but by simply picking an offset when the Rx + // frequency is set and sticking to it we get sane behaviour + current_offset_ = stations_.offset (f); + f = apply_calibration (f + current_offset_); } @@ -2248,12 +2260,12 @@ void Configuration::impl::handle_transceiver_update (TransceiverState state) } // take off calibration & offset - state.frequency (remove_calibration (state.frequency ()) - stations_.offset (state.frequency ())); + state.frequency (remove_calibration (state.frequency ()) - current_offset_); if (state.tx_frequency ()) { // take off calibration & offset - state.tx_frequency (remove_calibration (state.tx_frequency ()) - stations_.offset (state.tx_frequency ())); + state.tx_frequency (remove_calibration (state.tx_frequency ()) - current_offset_); } cached_rig_state_ = state;