Closed ddowling closed 2 years ago
I ran into this today too. I have a fix where I made the end marker an argument to the reading function, pulled it through to __send
, and then set it to the prompt by default and the low power mode acknowledgment only when we send the command to enter low power mode. That seems to work and should not break low power mode.
I will try and make a PR of this soon; I have to pull it off the computer that can go into the car.
I was having problems getting the python-obd library to reliably sync with a cheap ELM327 clone. I believe the problem is due to some code added to elm327.py to support low power mode. Specifically the line line elm327.py:548
During start up the following exchange happens with the ELM327:
Note how after ATE0 is sent to the ELM327 we receive back the echoed command and then an OK. This OK matches the ELM_LP_ACTIVE clause and the command returns before reading the next line containing the chevron prompt. When the ATH1 command is sent to the ELM327 the chevron prompt is then read and the code assumes this command has failed.
The fix is to always attempt to read up to the chevron prompt and to not bail out early if we read OK in the response stream. If I change line 548 to the following the adapter connects reliably everytime:
I am not sure how my change will impact the low power mode as I am not using this but I am happy to test out an alternate fix if required.