Skip to content

Commit

Permalink
Fix #6: Allow Duplex=off as a way to disable TX
Browse files Browse the repository at this point in the history
  • Loading branch information
egzumer committed Dec 22, 2023
1 parent ceb028d commit 7015d8d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions uvk5_egzumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@ def get_features(self):
rf.valid_name_length = 10
rf.valid_power_levels = UVK5_POWER_LEVELS
rf.valid_special_chans = self.Get_VFO_CHANNEL_NAMES()
rf.valid_duplexes = ["", "-", "+", "off"]

steps = STEPS.copy()
steps.sort()
Expand Down Expand Up @@ -752,6 +753,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 @@ -939,7 +943,12 @@ def get_memory(self, number2):
mem.duplex = ''
else:
if _mem.offsetDir == FLAGS1_OFFSET_MINUS:
mem.duplex = '-'
if _mem.freq == _mem.offset:
# fake tx disable by setting tx to 0 MHz
mem.duplex = 'off'
mem.offset = 0
else:
mem.duplex = '-'
elif _mem.offsetDir == FLAGS1_OFFSET_PLUS:
mem.duplex = '+'
else:
Expand Down Expand Up @@ -2127,7 +2136,10 @@ def set_memory(self, mem):
_mem.offsetDir = FLAGS1_OFFSET_MINUS
elif mem.duplex == '+':
_mem.offsetDir = FLAGS1_OFFSET_PLUS

elif mem.duplex == 'off':
# we fake tx disable by setting the tx freq to 0 MHz
_mem.offsetDir = FLAGS1_OFFSET_MINUS
_mem.offset = _mem.freq
# set band
if number < 200:
_mem4.channel_attributes[number].is_free = 0
Expand Down

0 comments on commit 7015d8d

Please sign in to comment.