From 26a581a4826bd2728afb4bb2a82f3721bc9c50d1 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Tue, 31 Jan 2017 19:47:51 +0000 Subject: [PATCH] Ensure that Mode=None is enforced when setting or resetting PTT git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7557 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- Configuration.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Configuration.cpp b/Configuration.cpp index 9527c2372..086b1d080 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -379,6 +379,7 @@ private: (WSJT_RIG_NONE_CAN_SPLIT || !rig_is_dummy_) && (rig_params_.split_mode != TransceiverFactory::split_mode_none); } + void set_cached_mode (); bool open_rig (bool force = false); //bool set_mode (); void close_rig (); @@ -2240,18 +2241,25 @@ bool Configuration::impl::open_rig (bool force) return result; } -void Configuration::impl::transceiver_frequency (Frequency f) +void Configuration::impl::set_cached_mode () { - Transceiver::MODE mode {Transceiver::UNK}; + MODE mode {Transceiver::UNK}; + // override cache mode with what we want to enforce which includes + // UNK (unknown) where we want to leave the rig mode untouched switch (data_mode_) { case data_mode_USB: mode = Transceiver::USB; break; case data_mode_data: mode = Transceiver::DIG_U; break; - case data_mode_none: break; + default: break; } - cached_rig_state_.online (true); // we want the rig online cached_rig_state_.mode (mode); +} + +void Configuration::impl::transceiver_frequency (Frequency f) +{ + cached_rig_state_.online (true); // we want the rig online + set_cached_mode (); // apply any offset & calibration // we store the offset here for use in feedback from the rig, we @@ -2269,15 +2277,8 @@ void Configuration::impl::transceiver_tx_frequency (Frequency f) Q_ASSERT (!f || split_mode ()); if (split_mode ()) { - Transceiver::MODE mode {Transceiver::UNK}; - switch (data_mode_) - { - case data_mode_USB: mode = Transceiver::USB; break; - case data_mode_data: mode = Transceiver::DIG_U; break; - case data_mode_none: break; - } cached_rig_state_.online (true); // we want the rig online - cached_rig_state_.mode (mode); + set_cached_mode (); cached_rig_state_.split (f); cached_rig_state_.tx_frequency (f); @@ -2307,6 +2308,7 @@ void Configuration::impl::transceiver_mode (MODE m) void Configuration::impl::transceiver_ptt (bool on) { cached_rig_state_.online (true); // we want the rig online + set_cached_mode (); cached_rig_state_.ptt (on); Q_EMIT set_transceiver (cached_rig_state_, ++transceiver_command_number_); }