diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2021-03-31 21:40:32 -0400 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2021-03-31 21:40:32 -0400 |
| commit | ccefce07de718c52a27f145a517a90b465dbc04d (patch) | |
| tree | 66712961c007b8d46af6711d74697ec432286a74 | |
| parent | 40a44d36554b84c36b2475ad97c62d779cf7a4a4 (diff) | |
| download | chirp-ccefce07de718c52a27f145a517a90b465dbc04d.tar.gz chirp-ccefce07de718c52a27f145a517a90b465dbc04d.tar.xz | |
| -rw-r--r-- | chirp/drivers/uv5r.py | 136 |
1 files changed, 94 insertions, 42 deletions
diff --git a/chirp/drivers/uv5r.py b/chirp/drivers/uv5r.py index 96afe2a..e17c430 100644 --- a/chirp/drivers/uv5r.py +++ b/chirp/drivers/uv5r.py @@ -655,6 +655,9 @@ def _do_upload(radio): "of the radio (%s).") raise errors.RadioError(msg % (image_version, radio_version)) + if not radio._aux_block: + image_matched_radio = True + # Main block mmap = radio.get_mmap().get_byte_compatible() for start_addr, end_addr in ranges_main: @@ -724,6 +727,8 @@ class BaofengUV5R(chirp_common.CloneModeRadio, _vhf_range = (136000000, 174000000) _220_range = (220000000, 260000000) _uhf_range = (400000000, 520000000) + _aux_block = True + _tri_power = False _mem_params = (0x1828 # poweron_msg offset ) # offset of fw version in image file @@ -924,7 +929,7 @@ class BaofengUV5R(chirp_common.CloneModeRadio, if not _mem.scan: mem.skip = "S" - if self.MODEL in ("KT-980HP", "BF-F8HP", "UV-82HP"): + if self._tri_power: levels = UV5R_POWER_LEVELS3 else: levels = UV5R_POWER_LEVELS @@ -1045,7 +1050,7 @@ class BaofengUV5R(chirp_common.CloneModeRadio, _mem.wide = mem.mode == "FM" if mem.power: - if self.MODEL in ("KT-980HP", "BF-F8HP", "UV-82HP"): + if self._tri_power: levels = [str(l) for l in UV5R_POWER_LEVELS3] _mem.lowpower = levels.index(str(mem.power)) else: @@ -1175,10 +1180,11 @@ class BaofengUV5R(chirp_common.CloneModeRadio, RadioSettingValueBoolean(_settings.voice)) advanced.append(rs) else: - rs = RadioSetting("voice", "Voice", - RadioSettingValueList( - VOICE_LIST, VOICE_LIST[_settings.voice])) - advanced.append(rs) + if self.MODEL != "TI-F8+": + rs = RadioSetting("voice", "Voice", + RadioSettingValueList( + VOICE_LIST, VOICE_LIST[_settings.voice])) + advanced.append(rs) rs = RadioSetting("screv", "Scan Resume", RadioSettingValueList( @@ -1304,30 +1310,30 @@ class BaofengUV5R(chirp_common.CloneModeRadio, # 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) + + def _filter(name): + filtered = "" + for char in str(name): + if char in chirp_common.CHARSET_ASCII: + filtered += char + else: + filtered += " " + return filtered - _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) + _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) - val = RadioSettingValueString(0, 7, _filter(_msg.line2)) - val.set_mutable(False) - rs = RadioSetting("firmware_msg.line2", "Firmware Message 2", val) - other.append(rs) + val = RadioSettingValueString(0, 7, _filter(_msg.line2)) + val.set_mutable(False) + rs = RadioSetting("firmware_msg.line2", "Firmware Message 2", val) + other.append(rs) - if self.MODEL != "UV-6": _msg = self._memobj.sixpoweron_msg rs = RadioSetting("sixpoweron_msg.line1", "6+Power-On Message 1", RadioSettingValueString( @@ -1463,39 +1469,47 @@ class BaofengUV5R(chirp_common.CloneModeRadio, real_offset = 0 for byte in bytes: real_offset = (real_offset * 10) + byte - return chirp_common.format_freq(real_offset * 10000) + return chirp_common.format_freq(real_offset * 1000) def apply_offset(setting, obj): - value = chirp_common.parse_freq(str(setting.value)) / 10000 - for i in range(3, -1, -1): + value = chirp_common.parse_freq(str(setting.value)) / 1000 + for i in range(5, -1, -1): obj.offset[i] = value % 10 value /= 10 val1a = RadioSettingValueString( 0, 10, convert_bytes_to_offset(_vfoa.offset)) rs = RadioSetting("vfoa.offset", - "VFO A Offset (0.00-69.95)", val1a) + "VFO A Offset (0.0-999.999)", val1a) rs.set_apply_callback(apply_offset, _vfoa) workmode.append(rs) val1b = RadioSettingValueString( 0, 10, convert_bytes_to_offset(_vfob.offset)) rs = RadioSetting("vfob.offset", - "VFO B Offset (0.00-69.95)", val1b) + "VFO B Offset (0.0-999.999)", val1b) rs.set_apply_callback(apply_offset, _vfob) workmode.append(rs) - if self.MODEL in ("KT-980HP", "BF-F8HP", "UV-82HP"): + if self._tri_power: + if _vfoa.txpower3 > 0x02: + val = 0x00 + else: + val = _vfoa.txpower3 rs = RadioSetting("vfoa.txpower3", "VFO A Power", RadioSettingValueList( TXPOWER3_LIST, - TXPOWER3_LIST[_vfoa.txpower3])) + TXPOWER3_LIST[val])) workmode.append(rs) + if _vfob.txpower3 > 0x02: + val = 0x00 + else: + val = _vfob.txpower3 rs = RadioSetting("vfob.txpower3", "VFO B Power", RadioSettingValueList( TXPOWER3_LIST, - TXPOWER3_LIST[_vfob.txpower3])) + TXPOWER3_LIST[val])) workmode.append(rs) else: rs = RadioSetting("vfoa.txpower", "VFO A Power", @@ -1566,7 +1580,11 @@ class BaofengUV5R(chirp_common.CloneModeRadio, dtmf = RadioSettingGroup("dtmf", "DTMF Settings") group.append(dtmf) - dtmfchars = "0123456789 *#ABCD" + + if str(self._memobj.firmware_msg.line1) == "HN5RV01": + dtmfchars = "0123456789ABCD*#" + else: + dtmfchars = "0123456789 *#ABCD" for i in range(0, 15): _codeobj = self._memobj.pttid[i].code @@ -1587,10 +1605,12 @@ class BaofengUV5R(chirp_common.CloneModeRadio, rs.set_apply_callback(apply_code, self._memobj.pttid[i]) dtmf.append(rs) + dtmfcharsani = "0123456789" + _codeobj = self._memobj.ani.code - _code = "".join([dtmfchars[x] for x in _codeobj if int(x) < 0x1F]) + _code = "".join([dtmfcharsani[x] for x in _codeobj if int(x) < 0x1F]) val = RadioSettingValueString(0, 5, _code, False) - val.set_charset(dtmfchars) + val.set_charset(dtmfcharsani) rs = RadioSetting("ani.code", "ANI Code", val) def apply_code(setting, obj): @@ -1653,7 +1673,7 @@ class BaofengUV5R(chirp_common.CloneModeRadio, 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) @@ -1740,12 +1760,12 @@ class UV5XAlias(chirp_common.Alias): class RT5RAlias(chirp_common.Alias): VENDOR = "Retevis" - MODEL = "RT-5R" + MODEL = "RT5R" class RT5RVAlias(chirp_common.Alias): VENDOR = "Retevis" - MODEL = "RT-5RV" + MODEL = "RT5RV" class RT5Alias(chirp_common.Alias): @@ -1834,6 +1854,7 @@ class BaofengUV6Radio(BaofengUV5R): _idents = [UV5R_MODEL_UV6, UV5R_MODEL_UV6_ORIG ] + _aux_block = False def get_features(self): rf = BaofengUV5R.get_features(self) @@ -1865,6 +1886,7 @@ class IntekKT980Radio(BaofengUV5R): _idents = [UV5R_MODEL_291] _vhf_range = (130000000, 180000000) _uhf_range = (400000000, 521000000) + _tri_power = True def get_features(self): rf = BaofengUV5R.get_features(self) @@ -1881,17 +1903,34 @@ class ROGA5SAlias(chirp_common.Alias): MODEL = "GA-5S" +class UV5XPAlias(chirp_common.Alias): + VENDOR = "Baofeng" + MODEL = "UV-5XP" + + +class TSTIF8Alias(chirp_common.Alias): + VENDOR = "TechSide" + MODEL = "TI-F8+" + + +class TenwayUV5RPro(chirp_common.Alias): + VENDOR = 'Tenway' + MODEL = 'UV-5R Pro' + + @directory.register class BaofengBFF8HPRadio(BaofengUV5R): VENDOR = "Baofeng" MODEL = "BF-F8HP" - ALIASES = [RT5_TPAlias, ROGA5SAlias] + ALIASES = [RT5_TPAlias, ROGA5SAlias, UV5XPAlias, TSTIF8Alias, + TenwayUV5RPro] _basetype = BASETYPE_F8HP _idents = [UV5R_MODEL_291, UV5R_MODEL_A58 ] _vhf_range = (130000000, 180000000) _uhf_range = (400000000, 521000000) + _tri_power = True def get_features(self): rf = BaofengUV5R.get_features(self) @@ -1903,14 +1942,21 @@ class BaofengBFF8HPRadio(BaofengUV5R): return False +class TenwayUV82Pro(chirp_common.Alias): + VENDOR = 'Tenway' + MODEL = 'UV-82 Pro' + + @directory.register class BaofengUV82HPRadio(BaofengUV5R): VENDOR = "Baofeng" MODEL = "UV-82HP" + ALIASES = [TenwayUV82Pro] _basetype = BASETYPE_UV82HP _idents = [UV5R_MODEL_UV82] _vhf_range = (136000000, 175000000) _uhf_range = (400000000, 521000000) + _tri_power = True def get_features(self): rf = BaofengUV5R.get_features(self) @@ -1922,10 +1968,16 @@ class BaofengUV82HPRadio(BaofengUV5R): return False +class TDUV5RRadio(chirp_common.Alias): + VENDOR = "TIDRADIO" + MODEL = "TD-UV5R TriPower" + + @directory.register class RadioddityUV5RX3Radio(BaofengUV5R): VENDOR = "Radioddity" MODEL = "UV-5RX3" + ALIASES = [TDUV5RRadio] def get_features(self): rf = BaofengUV5R.get_features(self) |
