brendan-w / python-OBD

OBD-II serial module for reading engine data
GNU General Public License v2.0
1.02k stars 360 forks source link

Fix ELM327 synchronization on startup #244

Closed interfect closed 2 years ago

interfect commented 2 years ago

Right now __read() will stop reading at "OK" even if a ">" is still coming. This can cause the ">" to be seen as the response to the next command, which confuses the initialization sequence, since the initialization sequence expects a very specific set of responses to its commands.

This changes __read() so that by default it only treats ">" as the response terminator. When we issue the "ATLP" command to enter low-power mode, we will use "OK" as the response terminator instead, since that's the only time we don't expect to see a prompt.

This should fix #226 and should also fix #227.