<div dir="ltr"><div><div>Ahh, I see, thanks! I was thinking of doing something like<br><br></div><div>indata=serial.read(1)<br></div>while indata != "?" or indata != "G"<br></div><div> data += indata<br>
<br></div><div>in the download function. I'm not sure if that's proper Python grammar, but you get the idea. Could be done with if as well, but I think your echo_write suggestion is better.<br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Mon, Apr 29, 2013 at 5:13 PM, Dan Smith <span dir="ltr"><<a href="mailto:dsmith@danplanet.com" target="_blank">dsmith@danplanet.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">> I'm working on adding support for a new radio, the Ritron RTX-450.<br>
> It's a commercial radio, but with a bit of VCO tinkering works in the<br>
> ham bands.<br>
<br>
</div>Cool!<br>
<div class="im"><br>
> I started with template.py, and use uv5r.py as a reference, since I<br>
> have one of those as well. So far, I've mapped out the memory and<br>
> established communication with the radio, but I'm having a problem<br>
> when I read the data. To establish communication, I first send a<br>
> series of "?", followed by a "G". As soon as the radio receives the<br>
> G, it starts sending data. What's happening in chirp, though, is when<br>
> I do the serial.read(1), I'm getting the sent data back and then the<br>
> radio data, as if the buffer doesn't clear. This uses an Icom OPC-478<br>
> style cable, where RX and TX are simply wire-OR'd together, so that<br>
> does make sense. I should mention that this cable works fine with the<br>
> OE software. Do I just need to look for the sent string in the<br>
> response and filter it out, or is there a better way to handle this?<br>
> I tried inserting serial.flush() after serial.write("G"), but when<br>
> stepping through the program that seemed to do nothing.<br>
<br>
</div>Yeah, so those sorts of cables "echo" because of the unified TX/RX<br>
line. So, the best way to hand that is something like:<br>
<br>
def _echo_write(radio, data):<br>
radio.pipe.write(data)<br>
radio.pipe.read(len(data))<br>
<br>
and use _echo_write(radio, "foo") instead of radio.pipe.write("foo") in<br>
your communication. Various permutations of the above are used in<br>
drivers having to deal with this sort of behavior.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Dan Smith<br>
<a href="http://www.danplanet.com" target="_blank">www.danplanet.com</a><br>
KK7DS<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></div>