Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

btech: Handle failure to decode FM presets #1131

Merged
merged 1 commit into from
Sep 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions chirp/drivers/btech.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
RadioSettingValueBoolean, RadioSettingValueList, \
RadioSettingValueString, RadioSettingValueInteger, \
RadioSettingValueFloat, RadioSettings, InvalidValueError
from chirp import settings

LOG = logging.getLogger(__name__)

Expand Down Expand Up @@ -2275,9 +2276,12 @@ def apply_fm_freq(setting, obj):
line.set_apply_callback(apply_fm_preset_name,
preset.broadcast_station_name)

val = RadioSettingValueFloat(0, 108,
bfc.bcd_decode_freq(
preset.freq))
try:
presetval = bfc.bcd_decode_freq(preset.freq)
except settings.InternalError:
presetval = ''

val = RadioSettingValueFloat(0, 108, presetval)
fmfreq = RadioSetting("fm_presets_" + str(i) + "_freq",
"Frequency " + str(i), val)
val.set_validate_callback(fm_validate)
Expand Down
Loading