[chirp_devel] [PATCH] [UV-6] Support Baofeng UV-6 without Auxiliary Block
Jim Unroe
Mon Aug 31 17:20:11 PDT 2020
# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1598909097 14400
# Mon Aug 31 17:24:57 2020 -0400
# Node ID fb0e42bb94ed2d8e95dac61ae38a86bb267d1019
# Parent da00bc273e5f52ea49e89e68819962413ca46e32
[UV-6] Support Baofeng UV-6 without Auxiliary Block
This patch adds support for Baofeng radio models, including the UV-6,
that do not support access to the auxiliary block of memory.
Fixes #6567
diff -r da00bc273e5f -r fb0e42bb94ed chirp/drivers/uv5r.py
--- a/chirp/drivers/uv5r.py Wed Aug 26 17:21:13 2020 -0400
+++ b/chirp/drivers/uv5r.py Mon Aug 31 17:24:57 2020 -0400
@@ -576,10 +576,11 @@
_do_status(radio, i)
_do_status(radio, radio.get_memsize())
LOG.debug("done.")
- LOG.debug("downloading aux block...")
- # Auxiliary block starts at 0x1ECO (?)
- for i in range(0x1EC0, 0x2000, 0x40):
- data += _read_block(radio, i, 0x40, False)
+ if radio._aux_block:
+ LOG.debug("downloading aux block...")
+ # Auxiliary block starts at 0x1ECO (?)
+ for i in range(0x1EC0, 0x2000, 0x40):
+ data += _read_block(radio, i, 0x40, False)
if append_model:
data += radio.MODEL.ljust(8)
@@ -650,6 +651,9 @@
"of the radio (%s).")
raise errors.RadioError(msg % (image_version, radio_version))
+ if not radio._aux_block:
+ image_matched_radio = True
+
# Main block
for start_addr, end_addr in ranges_main:
for i in range(start_addr, end_addr, 0x10):
@@ -716,6 +720,7 @@
_vhf_range = (136000000, 174000000)
_220_range = (220000000, 260000000)
_uhf_range = (400000000, 520000000)
+ _aux_block = True
_tri_power = False
_mem_params = (0x1828 # poweron_msg offset
)
@@ -1297,30 +1302,30 @@
# Old image, without aux block
return group
- other = RadioSettingGroup("other", "Other Settings")
- group.append(other)
-
- def _filter(name):
- filtered = ""
- for char in str(name):
- if char in chirp_common.CHARSET_ASCII:
- filtered += char
- else:
- filtered += " "
- return filtered
+ if self.MODEL != "UV-6":
+ other = RadioSettingGroup("other", "Other Settings")
+ group.append(other)
- _msg = self._memobj.firmware_msg
- val = RadioSettingValueString(0, 7, _filter(_msg.line1))
- val.set_mutable(False)
- rs = RadioSetting("firmware_msg.line1", "Firmware Message 1", val)
- other.append(rs)
+ def _filter(name):
+ filtered = ""
+ for char in str(name):
+ if char in chirp_common.CHARSET_ASCII:
+ filtered += char
+ else:
+ filtered += " "
+ return filtered
- val = RadioSettingValueString(0, 7, _filter(_msg.line2))
- val.set_mutable(False)
- rs = RadioSetting("firmware_msg.line2", "Firmware Message 2", val)
- other.append(rs)
+ _msg = self._memobj.firmware_msg
+ val = RadioSettingValueString(0, 7, _filter(_msg.line1))
+ val.set_mutable(False)
+ rs = RadioSetting("firmware_msg.line1", "Firmware Message 1", val)
+ other.append(rs)
- if self.MODEL != "UV-6":
+ val = RadioSettingValueString(0, 7, _filter(_msg.line2))
+ val.set_mutable(False)
+ rs = RadioSetting("firmware_msg.line2", "Firmware Message 2", val)
+ other.append(rs)
+
_msg = self._memobj.sixpoweron_msg
rs = RadioSetting("sixpoweron_msg.line1", "6+Power-On Message 1",
RadioSettingValueString(
@@ -1646,7 +1651,7 @@
RadioSettingValueInteger(0, 50, _settings.pttlt))
dtmf.append(rs)
- if not self._is_orig():
+ if not self._is_orig() and self._aux_block:
service = RadioSettingGroup("service", "Service Settings")
group.append(service)
@@ -1827,6 +1832,7 @@
_idents = [UV5R_MODEL_UV6,
UV5R_MODEL_UV6_ORIG
]
+ _aux_block = False
def get_features(self):
rf = BaofengUV5R.get_features(self)
More information about the chirp_devel
mailing list