[chirp_devel] [PATCH] [uv-5r]Add Support for the Baofeng UV-5RAX
# HG changeset patch # User Jim Unroe rock.unroe@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")
Hi Jim,
Thanks for working on this, and sorry for the delay in responding.
def _do_upload(radio):
- _ident_radio(radio)
- ident = _ident_radio(radio)
- # VHF/UHF = "\x04" or "\x42" (original)
- # VHF/220 = "\x02"
Can you actually set these as constants at the top of the file, like STEPS, STEP_LIST, etc?
- radio_upper_band = ident[3:4]
- image_upper_band = _upper_band_from_image(radio)
- if image_upper_band == "\x02" or radio_upper_band == "\x02":
Then you can use those here instead of the raw hex, for more clarity.
if image_upper_band != radio_upper_band:
raise errors.RadioError("Image not supportted by radio")
"supported" is misspelled.
Thanks!
On Wed, Jul 3, 2013 at 7:48 PM, Dan Smith dsmith@danplanet.com wrote:
Hi Jim,
Thanks for working on this, and sorry for the delay in responding.
Sorry it took me so long to get my head around this. I thought some more about your guidance and suddenly woke up the other morning with a sense of knowing what I needed to do (I think).
def _do_upload(radio):
- _ident_radio(radio)
- ident = _ident_radio(radio)
- # VHF/UHF = "\x04" or "\x42" (original)
- # VHF/220 = "\x02"
Can you actually set these as constants at the top of the file, like STEPS, STEP_LIST, etc?
Actually, these were just comments to show what I was looking for. So they are gone now. I really only need the one for VHF/220 so I made ...
vhf_220_radio = "\x02"
and put it just above STEPS
- radio_upper_band = ident[3:4]
- image_upper_band = _upper_band_from_image(radio)
- if image_upper_band == "\x02" or radio_upper_band == "\x02":
Then you can use those here instead of the raw hex, for more clarity.
Done. There was one down near 'rf.valid_bands' too.
if image_upper_band != radio_upper_band:
raise errors.RadioError("Image not supportted by radio")
"supported" is misspelled.
Yeah. My tester caught that and I resubmitted a corrected patch earlier this morning.
Thanks!
-- Dan Smith www.danplanet.com KK7DS
Jim KC9HI
participants (2)
-
Dan Smith
-
Jim Unroe