diff --git a/chirp/drivers/btech.py b/chirp/drivers/btech.py index 067b62410..90c13c4db 100644 --- a/chirp/drivers/btech.py +++ b/chirp/drivers/btech.py @@ -1125,7 +1125,7 @@ def get_settings(self): sql = RadioSetting("settings.sql", "Squelch level", rs) basic.append(sql) - if self.MODEL == "GMRS-50X1": + if self.MODEL == "GMRS-50X1" or self.MODEL == "GMRS-50V2": rs = RadioSettingValueBoolean(_mem.settings.autolk) autolk = RadioSetting("settings.autolk", "Auto keylock", rs) basic.append(autolk) @@ -1467,7 +1467,7 @@ def get_settings(self): rxfc = RadioSetting("settings.rxfc", "RX-FC", rs) basic.append(rxfc) - if not self.MODEL == "KT-8R": + if not self.MODEL == "KT-8R" and not self.MODEL == "GMRS-50V2": val = min(_mem.settings.txdisp, len(LIST_TXDISP) - 1) rs = RadioSettingValueList(LIST_TXDISP, LIST_TXDISP[val]) txdisp = RadioSetting("settings.txdisp", @@ -1566,7 +1566,7 @@ def get_settings(self): repsw = RadioSetting("settings.repsw", "Repeater SW", rs) basic.append(repsw) - model_list = ["GMRS-50X1", "KT-8R", "KT-WP12", "WP-9900"] + model_list = ["KT-8R", "KT-WP12", "WP-9900"] if self.MODEL not in model_list: val = min(_mem.settings.repm, len(LIST_REPM) - 1) rs = RadioSettingValueList(LIST_REPM, LIST_REPM[val]) @@ -1648,8 +1648,8 @@ def get_settings(self): basic.append(scmode) if self.MODEL in ["KT-8R", "UV-25X2", "UV-25X4", "UV-50X2", - "GMRS-50X1", "GMRS-20V2", "UV-50X2_G2", - "GMRS-50V2", "UV-25X2_G2", "UV-25X4_G2"]: + "GMRS-20V2", "UV-50X2_G2", "GMRS-50V2", + "UV-25X2_G2", "UV-25X4_G2"]: val = min(_mem.settings.tmrtx, len(LIST_TMRTX) - 1) rs = RadioSettingValueList(LIST_TMRTX, LIST_TMRTX[val]) tmrtx = RadioSetting("settings.tmrtx", "TX in multi-standby", rs) @@ -4335,72 +4335,6 @@ def match_model(cls, filedata, filename): u8 unknown[2]; } fm_radio_preset[16]; -#seekto 0x3200; -struct { - u8 tmr; - u8 unknown1; - u8 sql; - u8 unknown2; - u8 unused3204:7, - autolk:1; - u8 tot; - u8 apo; - u8 unknown3; - u8 abr; - u8 unused3209:7, - beep:1; - u8 unknown4[4]; - u8 dtmfst; - u8 unknown5[2]; - u8 screv; - u8 unknown6[2]; - u8 pttid; - u8 pttlt; - u8 unknown7; - u8 emctp; - u8 emcch; - u8 unusedE19:7, - sigbp:1; - u8 vox; - u8 camdf; - u8 cbmdf; - u8 ccmdf; - u8 cdmdf; - u8 langua; - u8 sync; - - - u8 stfc; - u8 mffc; - u8 sfafc; - u8 sfbfc; - u8 sfcfc; - u8 sfdfc; - u8 subfc; - u8 fmfc; - u8 sigfc; - u8 modfc; - u8 menufc; - u8 txfc; - u8 txdisp; - u8 unknown9[5]; - u8 anil; - u8 reps; - u8 repm; - u8 tmrmr; - u8 unusedE37:7, - ste:1; - u8 rpste; - u8 rptdl; - u8 dtmfg; - u8 mgain; - u8 skiptx; - u8 scmode; - u8 tmrtx; - u8 unknown10; - u8 earpho; -} settings; - #seekto 0x3280; struct { u8 unknown1; @@ -4485,6 +4419,139 @@ def match_model(cls, filedata, filename): """ +GMRS_ORIG_MEM_FORMAT = """ +#seekto 0x3200; +struct { + u8 tmr; + u8 unknown1; + u8 sql; + u8 unknown2; + u8 unused3204:7, + autolk:1; + u8 tot; + u8 apo; + u8 unknown3; + u8 abr; + u8 unused3209:7, + beep:1; + u8 unknown4[4]; + u8 dtmfst; + u8 unknown5[2]; + u8 screv; + u8 unknown6[2]; + u8 pttid; + u8 pttlt; + u8 unknown7; + u8 emctp; + u8 emcch; + u8 unusedE19:7, + sigbp:1; + u8 vox; + u8 camdf; + u8 cbmdf; + u8 ccmdf; + u8 cdmdf; + u8 langua; + u8 sync; + u8 stfc; + u8 mffc; + u8 sfafc; + u8 sfbfc; + u8 sfcfc; + u8 sfdfc; + u8 subfc; + u8 fmfc; + u8 sigfc; + u8 modfc; + u8 menufc; + u8 txfc; + u8 txdisp; + u8 unknown9[5]; + u8 anil; + u8 reps; + u8 repm; + u8 tmrmr; + u8 unusedE37:7, + ste:1; + u8 rpste; + u8 rptdl; + u8 dtmfg; + u8 mgain; + u8 skiptx; + u8 scmode; + u8 tmrtx; + u8 unknown10; + u8 earpho; +} settings; +""" + + +GMRS_V2_MEM_FORMAT = """ +#seekto 0x3200; +struct { + u8 tmr; + u8 unknown1; + u8 sql; + u8 unknown2; + u8 unused3204:7, + autolk:1; + u8 tot; + u8 apo; + u8 unknown3; + u8 abr; + u8 unused3209:7, + beep:1; + u8 unknown4[4]; + u8 dtmfst; + u8 unknown5[2]; + u8 screv; + u8 unknown6[2]; + u8 pttid; + u8 pttlt; + u8 unknown7; + u8 emctp; + u8 emcch; + u8 unusedE19:7, + sigbp:1; + u8 unknown8; // vox + u8 camdf; + u8 cbmdf; + u8 ccmdf; + u8 cdmdf; + u8 vox; // langua + u8 sync; + u8 stfc; + u8 mffc; + u8 sfafc; + u8 sfbfc; + u8 sfcfc; + u8 sfdfc; + u8 subfc; + u8 fmfc; + u8 sigfc; + u8 modfc; + u8 menufc; + u8 txfc; + u8 unknown9[5]; + u8 anil; + u8 reps; + u8 repm; + u8 tmrmr; + u8 unusedE37:7, + ste:1; + u8 rpste; + u8 rptdl; + u8 dtmfg; + u8 mgain; + u8 skiptx; + u8 scmode; + u8 tmrtx; + u8 unknown10[2]; + u8 earpho; +} settings; +""" + + class BTechGMRS(BTechMobileCommon): """BTECH's GMRS Mobile""" COLOR_LCD = True @@ -4496,7 +4563,8 @@ def process_mmap(self): """Process the mem map into the mem object""" # Get it - self._memobj = bitwise.parse(GMRS_MEM_FORMAT, self._mmap) + mem_format = GMRS_MEM_FORMAT + GMRS_ORIG_MEM_FORMAT + self._memobj = bitwise.parse(mem_format, self._mmap) # load specific parameters from the radio image self.set_options() @@ -4573,6 +4641,16 @@ class GMRS50V2(BTechGMRS): _fileid = [GMRS50X1_fp1, GMRS50X1_fp] _gmrs = True + def process_mmap(self): + """Process the mem map into the mem object""" + + # Get it + mem_format = GMRS_MEM_FORMAT + GMRS_V2_MEM_FORMAT + self._memobj = bitwise.parse(mem_format, self._mmap) + + # load specific parameters from the radio image + self.set_options() + def validate_memory(self, mem): msgs = super().validate_memory(mem)