Re: Parsing data from pyserial, an (inefficient) solution

2006-12-04 Thread Grant Edwards
On 2006-12-04, Giovanni Bajo <[EMAIL PROTECTED]> wrote: [...] >> This should result in complete packets (from the "M" to a "\r") > > Oh well. readline(eol="\r") will do that much better. Yup. Using readline() has been suggested several times. It sure seems like the obvious solution to me as w

Re: Parsing data from pyserial, an (inefficient) solution

2006-12-04 Thread Giovanni Bajo
Dennis Lee Bieber wrote: > >> The really sad thing is that I get a perfectly constructed >> packet from the reading variable, and that gets butchered when I >> try to slice it up to pick out individual elements. Since >> pyserial doesn’t do anything to rearrange the data, then the >> CMUcam must d

Re: Parsing data from pyserial, an (inefficient) solution

2006-12-03 Thread John Machin
Lone Wolf wrote: Your code has a problem when the first character of reading is 'M': you will miss the full packet and pick up a fragment. The length test that you are doing to reject the fragment is a kludge. If the average length of a packet is say 25, then you are throwing away 4% of all packet