# HG changeset patch
# User Brad Schuler <brad@schuler.ws>
# Date 1605593121 25200
# Mon Nov 16 23:05:21 2020 -0700
# Node ID 2df5ebf6cb44272135be7174f0df8c4325667889
# Parent ea826afbd7489de236b7d1895f4552a32d78fb04
[anytone_iii] Modifications necessary to pass standard CHIRP automated testing
Related to issue #3941
diff -r ea826afbd748 -r 2df5ebf6cb44 chirp/drivers/anytone_iii.py
--- a/chirp/drivers/anytone_iii.py Thu Nov 12 00:09:58 2020 -0700
+++ b/chirp/drivers/anytone_iii.py Mon Nov 16 23:05:21 2020 -0700
@@ -39,7 +39,7 @@
def __init__(self, radio, name='Banks'):
super(ATBankModel, self).__init__(radio, name)
self._banks = []
- self._memBounds = (0, 760)
+ self._memBounds = range(0, 750)
for i in range(0, 10):
self._banks.append(chirp_common.Bank(self, i, string.uppercase[i]))
@@ -53,6 +53,13 @@
self._radio.set_bank(memory.number, bank.get_index())
def remove_memory_from_mapping(self, memory, mapping):
+ # I would argue that removing a memory from a mapping in which it does not exist should not throw an error.
+ # The end result is the requested result. The memory is not in the mapping.
+ # However, to pass the CHIRP TestCaseBanks, I must throw an error. This causes more code to execute than necessary.
+ # I could just call _radio.clr_bank, but now I must get_bank and compare.
+ index = self._radio.get_bank(memory.number)
+ if (index is None or index != mapping.get_index()):
+ raise Exception("Memory %d is not in bank %s" % (memory.number, bank.get_name()))
self._radio.clr_bank(memory.number)
def get_mapping_memories(self, bank):
@@ -765,6 +772,7 @@
rf.has_settings = True
rf.valid_modes = MODES + ['AM']
rf.valid_tmodes = ['', 'Tone', 'TSQL', 'DTCS', 'Cross']
+ rf.valid_cross_modes = ["Tone->Tone", "DTCS->", "->DTCS", "Tone->DTCS", "DTCS->Tone", "->Tone", "DTCS->DTCS"]
rf.valid_duplexes = DUPLEXES
rf.valid_tuning_steps = TUNING_STEPS
rf.valid_bands = BANDS
@@ -1239,6 +1247,8 @@
dtmfId = element.value
elif name == "5ToneId":
fiveToneId = element.value
+ elif isinstance(element.value, _RadioSettingValueOffsetInt):
+ setattr(_emergency, name, int(element.value) + element.value.offset)
else:
setattr(_emergency, name, element.value)
if EMER_ENI_TYPES[_emergency.eniType] == 'DTMF':