[chirp_devel] [PATCH][BTECH] New serial flush and better debug messages, fixes #3015

M.Sc. Pavel Milanes Costa
Tue Mar 29 17:33:17 PDT 2016


El 29/03/16 a las 18:39, Dan Smith via chirp_devel escribió:
>> +def _clean_buffer(radio):
>> >+    """Cleaning the read serial buffer, hard timeout to survive an infinite
>> >+    data stream"""
>> >+
>> >+    # WARNING: every time we call this we touch the serialTimeout, this is
>> >+    # to optimize the flushing
>> >+    radio.pipe.setTimeout(0.1)
>> >+    dump = "1"
>> >+    datacount = 0
>> >+
>> >+    try:
>> >+        while len(dump) > 0:
>> >+            dump = radio.pipe.read(100)
>> >+            datacount += len(dump)
>> >+            if  datacount > 320:  # 5 times bigger than a normal rx block
>> >+                # hard limit to survive a infinite serial data stream
>> >+                break
> Don't you want to raise if this happens? This will silently return if we
> read enough junk, the input will not be clean, and our caller will die,
> right? I'm sure it's handled there too, but I think you should raise
> here for clarity.
>
> --Dan

You are right, I will patch it.

Will be good to mention in the error that the user must check about a 
buggy serial device or a serial GPS connected on that port?

73



More information about the chirp_devel mailing list