Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue myELM327.supportedPIDs_1_20() not working as expected … #205

Merged
merged 1 commit into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions examples/ESP32_CheckPIDs_1_20/ESP32_CheckPIDs_1_20.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#include "BluetoothSerial.h"
#include "ELMduino.h"

BluetoothSerial SerialBT;
#define ELM_PORT SerialBT
#define DEBUG_PORT Serial

ELM327 myELM327;

uint32_t rpm = 0;

void setup()
{
#if LED_BUILTIN
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
#endif

DEBUG_PORT.begin(115200);
// SerialBT.setPin("1234");
ELM_PORT.begin("ArduHUD", true);

if (!ELM_PORT.connect("OBDII"))
{
DEBUG_PORT.println("Couldn't connect to OBD scanner - Phase 1");
while (1)
;
}

if (!myELM327.begin(ELM_PORT, true, 2000))
{
Serial.println("Couldn't connect to OBD scanner - Phase 2");
while (1)
;
}

Serial.println("Connected to ELM327");
}

void loop()
{
uint32_t pids = myELM327.supportedPIDs_1_20();

if (myELM327.nb_rx_state == ELM_SUCCESS)
{
Serial.print("Supported PIDS: "); Serial.println(pids);
delay(10000);
}
else if (myELM327.nb_rx_state != ELM_GETTING_MSG)
{
myELM327.printError();
}
}
2 changes: 1 addition & 1 deletion src/ELMduino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2359,7 +2359,7 @@ uint64_t ELM327::findResponse()
{
uint8_t payloadIndex = firstDatum + i;
uint8_t bitsOffset = 4 * (numPayChars - i - 1);
response = response | (ctoi(payload[payloadIndex]) << bitsOffset);
response = response | ((uint64_t)ctoi(payload[payloadIndex]) << bitsOffset);
}

// It is useful to have the response bytes
Expand Down