Skip to content

Commit

Permalink
Attempt to remedy PowerBroker2#220 when 0100 command returns more dat…
Browse files Browse the repository at this point in the history
…a than can be handled
  • Loading branch information
PowerBroker2 authored Jan 29, 2024
1 parent 77874c0 commit 3576084
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/ELMduino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,20 @@ bool ELM327::initializeELM(const char &protocol, const byte &dataTimeout)
// the timeout value to 30 seconds, then restore the previous value.
uint16_t prevTimeout = timeout_ms;
timeout_ms = 30000;

int8_t state = sendCommand_Blocking("0100");

if (sendCommand_Blocking("0100") == ELM_SUCCESS)
if (state == ELM_SUCCESS)
{
timeout_ms = prevTimeout;
connected = true;
return connected;
}
else if (state == ELM_BUFFER_OVERFLOW)
{
while (elm_port->available())
elm_port->read();
}

timeout_ms = prevTimeout;
}
Expand Down

0 comments on commit 3576084

Please sign in to comment.