[chirp_devel] [PATCH] Support Wouxun KG-818 with KG-816 driver. #356
# HG changeset patch # User Tom Hayward tom@tomh.us # Date 1361131936 28800 # Node ID 7b5f7fd9262ca867e086634c6596443091ce575a # Parent 3aeeaedfb5f721bf72c26a416b0a053f96173831 Support Wouxun KG-818 with KG-816 driver. #356
diff -r 3aeeaedfb5f7 -r 7b5f7fd9262c chirp/wouxun.py --- a/chirp/wouxun.py Sat Feb 16 21:30:58 2013 -0500 +++ b/chirp/wouxun.py Sun Feb 17 12:12:16 2013 -0800 @@ -953,42 +953,42 @@ top = RadioSettingGroup("top", "All Settings", freqranges)
rs = RadioSetting("vhf_rx_start", "vhf rx start", - RadioSettingValueInteger(136, 520, + RadioSettingValueInteger(66, 520, decode_freq( self._memobj.freq_ranges.vhf_rx_start))) freqranges.append(rs) rs = RadioSetting("vhf_rx_stop", "vhf rx stop", - RadioSettingValueInteger(136, 520, + RadioSettingValueInteger(66, 520, decode_freq( self._memobj.freq_ranges.vhf_rx_stop))) freqranges.append(rs) rs = RadioSetting("uhf_rx_start", "uhf rx start", - RadioSettingValueInteger(136, 520, + RadioSettingValueInteger(66, 520, decode_freq( self._memobj.freq_ranges.uhf_rx_start))) freqranges.append(rs) rs = RadioSetting("uhf_rx_stop", "uhf rx stop", - RadioSettingValueInteger(136, 520, + RadioSettingValueInteger(66, 520, decode_freq( self._memobj.freq_ranges.uhf_rx_stop))) freqranges.append(rs) rs = RadioSetting("vhf_tx_start", "vhf tx start", - RadioSettingValueInteger(136, 520, + RadioSettingValueInteger(66, 520, decode_freq( self._memobj.freq_ranges.vhf_tx_start))) freqranges.append(rs) rs = RadioSetting("vhf_tx_stop", "vhf tx stop", - RadioSettingValueInteger(136, 520, + RadioSettingValueInteger(66, 520, decode_freq( self._memobj.freq_ranges.vhf_tx_stop))) freqranges.append(rs) rs = RadioSetting("uhf_tx_start", "uhf tx start", - RadioSettingValueInteger(136, 520, + RadioSettingValueInteger(66, 520, decode_freq( self._memobj.freq_ranges.uhf_tx_start))) freqranges.append(rs) rs = RadioSetting("uhf_tx_stop", "uhf tx stop", - RadioSettingValueInteger(136, 520, + RadioSettingValueInteger(66, 520, decode_freq( self._memobj.freq_ranges.uhf_tx_stop))) freqranges.append(rs) @@ -1005,8 +1005,24 @@ 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": + filedata[0x0d70:0x0d80] not in ( + "\xff\xff\xff\xff\xff\xff\xff\xff" \ + "\xff\xff\xff\xff\xff\xff\xff\xff", + "w\xeew1w\xeew1w\xeew1w\xeew1"): # <-- KG818 Low Band PMR return True return False
+ +@directory.register +class KG818Radio(KG816Radio): + """Wouxun KG818""" + MODEL = "KG818" + + @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] == "w\xeew1w\xeew1w\xeew1w\xeew1": + return True + return False
On Sun, Feb 17, 2013 at 12:12 PM, Tom Hayward esarfl@gmail.com wrote:
+@directory.register +class KG818Radio(KG816Radio):
- """Wouxun KG818"""
- MODEL = "KG818"
- @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] == "w\xeew1w\xeew1w\xeew1w\xeew1":
return True
return False
Hmm, while this matches the Wouxun KG-618 66-88 MHz version correctly, other frequency ranges of the KG-618 will show up as KG-616s. This isn't necessarily a bad thing, but there could be a better way. What would Marco do?
Tom KD7LXL
Hmm, while this matches the Wouxun KG-618 66-88 MHz version correctly, other frequency ranges of the KG-618 will show up as KG-616s. This isn't necessarily a bad thing, but there could be a better way. What would Marco do?
...mmm... I can't merge the patch now so I try to read it "as is" I understand that the only difference between 818 and 816 driver is the match_model and you changed the 816 freq ranges to be "larger". If this is right I can't see a reason to have different drivers for the the two models instead of simply renaming the 816 driver to "KG816/KG816" with the enlarged ranges.
My two cents ...
73 de IZ3GME Marco
On Sun, Feb 17, 2013 at 1:36 PM, Marco IZ3GME iz3gme.marco@gmail.com wrote:
If this is right I can't see a reason to have different drivers for the the two models instead of simply renaming the 816 driver to "KG816/KG816" with the enlarged ranges.
I don't like putting multiple models together with "/". I would prefer to have each model listed separately so that it can be chosen during Read from Radio. I'll submit a new version of the patch that allows that, but otherwise inherits everything from KG816.
Tom KD7LXL
...mmm... I can't merge the patch now so I try to read it "as is" I understand that the only difference between 818 and 816 driver is the match_model and you changed the 816 freq ranges to be "larger". If this is right I can't see a reason to have different drivers for the the two models instead of simply renaming the 816 driver to "KG816/KG816" with the enlarged ranges.
My complaint is that I want it to show up as the same thing post-download as it does when you open an image from a file. I'm not crazy about the composite model names, but at least it's consistent.
After talking about it on IRC, I've decided to apply what Tom has (which will load an 818 image as an 816) for now, knowing that when I get the new file format done, we can make it consistent that way.
On 17/02/2013 23:33, Dan Smith wrote:
My complaint is that I want it to show up as the same thing post-download as it does when you open an image from a file. I'm not crazy about the composite model names, but at least it's consistent.
After talking about it on IRC, I've decided to apply what Tom has (which will load an 818 image as an 816) for now, knowing that when I get the new file format done, we can make it consistent that way.
I completely agree with you. I was thinking to the same solution but I omitted to write about the new file format to avoid pressing for it.
73 de IZ3GME Marco
participants (4)
-
Dan Smith
-
IZ3GME Marco
-
Marco IZ3GME
-
Tom Hayward