From 2cfc1fdbba25612f3ded5245c79a50249985823d Mon Sep 17 00:00:00 2001
From: Bill Somerville <g4wjs@classdesign.com>
Date: Fri, 3 Apr 2015 18:50:48 +0000
Subject: [PATCH] Try to leave the bandwidth of the rig untouched

Hamlib conflates mode and bandwidth which sometimes make it impossible
to  change mode  without  forcing a  bandwidth change.   Unfortunately
Hamlib  has  no  bandwidth  value  that is  documented  to  leave  the
bandwidth as is, despite this being easy to implement. Many Hamlib rig
back ends do interpret RIG_PASSBAND_NORMAL as "don't explicitly change
the bandwidth".

Some rigs  like the  Tentec Jupiter  have a  widest bandwidth  of 8kHz
which is larger than desired for this application so the old behaviour
of setting the default wide bandwidth  is not very friendly. Also many
rig  back ends  in Hamlib  do not  do the  required bandwidth  setting
correctly due  to the CAT protocol  having no way of  discovering user
defined bandwidth allocations.

Merged from wsjtx-1.4 branch.



git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5151 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
---
 HamlibTransceiver.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/HamlibTransceiver.cpp b/HamlibTransceiver.cpp
index 99caed2b9..093510b8d 100644
--- a/HamlibTransceiver.cpp
+++ b/HamlibTransceiver.cpp
@@ -273,7 +273,7 @@ void HamlibTransceiver::do_start ()
       freq_t f2;
       rmode_t m {RIG_MODE_USB};
       rmode_t mb;
-      pbwidth_t w {rig_passband_wide (rig_.data (), m)};
+      pbwidth_t w {RIG_PASSBAND_NORMAL};
       pbwidth_t wb;
       if (!rig_->caps->get_vfo && (rig_->caps->set_vfo || rig_has_vfo_op (rig_.data (), RIG_OP_TOGGLE)))
         {
@@ -584,7 +584,7 @@ void HamlibTransceiver::do_tx_frequency (Frequency tx, bool rationalise_mode)
 #if WSJT_TRACE_CAT
                   qDebug () << "HamlibTransceiver::do_tx_frequency rig_set_split_mode mode = " << rig_strrmode (new_mode);
 #endif
-                  error_check (rig_set_split_mode (rig_.data (), RIG_VFO_CURR, new_mode, rig_passband_wide (rig_.data (), new_mode)), tr ("setting split TX VFO mode"));
+                  error_check (rig_set_split_mode (rig_.data (), RIG_VFO_CURR, new_mode, RIG_PASSBAND_NORMAL), tr ("setting split TX VFO mode"));
 
                   // do this again as setting the mode may change the frequency
                   error_check (rig_set_split_freq (rig_.data (), RIG_VFO_CURR, tx), tr ("setting split TX frequency"));
@@ -644,7 +644,7 @@ void HamlibTransceiver::do_mode (MODE mode, bool rationalise)
 #if WSJT_TRACE_CAT
           qDebug () << "HamlibTransceiver::do_mode rig_set_mode mode = " << rig_strrmode (new_mode);
 #endif
-          error_check (rig_set_mode (rig_.data (), RIG_VFO_CURR, new_mode, rig_passband_wide (rig_.data (), new_mode)), tr ("setting current VFO mode"));
+          error_check (rig_set_mode (rig_.data (), RIG_VFO_CURR, new_mode, RIG_PASSBAND_NORMAL), tr ("setting current VFO mode"));
         }
       
       if (state ().split () && rationalise)
@@ -663,7 +663,7 @@ void HamlibTransceiver::do_mode (MODE mode, bool rationalise)
               qDebug () << "HamlibTransceiver::do_mode rig_set_split_mode mode = " << rig_strrmode (new_mode);
 #endif
               hamlib_tx_vfo_fixup fixup (rig_.data (), tx_vfo);
-              error_check (rig_set_split_mode (rig_.data (), RIG_VFO_CURR, new_mode, rig_passband_wide (rig_.data (), new_mode)), tr ("setting split TX VFO mode"));
+              error_check (rig_set_split_mode (rig_.data (), RIG_VFO_CURR, new_mode, RIG_PASSBAND_NORMAL), tr ("setting split TX VFO mode"));
             }
         }
     }