From d7585010d13b36bae3a7408a40cbd98e22eb1142 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Thu, 14 Nov 2024 16:57:19 -0800 Subject: [PATCH 1/3] Improve error message for tuning step failure This improves the message we show to the user when they enter a frequency that can't be supported by the radio due to step alignment support. --- chirp/chirp_common.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/chirp/chirp_common.py b/chirp/chirp_common.py index a5b93f97..53d77a6b 100644 --- a/chirp/chirp_common.py +++ b/chirp/chirp_common.py @@ -1783,9 +1783,12 @@ def required_step(freq, allowed=None): } # Try the above "standard" steps first in order + required_step = None for step, validate in steps.items(): if step in allowed and validate(freq): return step + elif validate(freq) and required_step is None: + required_step = step # Try any additional steps in the allowed list for step in allowed: @@ -1797,8 +1800,14 @@ def required_step(freq, allowed=None): step, format_freq(freq))) return step - raise errors.InvalidDataError("Unable to find a supported " + - "tuning step for %s" % format_freq(freq)) + if required_step is not None: + raise errors.InvalidDataError(( + 'Frequency %s requires step %.2f, ' + 'which is not supported') % ( + format_freq(freq), required_step)) + else: + raise errors.InvalidDataError("Unable to find a supported " + + "tuning step for %s" % format_freq(freq)) def fix_rounded_step(freq): From 5ad175061247f19bc0607cce719eacb027a54705 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Thu, 14 Nov 2024 17:10:49 -0800 Subject: [PATCH 2/3] ft70: Fix tuning steps 5.0 and 6.25 There's a note in the driver indicating that perhaps the driver is not correct on these, and that appears confirmed by the referenced bug. Fixes #11681 --- chirp/drivers/ft70.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chirp/drivers/ft70.py b/chirp/drivers/ft70.py index fbe5b555..6b9cf214 100644 --- a/chirp/drivers/ft70.py +++ b/chirp/drivers/ft70.py @@ -344,7 +344,7 @@ MODES = ["FM", "AM", "NFM"] -STEPS = [0, 5, 6.25, 10, 12.5, 15, 20, 25, 50, 100] # 0 = auto +STEPS = [5, 6.25, 0, 10, 12.5, 15, 20, 25, 50, 100] # 0 = auto? RFSQUELCH = ["OFF", "S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8"] SKIPS = ["", "S", "P"] From c390c18dd3b480d311328374d232a9d801cd93c9 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Thu, 14 Nov 2024 17:11:51 -0800 Subject: [PATCH 3/3] icv80: Fix txinhibit as duplex=off This was implemented as a flag instead of proper duplex=off originally. Fixes #11336 --- chirp/drivers/icv80.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/chirp/drivers/icv80.py b/chirp/drivers/icv80.py index aa3e69cf..1564a9ea 100644 --- a/chirp/drivers/icv80.py +++ b/chirp/drivers/icv80.py @@ -170,7 +170,7 @@ def get_features(self): rf.memory_bounds = (0, 199) rf.valid_modes = MODES rf.valid_tmodes = TMODES - rf.valid_duplexes = DUPLEXES + rf.valid_duplexes = DUPLEXES + ['off'] rf.valid_tuning_steps = TUNING_STEPS rf.valid_power_levels = POWER_LEVELS rf.valid_skips = SKIPS @@ -410,7 +410,10 @@ def _get_memory(self, number, extd_number=None): if mem.extd_number == "": mem.name = str(_mem.name).rstrip() mem.skip = (_skip & bit) and "S" or "" - mem.duplex = DUPLEXES[_mem.duplex] + if _mem.tx_inhibit: + mem.duplex = 'off' + else: + mem.duplex = DUPLEXES[_mem.duplex] mem.power = POWER_LEVELS[_mem.power] mem.tuning_step = TUNING_STEPS[_mem.tuning_step] mem.mode = MODES[_mem.mode] @@ -427,13 +430,6 @@ def _get_memory(self, number, extd_number=None): rev.set_doc("Reverse duplex") mem.extra.append(rev) - # Tx inhibit - tx_inhibit = RadioSetting("tx_inhibit", "TX inhibit", - RadioSettingValueBoolean( - bool(not _mem.tx_inhibit))) - tx_inhibit.set_doc("TX inhibit") - mem.extra.append(tx_inhibit) - return mem def get_memory(self, number): @@ -497,7 +493,10 @@ def set_memory(self, mem): _mem.freq = mem.freq // mult _mem.offset = int(mem.offset) // mult _mem.name = str(mem.name).ljust(5) - _mem.duplex = DUPLEXES.index(mem.duplex) + try: + _mem.duplex = DUPLEXES.index(mem.duplex) + except ValueError: + _mem.duplex = 0 power = mem.power or POWER_LEVELS[0] _mem.power = POWER_LEVELS.index(power) _mem.tuning_step = TUNING_STEPS.index(mem.tuning_step) @@ -507,6 +506,7 @@ def set_memory(self, mem): _mem.ctone = chirp_common.TONES.index(mem.ctone) _mem.dtcs = chirp_common.DTCS_CODES.index(mem.dtcs) _mem.dtcs_polarity = DTCS_POLARITY.index(mem.dtcs_polarity) + _mem.tx_inhibit = mem.duplex == 'off' # Set used _unused &= ~bit @@ -519,7 +519,6 @@ def set_memory(self, mem): _skip &= ~bit if mem.extra: - _mem.tx_inhibit = not mem.extra['tx_inhibit'].value _mem.reverse_duplex = mem.extra['reverse_duplex'].value def get_raw_memory(self, number):