<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Cool, thanks! Just a few comments from a quick skim:<br>
> - return "Memory %i: %s%s%s %s (%s) r%.1f%s c%.1f%s d%03i%s%s [%.2f]"% \<br>> + return "Memory %s: %s%s%s %s (%s) r%.1f%s c%.1f%s d%03i%s%s [%.2f]"% \<br>The number is an integer, so this doesn't make sense, AFAICT.<br>
</blockquote><div><br></div><div>aw shucks, you're totally right. I had it in there before I figured out how to use special channels correctly.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
> + #if data != radio._mmap[:32]:<br>> + #raise errors.RadioError("Model mis-match: \n%s\n%s" % (util.hexprint(data),<br>> + #util.hexprint(radio._mmap[:32])))<br>
Why is this commented-out?<br></blockquote><div><br></div><div>Thanks for catching that! Disabled it while getting the hang of the memory layout and forgot to re-enable</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
> +<br>> + for i in range(0, 0x4000, 0x20):<br>> + addr = i + 0x20<br>> + msg = struct.pack(">cHb", "W", i, 0x20)<br>> + msg += radio._mmap[addr:addr+0x20]<br>
Need space around the + operator here<br></blockquote><div> </div><div>Fixed.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
> + def _decode_tone(self, toneval):<br>> + pol = "N"<br>> + rawval = (toneval[1].get_bits(0xFF) << 8) | toneval[0].get_bits(0xFF)<br>Doesn't this just mean you need to use the other endianess of your toneval?<br>
</blockquote><div><br></div><div>I copy-pasted from thuv1f.py without thinking too hard about it. There's a bunch more code in _decode_tone and _encode_tone that rely on this particular endianness. Can we just leave it as-is, since the other code does it this way?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">> + if isinstance(number, int):<br>
> + enabled = self._memobj.enable[(number - 1) / 8].flags[7-((number - 1) % 8)]<br>> + dont_skip = self._memobj.skip[(number - 1) / 8].flags[7-((number - 1) % 8)]<br>Need space around the - operator.<br>
</blockquote><div><br></div><div>fixed</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">> + if dont_skip:<br>
> + mem.skip = ""<br>> + else:<br>> + mem.skip = "S"<br>This should be four-space indented.<br></blockquote><div><br></div><div>fixed</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Also, this could be compacted to:<br> mem.skip = "S" if not dont_skip else ""<br></blockquote><div><br></div><div>Thanks! fixed</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
> + if mem.empty:<br>> + _mem.set_raw("\xFF" * 32)<br>> + self._memobj.enable[(mem.number - 1) / 8].flags[7-((mem.number - 1) % 8)] = False<br>> + self._memobj.skip[(mem.number - 1) / 8].flags[7-((mem.number - 1) % 8)] = False<br>
> + return<br>> + else:<br>> + self._memobj.enable[(mem.number - 1) / 8].flags[7-((mem.number - 1) % 8)] = True</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Need spaces around the - operator.<br></blockquote><div>fixed</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
> + self._memobj.skip[(mem.number - 1) / 8].flags[7-((mem.number - 1) % 8)] = (mem.skip == "")<br>Here too.<br></blockquote><div><br></div><div>fixed</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>On Mon, Oct 7, 2013 at 8:00 AM, Dan Smith <<a href="mailto:dsmith@danplanet.com">dsmith@danplanet.com</a>> wrote:<br>><br>> > I acquired a TYT TH-UVF8D several months back, and I've finally found<br>
> > the time to finish off adding support for it to CHIRP. In adding support<br>> > for editing the VFO channels as "Special Channels", I had to make a<br>> > small tweak to the command-line utility so it didn't choke on<br>
> > non-numeric channel names. Attached is the patch for that, the patch for<br>> > the radio, and an image file dumped from the radio for testing purposes.<br>><br>> Cool, thanks! Just a few comments from a quick skim:<br>
><br>> > - return "Memory %i: %s%s%s %s (%s) r%.1f%s c%.1f%s d%03i%s%s [%.2f]"% \<br>> > + return "Memory %s: %s%s%s %s (%s) r%.1f%s c%.1f%s d%03i%s%s [%.2f]"% \<br>><br>
> The number is an integer, so this doesn't make sense, AFAICT.<br>><br>> > + #if data != radio._mmap[:32]:<br>> > + #raise errors.RadioError("Model mis-match: \n%s\n%s" % (util.hexprint(data),<br>
> > + #util.hexprint(radio._mmap[:32])))<br>><br>> Why is this commented-out?<br>><br>> > +<br>> > + for i in range(0, 0x4000, 0x20):<br>
> > + addr = i + 0x20<br>> > + msg = struct.pack(">cHb", "W", i, 0x20)<br>> > + msg += radio._mmap[addr:addr+0x20]<br>><br>> Need space around the + operator here<br>
><br>> > + def _decode_tone(self, toneval):<br>> > + pol = "N"<br>> > + rawval = (toneval[1].get_bits(0xFF) << 8) | toneval[0].get_bits(0xFF)<br>><br>> Doesn't this just mean you need to use the other endianess of your toneval?<br>
><br>> > + if isinstance(number, int):<br>> > + enabled = self._memobj.enable[(number - 1) / 8].flags[7-((number - 1) % 8)]<br>> > + dont_skip = self._memobj.skip[(number - 1) / 8].flags[7-((number - 1) % 8)]<br>
><br>> Need space around the - operator.<br>><br>> > + if dont_skip:<br>> > + mem.skip = ""<br>> > + else:<br>> > + mem.skip = "S"<br>><br>
> This should be four-space indented.<br>><br>> Also, this could be compacted to:<br>><br>> mem.skip = "S" if not dont_skip else ""<br>><br>> > + if mem.empty:<br>> > + _mem.set_raw("\xFF" * 32)<br>
> > + self._memobj.enable[(mem.number - 1) / 8].flags[7-((mem.number - 1) % 8)] = False<br>> > + self._memobj.skip[(mem.number - 1) / 8].flags[7-((mem.number - 1) % 8)] = False<br>> > + return<br>
> > + else:<br>> > + self._memobj.enable[(mem.number - 1) / 8].flags[7-((mem.number - 1) % 8)] = True<br>><br>> Need spaces around the - operator.<br>><br>> > + self._memobj.skip[(mem.number - 1) / 8].flags[7-((mem.number - 1) % 8)] = (mem.skip == "")<br>
><br>> Here too.<br>><br>> --<br>> Dan Smith<br>> <a href="http://www.danplanet.com">www.danplanet.com</a><br>> KK7DS<br>><br>><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">http://intrepid.danplanet.com/mailman/listinfo/chirp_devel</a><br>
> Developer docs: <a href="http://chirp.danplanet.com/projects/chirp/wiki/Developers">http://chirp.danplanet.com/projects/chirp/wiki/Developers</a></blockquote></div>