<div dir="ltr"><span class="gmail-im">> + "->Tone": ("R-TONE", None),<br>
<br></span>
I had a question about this in the previous patch.<span class="gmail-im"><br>
<br>
> + "Tone->Tone": ("TSQL", None)<br></span><div><span class="gmail-im">
> + }</span></div><div><span class="gmail-im"><br></span></div><div><span class="gmail-im">These are two mappings from the CHIRP definitions to the Yaesu definitions. Yaesu uses "TSQL" to mean "send and receive ctcss tones,</span></div><div><span class="gmail-im">and the toned do jot need to be identical. thus we must map to "Yaesu TSQL" on both cases. I chose to use the name "TSQL" for to this</span></div><div><span class="gmail-im">Yaseu value because it's in the Yasu documentation and it's what you see on the radio's screen. I could have renamed it in the ptyhon</span></div><div><span class="gmail-im">code, but the other drivers seem to adhere to the manufacturer's documentation.</span></div><div><span class="gmail-im"><br></span></div><div><span class="gmail-im">Sinmilarly, Yaesu "R-TONE" is the name for "don't send a tone, but do receive a tone." The Yaseu name for reverse polarity tone squelch is "REV TN".</span></div><div><span class="gmail-im"><br></span></div><div><span class="gmail-im"><br></span></div><div><span class="gmail-im">About the use of a single table: I have been thinking about that a lot. It's not really a trivial problem, but I think that may be a reasonable solution.</span></div><div><span class="gmail-im">the underlying problem is that an abstract radio can perform some or all of 15 combinations of tone handling. :</span></div><div><span class="gmail-im"> Tx (none, ctcss,dcs) x Rx (none, ctcss,dcs,ctcss-R, dcs-R)</span></div><div><span class="gmail-im">and of these two two are split (ctcss==, ctcss!=) and (dcs==, dcs!=). The CHIRP mem structure uses two fields to represent this and each</span></div><div><span class="gmail-im">radio uses its own strange multi-field encoding.</span></div><div><span class="gmail-im"><br></span></div><div><span class="gmail-im">To complicate this, I originally thought that the CHIRP unit tests require that we preserve tone fields even some cases where a given</span></div><div><span class="gmail-im">tone field is clearly a "don't care" as far as the radio is concerned. This is a burden on the code and on the approach we must take.<br></span></div><div><span class="gmail-im">I now think I was not quite right about this,and it turns out that could simply not put any value into the mem structure for these cases.<br></span></div><div><span class="gmail-im"><br></span></div><div><span class="gmail-im">None of the other drives I looked at even attempt to create an explicit two-way mapping. Instead, they they use one if-test chain for encode and</span></div><div><span class="gmail-im">a second if-test chain for decode. When I originally wrote my code by example, I simply converted each of these if-chains into a separate table.<br></span></div><div><span class="gmail-im">The code has substantially different requirements for the two tables, so Idon't think that there is a single table that is both comprehensible and</span></div><div><span class="gmail-im">has simple lookups for both directions. a simplified table will complicate the code. I'll give this another try today.<br></span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 28, 2019 at 7:12 AM Dan Smith via chirp_devel <<a href="mailto:chirp_devel@intrepid.danplanet.com">chirp_devel@intrepid.danplanet.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> @@ -217,7 +216,7 @@<br>
> return sum(x for x in bytearray(data)) & 0xFF<br>
> <br>
> <br>
> -def variable_len_resp(pipe):<br>
> +def variable_len_resp(pipe, cmd):<br>
> """<br>
> when length of expected reply is not known, read byte at a time<br>
> until the ack character is found.<br>
> @@ -233,8 +232,11 @@<br>
> response += b<br>
> i += 1<br>
> if i > toolong:<br>
> - LOG.debug("Response too long. got" + util.hexprint(response))<br>
> - raise errors.RadioError("Response too long.")<br>
> + msg = "received too many bytes from radio before ACK. "<br>
> + msg += "Sent " + util.hexprint(cmd)<br>
> + msg += ". Got " + util.hexprint(response)<br>
> + LOG.debug(msg)<br>
> + raise errors.RadioError(msg)<br>
<br>
Heh, okay, I see I jumped the gun here. However, hexprinted debug is way too much info to show to the user too. Somewhere in the middle please. I'm sure I'm seeming overly picky here, but we have some variety in the error messages that people get since they're all defined by the deep internals of the drivers, so I'm trying to steer this somewhere towards the center.<br>
<br>
I can also change this up to be what I think it should be (like the examples I gave earlier) if you want.<br>
<br>
> +# map a CHIRP tone mode to a FT-4 sql and which if any code to set to 0.<br>
> +# The keys are provided to RadioFeatures as a list, so these are the<br>
> +# only values we expect to see in mem.tmode. This map as the identical<br>
> +# structure as the one below to simplify the code. It permits stricter<br>
> +# zeroing of the unused fields later if we find that it is needed,<br>
> +# but the CHIRP unit tests want us to leave them alone.<br>
> +MODES_TONE = {<br>
> + "": ("off", None),<br>
> + "Tone": ("T-TONE", None), # chirp means "xmit, not rcv"<br>
> + "TSQL": ("TSQL", None), # chirp means "xmit and rcv, tx==rx"<br>
> + "DTCS": ("DCS", None), # chirp means "xmt and rcv, tx==rx"<br>
> + "TSQL-R": ("REV-TN", None), # chirp means reverse R-Tone<br>
> + "Cross": () # not used in lookup, needed in list<br>
> + }<br>
> +<br>
> +# Map a CHIRP Cross type if the CHIRP mem.tmode is "Cross". The keys<br>
> +# are provided to RadioFeatures as a list, so these are the<br>
> +# only values we expect to see in mem.cross.<br>
> +MODES_CROSS = {<br>
> + "DTCS->": ("DCS", "rx_dcs"),<br>
> + "->DTCS": ("DCS", "tx_dcs"),<br>
> + "DTCS->DTCS": ("DCS", None),<br>
> + "->Tone": ("R-TONE", None),<br>
<br>
I had a question about this in the previous patch.<br>
<br>
> + "Tone->Tone": ("TSQL", None)<br>
> + }<br>
<br>
Tone->Tone is only for when the tones are different, which is not what TSQL means...<br>
<br>
> # names for the setmode function for the programmable keys. Mode zero means<br>
> # that the key is programmed for a memory not a setmode.<br>
> SETMODES = [<br>
> - "mem", "apo", "ar bep", "ar int", "beclo", #00-04<br>
> - "beep", "bell", "cw id", "cw wrt", "dc vlt", #05-09<br>
> - "dcs cod", "dt dly", "dt set", "dtc spd", "edg.bep", #10-14<br>
> - "lamp", "led.bsy", "led.tx", "lock", "m/t-cl", #15-19<br>
> - "mem.del", "mem.tag", "pag.abk", "pag.cdr", "pag.cdt", #20-24<br>
> - "pri.rvt", "pswd", "pswdwt", "rf sql", "rpt.ars", #25-29<br>
> - "rpt.frq", "rpt.sft", "rxsave", "scn.lmp", "scn.rsm", #30-34<br>
> - "skip", "sql.typ", "step", "tn frq", "tot", #35-39<br>
> - "tx pwr", "tx save", "vfo.spl", "vox", "wfm.rcv", #40-44<br>
> - "w/n.dev", "wx.alert" #45-46<br>
> + "mem", "apo", "ar bep", "ar int", "beclo", # 00-04<br>
> + "beep", "bell", "cw id", "cw wrt", "dc vlt", # 05-09<br>
> + "dcs cod", "dt dly", "dt set", "dtc spd", "edg.bep", # 10-14<br>
> + "lamp", "led.bsy", "led.tx", "lock", "m/t-cl", # 15-19<br>
> + "mem.del", "mem.tag", "pag.abk", "pag.cdr", "pag.cdt", # 20-24<br>
> + "pri.rvt", "pswd", "pswdwt", "rf sql", "rpt.ars", # 25-29<br>
> + "rpt.frq", "rpt.sft", "rxsave", "scn.lmp", "scn.rsm", # 30-34<br>
> + "skip", "sql.typ", "step", "tn frq", "tot", # 35-39<br>
> + "tx pwr", "tx save", "vfo.spl", "vox", "wfm.rcv", # 40-44<br>
> + "w/n.dev", "wx.alert" # 45-46<br>
<br>
Did this change or did you just reformat it? What about the other copy of this you have in the file?<br>
<br>
> class YaesuFT65Radio(YaesuSC35GenericRadio):<br>
> @@ -1052,9 +1070,9 @@<br>
> MAX_MEM_SLOT = 200<br>
> Pkeys = 4 # number of programmable keys on the FT-65<br>
> namelen = 8 # length of the mem name display on the FT-65 front panel<br>
> - id_str=b'IH-420\x00\x00\x00V100\x00\x00'<br>
> + id_str = b'IH-420\x00\x00\x00V100\x00\x00'<br>
> legal_steps = list(STEP_CODE)<br>
> - legal_steps.remove(6.25) #should not remove if euro version<br>
> + legal_steps.remove(6.25) # should not remove if euro version<br>
> # names for the setmode function for the programmable keys. Mode zero means<br>
> # that the key is programmed for a memory not a setmode.<br>
> SETMODES = [<br>
> @@ -1063,10 +1081,10 @@<br>
> "dc volt", "dcs code", "dtmf set", "dtmf wrt", "edg bep", # 10-14<br>
> "key lock", "lamp", "ledbsy", "mem del", "mon/t-cl", # 15-19<br>
> "name tag", "pager", "password", "pri.rvt", "repeater", # 20-24<br>
> - "resume", "rf.sql", "scn.lamp", "skip", "sql type", # 25-29 <br>
> + "resume", "rf.sql", "scn.lamp", "skip", "sql type", # 25-29<br>
> "step", "tot", "tx pwr", "tx save", "vfo.spl", # 30-34<br>
> "vox", "wfm.rcv", "wide/nar", "wx alert", "scramble" # 35-39<br>
> ]<br>
> +<br>
> def __init__(self):<br>
> self.add_paramdesc("misc", ("compander", "Compander", ["ON", "OFF"]))<br>
> -<br>
<br>
Looks like some whitespace changes jumped in here :)<br>
<br>
I've applied the first four in this set and would like to see some discussion of the previous items I have before we proceed on this one.<br>
<br>
I snuck a change in between these to add ft4.py to the cpep8.manifest so that style checks always run on the file, and it looks like there are still a bunch of offenses in there. Maybe we can get that fixed up shortly in follow-up?<br>
<br>
Thanks!<br>
<br>
--Dan<br>
<br>
_______________________________________________<br>
chirp_devel mailing list<br>
<a href="mailto:chirp_devel@intrepid.danplanet.com" target="_blank">chirp_devel@intrepid.danplanet.com</a><br>
<a href="http://intrepid.danplanet.com/mailman/listinfo/chirp_devel" rel="noreferrer" target="_blank">http://intrepid.danplanet.com/mailman/listinfo/chirp_devel</a><br>
Developer docs: <a href="http://chirp.danplanet.com/projects/chirp/wiki/Developers" rel="noreferrer" target="_blank">http://chirp.danplanet.com/projects/chirp/wiki/Developers</a><br>
</blockquote></div>