Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UV-K5] add option to disable TX on channel and add UV-K5(8) as an alias for UV-K5 #715

Merged
merged 2 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions chirp/drivers/uvk5.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions chirp/share/model_alias_map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -297,3 +297,5 @@ youRUSH:
Quansheng:
- alt: TG-UV2+
model: TG-UV2
- alt: UV-K5
model: UV-K5(8)