diff -r 22de66209348 chirp/drivers/lt725uv.py --- a/chirp/drivers/lt725uv.py Fri Feb 09 16:10:18 2018 -0800 +++ b/chirp/drivers/lt725uv.py Thu Mar 08 11:25:45 2018 -0500 @@ -49,7 +49,8 @@ u8 unknown1[2]; u32 rxfreq; u8 unknown2[8]; - u8 power; + u8 unknown4:7, + power:1; u8 unknown3[3]; u24 offset; u32 step; @@ -84,8 +85,7 @@ scrambler:1 unknown:4; u8 namelen; - u8 name[6]; - u8 unused; + u8 name[7]; }; #seekto 0x0400; @@ -100,11 +100,14 @@ BLOCK_SIZE = 0x40 STIMEOUT = 2 +POWER_LEVELS = [chirp_common.PowerLevel("Low", watts=5.00), + chirp_common.PowerLevel("High", watts=30.00)] + LIST_RECVMODE = ["", "QT/DQT", "QT/DQT + Signaling"] LIST_SIGNAL = ["Off"] + ["DTMF%s" % x for x in range(1, 9)] + \ ["DTMF%s + Identity" % x for x in range(1, 9)] + \ ["Identity code"] -LIST_POWER = ["Low", "Mid", "High"] +LIST_POWER = ["Low", "High"] LIST_COLOR = ["Off", "Orange", "Blue", "Purple"] LIST_LEDSW = ["Auto", "On"] LIST_RING = ["Off"] + ["%s seconds" % x for x in range(1, 10)] @@ -232,7 +235,7 @@ _exit_program_mode(radio) - data += "LT-725UV" + data += radio.MODEL.ljust(8) return data @@ -276,12 +279,11 @@ def model_match(cls, data): """Match the opened/downloaded image to the correct version""" - rid = data[0x1C00:0x1C08] - - if rid == cls.MODEL: - return True - - return False + if len(data) == 0x1C08: + rid = data[0x1C00:0x1C08] + return rid.startswith(cls.MODEL) + else: + return False def _split(rf, f1, f2): @@ -308,7 +310,7 @@ MODES = ["NFM", "FM"] TONES = chirp_common.TONES DTCS_CODES = sorted(chirp_common.DTCS_CODES + [645]) - NAME_LENGTH = 6 + NAME_LENGTH = 7 DTMF_CHARS = list("0123456789ABCD*#") VALID_BANDS = [(136000000, 176000000), @@ -373,6 +375,7 @@ "->Tone", "DTCS->DTCS"] rf.valid_skips = [] + rf.valid_power_levels = POWER_LEVELS rf.valid_name_length = self.NAME_LENGTH rf.valid_dtcs_codes = self.DTCS_CODES rf.valid_bands = self.VALID_BANDS @@ -494,7 +497,9 @@ mem.dtcs_polarity = "".join(dtcs_pol) - mem.mode = self.MODES[_mem.wide] + mem.mode = _mem.wide and "FM" or "NFM" + + mem.power = POWER_LEVELS[_mem.power] # Extra mem.extra = RadioSettingGroup("extra", "Extra") @@ -616,6 +621,8 @@ _mem.wide = self.MODES.index(mem.mode) + _mem.power = mem.power == POWER_LEVELS[1] + # extra settings for setting in mem.extra: setattr(_mem, setting.get_name(), setting.value) @@ -761,3 +768,23 @@ class LT725UVLower(LT725UV): VARIANT = "Lower" _vfo = "lower" + + +class Zastone(chirp_common.Alias): + """Declare BJ-218 alias for Zastone BJ-218.""" + VENDOR = "Zastone" + MODEL = "BJ-218" + + +class Hesenate(chirp_common.Alias): + """Declare BJ-218 alias for Hesenate BJ-218.""" + VENDOR = "Hesenate" + MODEL = "BJ-218" + + +@directory.register +class Baojie218(LT725UV): + """Baojie BJ-218""" + VENDOR = "Baojie" + MODEL = "BJ-218" + ALIASES = [Zastone, Hesenate, ]