[chirp_devel] [PATCH] [New Model] Support for the BTECH Mobile Radios, update 1 for #3015

Jim Unroe
Sun Mar 27 18:01:11 PDT 2016


# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1459126256 14400
# Node ID c7ad0f850fc95ac27e98ff47b127127bcd60acfe
# Parent  1dea27fb59f7adefe00398d8e5648120cddc8e12
[New Model] Support for the BTECH Mobile Radios, update 1 for #3015

This patch includes the following changes:

Bug fixes
- Fixed the bug found by minuteman1120 about the duplex not working in some
  cases
- New "split" algorithm for the duplex bug above

diff -r 1dea27fb59f7 -r c7ad0f850fc9 chirp/drivers/btech.py
--- a/chirp/drivers/btech.py	Tue Mar 22 18:50:50 2016 -0700
+++ b/chirp/drivers/btech.py	Sun Mar 27 20:50:56 2016 -0400
@@ -580,6 +580,21 @@
     return (ilow, ihigh)
 
 
+def _split(rf, f1, f2):
+    """Returns False if the two freqs are in the same band (no split)
+    or True otherwise"""
+
+    # determine if the two freqs are in the same band
+    for low, high in rf.valid_bands:
+        if f1 >= low and f1 <= high and \
+                f2 >= low and f2 <= high:
+            # if the two freqs are on the same Band this is not a split
+            return False
+
+    # if you get here is because the freq pairs are split
+    return False
+
+
 class btech(chirp_common.CloneModeRadio, chirp_common.ExperimentalRadio):
     """BTECH's UV-5001 and alike radios"""
     VENDOR = "BTECH"
@@ -805,7 +820,7 @@
             # TX freq set
             offset = (int(_mem.txfreq) * 10) - mem.freq
             if offset != 0:
-                if offset > 70000000:   # 70 Mhz
+                if _split(self.get_features(), mem.freq, int(_mem.txfreq) * 10):
                     mem.duplex = "split"
                     mem.offset = int(_mem.txfreq) * 10
                 elif offset < 0:



More information about the chirp_devel mailing list