retevis_rt21: Fix duplex=off

And also fix up some byte unclean stuff.
This commit is contained in:
Dan Smith 2024-02-23 17:22:29 -08:00 committed by Dan Smith
parent d8cb60cf35
commit cbb06d9aea

View File

@ -910,7 +910,7 @@ class RT21Radio(chirp_common.CloneModeRadio):
mem.empty = True
return mem
if _mem.rxfreq.get_raw(asbytes=False) == "\xFF\xFF\xFF\xFF":
if _mem.rxfreq.get_raw() == b"\xFF\xFF\xFF\xFF":
mem.freq = 0
mem.empty = True
return mem
@ -918,6 +918,8 @@ class RT21Radio(chirp_common.CloneModeRadio):
if int(_mem.rxfreq) == int(_mem.txfreq):
mem.duplex = ""
mem.offset = 0
elif _mem.txfreq.get_raw() == b"\xFF\xFF\xFF\xFF":
mem.duplex = "off"
else:
mem.duplex = int(_mem.rxfreq) > int(_mem.txfreq) and "-" or "+"
mem.offset = abs(int(_mem.rxfreq) - int(_mem.txfreq)) * 10
@ -1214,8 +1216,7 @@ class RT21Radio(chirp_common.CloneModeRadio):
_mem.rxfreq = mem.freq / 10
if mem.duplex == "off":
for i in range(0, 4):
_mem.txfreq[i].set_raw("\xFF")
_mem.txfreq.fill_raw(b"\xFF")
elif mem.duplex == "split":
_mem.txfreq = mem.offset / 10
elif mem.duplex == "+":