From 4b0476df44570f5854f1113ac0b7a36f03ea14f9 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 17 Jun 2024 19:19:59 -0700 Subject: [PATCH] Fix tuning step when bandplan is invalid Right now we will choose the tuning step for a new edit from the bandplan, even if that doesn't work for the frequency entered. Ironically, the most common frequency in the NA bandplan (146.520) would choose a step of 25kHz, which isn't actually aligned. Radios that really care about this (i.e. kenwood live radios) will balk at 146.52 at 25kHz, allow it at 20kHz, and allow 146.50 at 25kHz. This makes memedit use the band plan step if it is valid for the entered frequency, else fall back to the minimum-viable logic that we use when there is no bandplan step. Fixes #11391 --- chirp/wxui/memedit.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/chirp/wxui/memedit.py b/chirp/wxui/memedit.py index 7e2f72c04..b17aa85ec 100644 --- a/chirp/wxui/memedit.py +++ b/chirp/wxui/memedit.py @@ -1308,9 +1308,16 @@ def _set_memory_defaults(self, mem, *only): mem.offset = want_offset if defaults.step_khz in features.valid_tuning_steps: - LOG.debug( - 'Chose default step %s from bandplan' % defaults.step_khz) want_tuning_step = defaults.step_khz + if mem.freq % (want_tuning_step * 1000): + want_tuning_step = chirp_common.required_step(mem.freq) + LOG.debug('Bandplan step %s not suitable for %s, choosing %s', + defaults.step_khz, + chirp_common.format_freq(mem.freq), + want_tuning_step) + else: + LOG.debug( + 'Chose default step %s from bandplan' % defaults.step_khz) else: want_tuning_step = 5.0 try: