Skip to content

Commit

Permalink
btech: Handle failure to decode FM presets
Browse files Browse the repository at this point in the history
Fixes #11574
  • Loading branch information
kk7ds committed Sep 28, 2024
1 parent fdc91bf commit a2c1948
Showing 1 changed file with 7 additions and 3 deletions.
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

0 comments on commit a2c1948

Please sign in to comment.