# HG changeset patch # User Marco Filippi iz3gme.marco@gmail.com # Date 1350240956 -7200 # Node ID 9bc54b04aade4c837fe6341ddb0a61d475945e25 # Parent 3ad553c1b546c38efee6a35e02938dce74a38427 [KG816] Initial support - still experimental First implementation of issue #320
diff --git a/chirp/wouxun.py b/chirp/wouxun.py --- a/chirp/wouxun.py +++ b/chirp/wouxun.py @@ -463,8 +463,10 @@ # New-style image (CHIRP 0.1.12) if len(filedata) == 8192 and \ filedata[0x60:0x64] != "2009" and \ - filedata[0x1f77:0x1f7d] == "\xff\xff\xff\xff\xff\xff": - # that area is (seems to be) unused + filedata[0x1f77:0x1f7d] == "\xff\xff\xff\xff\xff\xff" and \ + filedata[0x0d70:0x0d80] == "\xff\xff\xff\xff\xff\xff\xff\xff" \ + "\xff\xff\xff\xff\xff\xff\xff\xff": + # those areas are (seems to be) unused return True # Old-style image (CHIRP 0.1.11) if len(filedata) == 8200 and \ @@ -572,3 +574,123 @@ filedata[0x1f77:0x1f7d] == "WELCOM": return True return False + +@directory.register +class KG816Radio(KGUVD1PRadio, + chirp_common.ExperimentalRadio): + """Wouxun KG816""" + MODEL = "KG816" + + _MEM_FORMAT = """ + #seekto 0x0010; + struct { + lbcd rx_freq[4]; + lbcd tx_freq[4]; + ul16 rx_tone; + ul16 tx_tone; + u8 _3_unknown_1:4, + bcl:1, + _3_unknown_2:3; + u8 splitdup:1, + skip:1, + power_high:1, + iswide:1, + _2_unknown_2:4; + u8 unknown[2]; + } memory[199]; + + #seekto 0x0d70; + struct { + u16 vhf_rx_start; + u16 vhf_rx_stop; + u16 uhf_rx_start; + u16 uhf_rx_stop; + u16 vhf_tx_start; + u16 vhf_tx_stop; + u16 uhf_tx_start; + u16 uhf_tx_stop; + } freq_ranges; + + #seekto 0x1008; + struct { + u8 unknown[8]; + u8 name[6]; + u8 pad[2]; + } names[199]; + """ + + @classmethod + def get_experimental_warning(cls): + return ('We have not that much information on this model ' + 'up to now we only know it has the same memory ' + 'organization of KGUVD1 but uses 199 memories. ' + 'it has been reported to work but ' + 'proceed at your own risk!') + + def get_features(self): + rf = KGUVD1PRadio.get_features(self) + rf.memory_bounds = (1, 199) # this is the only known difference + return rf + + def get_settings(self): + freqranges = RadioSettingGroup("freqranges", "Freq ranges (read only)") + top = RadioSettingGroup("top", "All Settings", freqranges) + + rs = RadioSetting("vhf_rx_start", "vhf rx start", + RadioSettingValueInteger(136, 520, + decode_freq( + self._memobj.freq_ranges.vhf_rx_start))) + freqranges.append(rs) + rs = RadioSetting("vhf_rx_stop", "vhf rx stop", + RadioSettingValueInteger(136, 520, + decode_freq( + self._memobj.freq_ranges.vhf_rx_stop))) + freqranges.append(rs) + rs = RadioSetting("uhf_rx_start", "uhf rx start", + RadioSettingValueInteger(136, 520, + decode_freq( + self._memobj.freq_ranges.uhf_rx_start))) + freqranges.append(rs) + rs = RadioSetting("uhf_rx_stop", "uhf rx stop", + RadioSettingValueInteger(136, 520, + decode_freq( + self._memobj.freq_ranges.uhf_rx_stop))) + freqranges.append(rs) + rs = RadioSetting("vhf_tx_start", "vhf tx start", + RadioSettingValueInteger(136, 520, + decode_freq( + self._memobj.freq_ranges.vhf_tx_start))) + freqranges.append(rs) + rs = RadioSetting("vhf_tx_stop", "vhf tx stop", + RadioSettingValueInteger(136, 520, + decode_freq( + self._memobj.freq_ranges.vhf_tx_stop))) + freqranges.append(rs) + rs = RadioSetting("uhf_tx_start", "uhf tx start", + RadioSettingValueInteger(136, 520, + decode_freq( + self._memobj.freq_ranges.uhf_tx_start))) + freqranges.append(rs) + rs = RadioSetting("uhf_tx_stop", "uhf tx stop", + RadioSettingValueInteger(136, 520, + decode_freq( + self._memobj.freq_ranges.uhf_tx_stop))) + freqranges.append(rs) + + # tell the decoded ranges to UI + self.valid_freq = [ + ( decode_freq(self._memobj.freq_ranges.vhf_rx_start) * 1000000, + (decode_freq(self._memobj.freq_ranges.vhf_rx_stop)+1) * 1000000)] + + return top + + @classmethod + def match_model(cls, filedata, filename): + if len(filedata) == 8192 and \ + filedata[0x60:0x64] != "2009" and \ + filedata[0x1f77:0x1f7d] == "\xff\xff\xff\xff\xff\xff" and \ + filedata[0x0d70:0x0d80] != "\xff\xff\xff\xff\xff\xff\xff\xff" \ + "\xff\xff\xff\xff\xff\xff\xff\xff": + return True + return False + diff --git a/tests/images/Wouxun_KG816.img b/tests/images/Wouxun_KG816.img new file mode 100644 index 0000000000000000000000000000000000000000..090e18d5f3a084671fe7b738efae97824273b450 GIT binary patch literal 8192 zc%1E*KaAT{9LJySB=*ZSZqAo~#ksqx$mkXj6(9?V%^eYXV(7$BdFoiGtf)C?RSC}R z);4zoAhiMtEds>CpA94yCKwS5d#8c~LTusZ92bB6Jvvo)f-1l2o$}4c?|omKm+#M= zPOGKVl|-o^DPHf$FzJoNq&?9$?VTB)2=9yj!rA3p!rP+1+~v{LL`5s}`AS`v>${~k zvc3s`%k^rdT;It0reFF8*Af$SN}XR#OkQ07V{NA6D~XAN`F@mnOXh1>|4mun1Ap-| zE3p2ytUnNa&))q!xqO~w_`LZ)pLcJ68%Z(d>t!dCVw8S2<oX_PnV&6#-V)u0^{>hG z<>yn8@CbM&`_15f8d={I>pxN7nI3#8rIKQl_e&+kDEBKo0v-#Gfg9llcq%*vo(a!@ z=fZQ~%1Vk+`ddjcN`K)I@K|^Z+z2<oQ{gG_On3%77oG!Gc2bPe-%g5A`U{VM$HHUa zMz{f<3QvJ&!ZYBx@Eo{ul46uv&Y#+V{cI$~DEA{g0v-#Gfz$alsqhrfv+%6cQRB?1 zV(jT`aOPAo=KQ4alfV<<3GmaxPXj+I{4DUx!Y>1#2%nT%Mb9V2DEI$dQj9(QsMWqa zF_H(S4c`~#?L1HR&X4fC4d<oEuQJa}Ao&(R9!0{VWjHUwW8g-(0Y1;if6q6Q3(tXb zKM5qS1IYhKcm#Z3o>%*YNrk5{KNFq-&xPj??k^^g{t-Z)Qok~>@EG%!`b8={1y1?Q z{fYCP`aS_N5Es@FoW?08fRdz%$_)_DA74aO%G%xGw(Ck0ap`@K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