adafruit / Adafruit_CircuitPython_ESP_ATcontrol

Use the ESP AT command sent to communicate with the Interwebs
MIT License
20 stars 17 forks source link

Bug in PR #41 #43

Closed waiweng83 closed 3 years ago

waiweng83 commented 3 years ago

There is a bug in #41. The response from the ESP should be read one byte each time as this code is expecting an 'OK\r\n' as last 4 characters or 'ERROR\r\n' as the last 7 characters.

if response[-4:] == b"OK\r\n":
    break
if response[-7:] == b"ERROR\r\n":
    break

If we read a big chunk of data, this will be missed if there is other data flowing in after the 'OK\r\n'. We should also stop reading from the UART buffer right after we received the 'OK\r\n' so that the data after remains in the UART buffer and can be processed by other function.

Thanks.

waiweng83 commented 3 years ago

@PontusO Can you please take a look?

PontusO commented 3 years ago

You're right not sure what happened here. I'll revert this.

waiweng83 commented 3 years ago

@PontusO Thanks a lot.

waiweng83 commented 3 years ago

Fixed in PR #44.