PowerBroker2 / ELMduino

Arduino OBD-II Bluetooth Scanner Interface Library for Car Hacking Projects
MIT License
587 stars 117 forks source link

custom pid no response #223

Closed manuel833 closed 4 months ago

manuel833 commented 4 months ago

void setup()

  myELM327.sendCommand("AT SH 7E0");

void loop() { String response;
if (myELM327.queryPID(0x22, 0x028C)) { response = myELM327.findResponse();
Serial.print("Response: "); Serial.println(response);`

// Kürzen des Strings auf die letzten zwei Zeichen
String lastTwoChars = response.substring(response.length() - 2);

// Umwandlung von Hexadezimal in Dezimal
long decimalValue = strtol(lastTwoChars.c_str(), NULL, 16);

// Berechnung durchführen: (Wert - 16) / 2.24
float calculatedValue = (decimalValue - 16) / 2.24;

// Zeige die umgewandelten und berechneten Werte an
Serial.print("Hexadezimal: "); Serial.println(lastTwoChars);
Serial.print("Dezimal: "); Serial.println(decimalValue);
Serial.print("Berechneter Wert: "); Serial.println(calculatedValue);

// Ergebnis auf dem TFT-Display anzeigen
tft.setTextColor(TFT_WHITE); // Textfarbe setzen
tft.setTextSize(2); // Textgröße setzen
tft.setCursor(0, 32); // Cursor setzen
tft.drawString("Berechneter Wert: ", 60, 20, 4);
tft.print(calculatedValue); // Zeigt den berechneten Wert

} else if (myELM327.nb_rx_state != ELM_GETTING_MSG) { myELM327.printError(); } delay(1000);

}

I have this problem in my code. Is my code correct?

Output: PID: 652 Long query detected Query string: 22028C1 Clearing input serial buffer Sending the following command/query: 22028C1 ASSERT_WARN(1 8), in lc_task.c at line 1410ASSERT_WARN(1 8), in lc_task.c at line 1410ASSERT_WARN(1 8), in lc_task.c at line 1410ASSERT_WARN(1 8), in lc_task.c at line 1410ASSERT_WARN(1 8), in lc_task.c at line 1410ASSERT_WARN(1 8), in lc_task.c at line 1410ASSERT_WARN(1 8), in lc_task.c at line 1410ASSERT_WARN(1 8), in lc_task.c at line 1410ASSERT_WARN(1 8), in lc_task.c at line 1410ASSERT_WARN(1 8), in lc_task.c at line 1410ASSERT_WARN(1 8), in lc_task.c at line 1410ASSERT_WARN(1 8), in lc_task.c at line 1410Service: 34

jimwhitelaw commented 4 months ago

This issue has been seen before and in at least one case it was a faulty ESP32 device.

https://github.com/PowerBroker2/ELMduino/issues/43 https://github.com/espressif/arduino-esp32/issues/6193