29 Mar
2016
29 Mar
'16
5:33 p.m.
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