<div dir="ltr"><div class="gmail_default" style="font-family:'courier new',monospace">I have tested it with the "newer" versions that had the upload/download issues as well as an "older" version that was previously working with chirp.</div><div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style="font-family:'courier new',monospace">What is the review process for patches? Should I submit a new patch with the corrections that you request?</div><div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style="font-family:'courier new',monospace">Thank you.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-03-09 21:16 GMT-04:00 Dan Smith <span dir="ltr"><<a href="mailto:dsmith@danplanet.com" target="_blank">dsmith@danplanet.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Mathieu,<br>
<br>
It came through this time :)<br>
<br>
> # HG changeset patch<br>
> # User Mathieu Rozon <<a href="mailto:mathrozon@gmail.com">mathrozon@gmail.com</a>><br>
> # Date 1425778153 18000<br>
> # Sat Mar 07 20:29:13 2015 -0500<br>
> # Node ID cfdd6f6577f1c8d420376c35bb684a9552042179<br>
> # Parent d84dfd6c29d61268de11584f5d427e60936131d9<br>
> Fix downloading/uploading issue for UV-5R. Fixes #2317<br>
><br>
> diff -r d84dfd6c29d6 -r cfdd6f6577f1 chirp/drivers/uv5r.py<br>
> --- a/chirp/drivers/uv5r.py Tue Mar 03 22:25:38 2015 -0800<br>
> +++ b/chirp/drivers/uv5r.py Sat Mar 07 20:29:13 2015 -0500<br>
> @@ -438,17 +438,22 @@<br>
> ack = serial.read(1)<br>
> if ack != "\x06":<br>
> raise errors.RadioError("Radio refused clone")<br>
> -<br>
> +<br>
<br>
You're adding whitespace here, please remove this.<br>
<br>
> return ident<br>
><br>
><br>
> -def _read_block(radio, start, size):<br>
> +def _read_block(radio, start, size, firstCommand):<br>
<br>
Since this is not needed every time, you should default this to False<br>
for easier calling. Like this:<br>
<br>
def _read_block(radio, start, size, first_command=False):<br>
...<br>
<br>
> msg = struct.pack(">BHB", ord("S"), start, size)<br>
> radio.pipe.write(msg)<br>
><br>
> + if(firstCommand == False):<br>
<br>
Please don't use camelCase identifiers and observe proper spacing; the<br>
parentheses are unnecessary. Also, the pythonic way to do this would be:<br>
<br>
if not first_command:<br>
...<br>
<br>
> + ack = radio.pipe.read(1)<br>
> + if ack != "\x06":<br>
> + raise errors.RadioError("Radio refused to send second block 0x%04x" % start)<br>
> +<br>
> answer = radio.pipe.read(4)<br>
> if len(answer) != 4:<br>
> - raise errors.RadioError("Radio refused to send block 0x%04x" % start)<br>
> + raise errors.RadioError("Radio refused to send first block 0x%04x" % start)<br>
<br>
I don't think you should make this change, as you could hit this error<br>
on a non-first block.<br>
<br>
><br>
> cmd, addr, length = struct.unpack(">BHB", answer)<br>
> if cmd != ord("X") or addr != start or length != size:<br>
> @@ -464,28 +469,25 @@<br>
> raise errors.RadioError("Radio sent incomplete block 0x%04x" % start)<br>
><br>
> radio.pipe.write("\x06")<br>
> -<br>
> - ack = radio.pipe.read(1)<br>
> - if ack != "\x06":<br>
> - raise errors.RadioError("Radio refused to send block 0x%04x" % start)<br>
> + time.sleep(0.005)<br>
><br>
> return chunk<br>
><br>
><br>
> def _get_radio_firmware_version(radio):<br>
> if radio.MODEL == "BJ-UV55":<br>
> - block = _read_block(radio, 0x1FF0, 0x40)<br>
> + block = _read_block(radio, 0x1FF0, 0x40, True)<br>
> version = block[0:6]<br>
> else:<br>
> - block1 = _read_block(radio, 0x1EC0, 0x40)<br>
> - block2 = _read_block(radio, 0x1F00, 0x40)<br>
> + block1 = _read_block(radio, 0x1EC0, 0x40, True)<br>
> + block2 = _read_block(radio, 0x1F00, 0x40, False)<br>
<br>
If you make the change I suggested above about the defaulted parameter,<br>
then you won't need to pass False here.<br>
<br>
I'm worried that this may not work for other UV5R variants, other than<br>
the ones mentioned in the bug.<br>
<br>
Jim, can you look the changes here over and see if you think it'll be a<br>
problem for the other versions of this radio?<br>
<br>
Thanks!<br>
<span class="HOEnZb"><font color="#888888"><br>
--Dan<br>
<br>
</font></span><br>_______________________________________________<br>
chirp_devel mailing list<br>
<a href="mailto:chirp_devel@intrepid.danplanet.com">chirp_devel@intrepid.danplanet.com</a><br>
<a href="http://intrepid.danplanet.com/mailman/listinfo/chirp_devel" target="_blank">http://intrepid.danplanet.com/mailman/listinfo/chirp_devel</a><br>
Developer docs: <a href="http://chirp.danplanet.com/projects/chirp/wiki/Developers" target="_blank">http://chirp.danplanet.com/projects/chirp/wiki/Developers</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div style="font-size:small"><div style="font-family:'courier new',monospace"><---- Mathieu Rozon ----><br></div></div><div style="font-size:small"><div dir="ltr"><font face="courier new, monospace"> <a href="mailto:mathrozon@gmail.som" style="color:rgb(17,85,204)" target="_blank">mathrozon@gmail.com</a><br></font><div><span style="font-family:'courier new',monospace"> (514)475-5010</span></div></div></div></div></div></div></div>
</div>