From f6b99e76d960950e9aeec765357107b534b7a13b Mon Sep 17 00:00:00 2001 From: sq5bpf Date: Mon, 10 Jul 2023 21:37:07 +0200 Subject: [PATCH 1/2] [UV-K5] add option to disable tx on a channel Fixes: #10702 --- chirp/drivers/uvk5.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/chirp/drivers/uvk5.py b/chirp/drivers/uvk5.py index 151276175..2dfe15eb2 100644 --- a/chirp/drivers/uvk5.py +++ b/chirp/drivers/uvk5.py @@ -658,6 +658,7 @@ def get_features(self): rf.valid_name_length = 10 rf.valid_power_levels = UVK5_POWER_LEVELS rf.valid_special_chans = list(SPECIALS.keys()) + rf.valid_duplexes = ["", "-", "+", "off"] # hack so we can input any frequency, # the 0.1 and 0.01 steps don't work unfortunately @@ -704,6 +705,9 @@ def get_raw_memory(self, number): def validate_memory(self, mem): msgs = super().validate_memory(mem) + if mem.duplex == 'off': + return msgs + # find tx frequency if mem.duplex == '-': txfreq = mem.freq - mem.offset @@ -864,7 +868,7 @@ def get_memory(self, number2): # actually the step and duplex are overwritten by chirp based on # bandplan. they are here to document sane defaults for IARU r1 # mem.tuning_step = 25.0 - # mem.duplex = "off" + # mem.duplex = "" return mem @@ -886,7 +890,12 @@ def get_memory(self, number2): mem.duplex = '' else: if _mem.shift == FLAGS1_OFFSET_MINUS: - mem.duplex = '-' + if _mem.freq == _mem.offset: + # fake tx disable by setting tx to 0MHz + mem.duplex = 'off' + mem.offset = 0 + else: + mem.duplex = '-' elif _mem.shift == FLAGS1_OFFSET_PLUS: mem.duplex = '+' else: @@ -1940,13 +1949,17 @@ def set_memory(self, mem): _mem.freq = mem.freq/10 _mem.offset = mem.offset/10 - if mem.duplex == "off" or mem.duplex == "": + if mem.duplex == "": _mem.offset = 0 _mem.shift = 0 elif mem.duplex == '-': _mem.shift = FLAGS1_OFFSET_MINUS elif mem.duplex == '+': _mem.shift = FLAGS1_OFFSET_PLUS + elif mem.duplex == 'off': + # we fake tx disable by setting the tx freq to 0MHz + _mem.shift = FLAGS1_OFFSET_MINUS + _mem.offset = _mem.freq # set band if number < 200: From 7d9ee5c1e690cf7bb07d557f5a0ea621bd821d23 Mon Sep 17 00:00:00 2001 From: sq5bpf Date: Mon, 10 Jul 2023 21:42:17 +0200 Subject: [PATCH 2/2] [UV-K5] add UV-K5(8) as an alias for UV-K5 --- chirp/share/model_alias_map.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chirp/share/model_alias_map.yaml b/chirp/share/model_alias_map.yaml index 1844a6d73..9baa5e146 100644 --- a/chirp/share/model_alias_map.yaml +++ b/chirp/share/model_alias_map.yaml @@ -297,3 +297,5 @@ youRUSH: Quansheng: - alt: TG-UV2+ model: TG-UV2 +- alt: UV-K5 + model: UV-K5(8)