[chirp_devel] [PATCH] [UV-5R] Update for New Broadcast FM Preset Method

Jim Unroe
Thu Dec 24 17:03:51 PST 2015


# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1451005038 18000
# Node ID 0f495ecad3d1121eb4b5d60ebb9b79cccf78f57a
# Parent  69be9284b80618bb60c2b10a7eaa1850f8843393
[UV-5R] Update for New Broadcast FM Preset Method

Add support for new station frequency storage method. The latest
firmware no longer subtracts 650 before storing the frequency.

related to #2765

diff -r 69be9284b806 -r 0f495ecad3d1 chirp/drivers/uv5r.py
--- a/chirp/drivers/uv5r.py	Thu Dec 24 14:09:55 2015 -0500
+++ b/chirp/drivers/uv5r.py	Thu Dec 24 19:57:18 2015 -0500
@@ -954,6 +954,7 @@
 
     def _get_settings(self):
         _ani = self._memobj.ani
+        _fm_presets = self._memobj.fm_presets
         _settings = self._memobj.settings
         _squelch = self._memobj.squelch_new
         _vfoa = self._memobj.vfoa
@@ -1416,12 +1417,14 @@
         fm_preset = RadioSettingGroup("fm_preset", "FM Radio Preset")
         group.append(fm_preset)
 
-        if self._memobj.fm_presets <= 116.1 * 10 - 650:
-            preset = self._memobj.fm_presets / 10.0 + 65
+        if _fm_presets <= 108.0 * 10 - 650:
+            preset = _fm_presets / 10.0 + 65
+        elif _fm_presets >= 65.0 * 10 and _fm_presets <= 108.0 * 10:
+            preset = _fm_presets / 10.0
         else:
             preset = 76.0
         rs = RadioSetting("fm_presets", "FM Preset(MHz)",
-                          RadioSettingValueFloat(65, 116.1, preset, 0.1, 1))
+                          RadioSettingValueFloat(65, 108.0, preset, 0.1, 1))
         fm_preset.append(rs)
 
         dtmf = RadioSettingGroup("dtmf", "DTMF Settings")
@@ -1582,7 +1585,10 @@
         for element in settings:
             try:
                 val = element.value
-                value = int(val.get_value() * 10 - 650)
+                if self._memobj.fm_presets <= 108.0 * 10 - 650:
+                    value = int(val.get_value() * 10 - 650)
+                else:
+                    value = int(val.get_value() * 10)
                 LOG.debug("Setting fm_presets = %s" % (value))
                 self._memobj.fm_presets = value
             except Exception, e:



More information about the chirp_devel mailing list