Project

General

Profile

New Model #53 » wouxun6_r2.patch

Replacement initial wouxun patch - Dan Smith, 03/17/2012 09:06 AM

View differences:

chirp/wouxun.py Fri Mar 16 22:16:13 2012 -0700 → chirp/wouxun.py Sat Mar 17 09:03:24 2012 -0700
49 49
} names[128];
50 50
"""
51 51

  
52
def wouxun_identify(radio):
52
def _wouxun_identify(radio, string):
53 53
    for i in range(0, 5):
54
        radio.pipe.write("HiWOUXUN\x02")
54
        radio.pipe.write(string)
55 55
        r = radio.pipe.read(9)
56 56
        if len(r) != 9:
57
            print "Got:\n%s" % util.hexprint(r)
57 58
            print "Retrying identification..."
58 59
            time.sleep(1)
59 60
            continue
60 61
        if r[2:8] != radio._model:
62
            print "Model:\n%s" % util.hexprint(r)
61 63
            raise Exception("I can't talk to this model")
62 64
        return
63 65
    if len(r) == 0:
......
65 67
    else:
66 68
        raise Exception("Unable to identify radio")
67 69

  
70
def wouxun_identify(radio):
71
    return _wouxun_identify(radio, "HiWOUXUN\x02")
72

  
73
def wouxun6_identify(radio):
74
    return _wouxun_identify(radio, "HiWXUVD1")
75

  
68 76
def wouxun_start_transfer(radio):
69 77
    radio.pipe.write("\x02\x06")
70 78
    time.sleep(0.05)
......
131 139
    wouxun_start_transfer(radio)
132 140
    return do_upload(radio, 0x0000, 0x2000, 0x0010)
133 141

  
142
def wouxun6_download(radio):
143
    wouxun_identify(radio)
144
    wouxun_start_transfer(radio)
145
    return do_download(radio, 0x0000, 0x2000, 0x0040)
146

  
147
def wouxun6_upload(radio):
148
    wouxun6_identify(radio)
149
    wouxun_start_transfer(radio)
150
    return do_upload(radio, 0x0000, 0x2000, 0x0010)
151

  
134 152
CHARSET = list("0123456789") + [chr(x + ord("A")) for x in range(0, 26)] + \
135 153
    list("?+ ")
136 154

  
......
309 327
            return True
310 328
        return False
311 329

  
330
@directory.register
331
class KGUV6DRadio(KGUVD1PRadio):
332
    MODEL = "KG-UV6D"
333
    _model = "KG????"
334

  
335
    def sync_in(self):
336
        self._mmap = wouxun6_download(self)
337
        self.process_mmap()
338

  
339
    def sync_out(self):
340
        wouxun6_upload(self)
341

  
312 342
def _puxing_prep(radio):
313 343
    radio.pipe.write("\x02PROGRA")
314 344
    ack = radio.pipe.read(1)
(3-3/12)