From: Roger B. <ro...@ro...> - 2004-02-24 05:29:42
|
> + data=com_brew.unescape(data) > + # get rid of leading junk > + d=data.find(firsttwo) > + if d>0: > + data=data[d:] > + # take off crc and terminator ::TODO:: check the crc > + data=data[:-3] You should add the CRC checking. Copy it from one of these places: com_lg.py line 90 com_brew.py line 297 They also deal with multiple responses being in the data read. That would happen if a command was sent, the comms failed for whatever reason, a second command is sent and succeeds and then the read returned both responses joined together. The readuntil code in the comms is arguably broken because it always reads all available characters, and then checks the last one to see if it has the character being looked for. The reason it is done that way is to avoid having buffers in the program code with unread data. Roger |