[chirp_devel] [PATCH] [uv-5r]Add Support for the Baofeng UV-5RAX
Jim Unroe
Sun Jun 30 15:21:57 PDT 2013
# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1372630379 14400
# Node ID b0919e8c63fe062964641bbde7eb84ac76cfac67
# Parent 5cf90be0f2974e46bed1b8406954020d8dfed1d1
[uv-5r]Add Support for the Baofeng UV-5RAX
This radio is 2 meter 220 dual band variation of the UV-5R
#767
diff -r 5cf90be0f297 -r b0919e8c63fe chirp/uv5r.py
--- a/chirp/uv5r.py Wed Jun 26 17:00:18 2013 +0200
+++ b/chirp/uv5r.py Sun Jun 30 18:12:59 2013 -0400
@@ -297,6 +297,12 @@
UV5R_MODEL_291 = "\x50\xBB\xFF\x20\x12\x07\x25"
UV5R_MODEL_F11 = "\x50\xBB\xFF\x13\xA1\x11\xDD"
+def _upper_band_from_data(data):
+ return data[0x03:0x04]
+
+def _upper_band_from_image(radio):
+ return _upper_band_from_data(radio.get_mmap())
+
def _firmware_version_from_data(data):
return data[0x1838:0x1848]
@@ -400,7 +406,15 @@
raise errors.RadioError("Radio refused to accept block 0x%04x" % addr)
def _do_upload(radio):
- _ident_radio(radio)
+ ident = _ident_radio(radio)
+ # VHF/UHF = "\x04" or "\x42" (original)
+ # VHF/220 = "\x02"
+ radio_upper_band = ident[3:4]
+ image_upper_band = _upper_band_from_image(radio)
+
+ if image_upper_band == "\x02" or radio_upper_band == "\x02":
+ if image_upper_band != radio_upper_band:
+ raise errors.RadioError("Image not supportted by radio")
image_version = _firmware_version_from_image(radio)
radio_version = _get_radio_firmware_version(radio)
@@ -482,6 +496,8 @@
rf.valid_duplexes = ["", "-", "+", "split", "off"]
rf.valid_modes = ["FM", "NFM"]
rf.valid_bands = [(136000000, 174000000), (400000000, 520000000)]
+ if self._is_orig() == False and self._my_upper_band() == "\x02":
+ rf.valid_bands = [(136000000, 174000000), (220000000, 260000000)]
rf.memory_bounds = (0, 127)
return rf
@@ -718,6 +734,10 @@
return int(version_tag[idx:idx+3])
raise Exception("Unrecognized firmware version string")
+ def _my_upper_band(self):
+ band_tag = _upper_band_from_image(self)
+ return band_tag
+
def _get_settings(self):
_settings = self._memobj.settings[0]
basic = RadioSettingGroup("basic", "Basic Settings")
More information about the chirp_devel
mailing list