Skip to content

Commit

Permalink
Fix tuning step when bandplan is invalid
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kk7ds committed Jun 18, 2024
1 parent d76ee57 commit 4b0476d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions chirp/wxui/memedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 4b0476d

Please sign in to comment.