Skip to content

Commit f8aa7dd

Browse files
committed
Refactor
1 parent b83468f commit f8aa7dd

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed

uvk5_egzumer.py

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ def get_memory(self, number2):
965965

966966
# We'll also look at the channel attributes if a memory has them
967967
tmpscn = SCANLIST_LIST[0]
968-
tmpComp = COMPANDER_LIST[0]
968+
tmpComp = 0
969969
if number < 200:
970970
_mem3 = self._memobj.ch_attr[number]
971971
# free memory bit
@@ -974,7 +974,7 @@ def get_memory(self, number2):
974974
# scanlists
975975
tempVal = _mem3.is_scanlist1 + _mem3.is_scanlist2 * 2
976976
tmpscn = SCANLIST_LIST[tempVal]
977-
tmpComp = COMPANDER_LIST[_mem3.compander]
977+
tmpComp = listDef(_mem3.compander, COMPANDER_LIST, 0)
978978

979979
if is_empty:
980980
mem.empty = True
@@ -1083,43 +1083,37 @@ def get_memory(self, number2):
10831083
mem.extra = RadioSettingGroup("Extra", "extra")
10841084

10851085
# BusyCL
1086-
is_bclo = bool(_mem.busyChLockout)
1087-
rs = RadioSetting("busyChLockout", "Busy Ch Lockout (BusyCL)", RadioSettingValueBoolean(is_bclo))
1086+
val = RadioSettingValueBoolean(_mem.busyChLockout)
1087+
rs = RadioSetting("busyChLockout", "Busy Ch Lockout (BusyCL)", val)
10881088
mem.extra.append(rs)
1089-
tmpcomment += "BusyCL:"+(is_bclo and "ON" or "OFF")+" "
10901089

1091-
# Frequency reverse - whatever that means, don't see it in the manual
1092-
is_frev = bool(_mem.freq_reverse > 0)
1093-
rs = RadioSetting("frev", "Reverse Frequencies", RadioSettingValueBoolean(is_frev))
1090+
# Frequency reverse
1091+
val = RadioSettingValueBoolean(_mem.freq_reverse)
1092+
rs = RadioSetting("frev", "Reverse Frequencies", val)
10941093
mem.extra.append(rs)
1095-
tmpcomment += "FreqReverse:"+(is_frev and "ON" or "OFF")+" "
10961094

10971095
# PTTID
10981096
pttid = listDef(_mem.dtmf_pttid, PTTID_LIST, 0)
1099-
rs = RadioSetting("pttid", "PTT ID (PTT ID)", RadioSettingValueList(
1100-
PTTID_LIST, PTTID_LIST[pttid]))
1097+
val = RadioSettingValueList(PTTID_LIST, None, pttid)
1098+
rs = RadioSetting("pttid", "PTT ID (PTT ID)", val)
11011099
mem.extra.append(rs)
1102-
tmpcomment += "PTTid:"+PTTID_LIST[pttid]+" "
11031100

11041101
# DTMF DECODE
1105-
is_dtmf = bool(_mem.dtmf_decode > 0)
1106-
rs = RadioSetting("dtmfdecode", "DTMF decode (D Decd)",
1107-
RadioSettingValueBoolean(is_dtmf))
1108-
mem.extra.append(rs)
1109-
tmpcomment += "DTMFdecode:"+(is_dtmf and "ON" or "OFF") + " "
1102+
val = RadioSettingValueBoolean(_mem.dtmf_decode)
1103+
rs = RadioSetting("dtmfdecode", "DTMF decode (D Decd)", val)
1104+
if self._memobj.BUILD_OPTIONS.ENABLE_DTMF_CALLING:
1105+
mem.extra.append(rs)
11101106

11111107
# Scrambler
1112-
enc = _mem.scrambler if _mem.scrambler < len(SCRAMBLER_LIST) else 0
1113-
rs = RadioSetting("scrambler", "Scrambler (Scramb)", RadioSettingValueList(
1114-
SCRAMBLER_LIST, SCRAMBLER_LIST[enc]))
1108+
enc = listDef(_mem.scrambler, SCRAMBLER_LIST, 0)
1109+
val = RadioSettingValueList(SCRAMBLER_LIST, None, enc)
1110+
rs = RadioSetting("scrambler", "Scrambler (Scramb)", val)
11151111
mem.extra.append(rs)
1116-
tmpcomment += "Scrambler:" + SCRAMBLER_LIST[enc] + " "
11171112

11181113
# Compander
1119-
rs = RadioSetting("compander", "Compander (Compnd)", RadioSettingValueList(
1120-
COMPANDER_LIST, tmpComp))
1114+
val = RadioSettingValueList(COMPANDER_LIST, None, tmpComp)
1115+
rs = RadioSetting("compander", "Compander (Compnd)", val)
11211116
mem.extra.append(rs)
1122-
tmpcomment += "Compander:" + tmpComp + " "
11231117

11241118
rs = RadioSetting("scanlists", "Scanlists (SList)", RadioSettingValueList(
11251119
SCANLIST_LIST, tmpscn))

0 commit comments

Comments
 (0)