-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
How to read the dtc codes #10
Comments
Hello, |
hi, |
Hi, |
Hi, Thanks ! |
That function is incomplete to read DTCs you have to do more work than what is done there |
Thank you for the reply! Yes this is what I suspected, sadly I don't have the skill to complete the function, I tried but I'm too far off :) Too bad Sandeep's great library doesn't provide this feature though. Cheers! |
Can someone look into implementing reading DTCs? |
@BenjaminMuslic it's way complicated that it seems and more so custom to each vehicle make, apart from OBD2 emmission related DTCs |
Hello,
How to read the dtc codes?
int OBD2Class::ReadDtcs(uint8_t mode, void* data, int length)
{
// make sure at least 60 ms have passed since the last response
unsigned long lastResponseDelta = millis() - _lastPidResponseMillis;
if (lastResponseDelta < 60) {
delay(60 - lastResponseDelta);
}
for (int retries = 10; retries > 0; retries--) {
if (_useExtendedAddressing) {
CAN.beginExtendedPacket(0x18db33f1, 8);
} else {
CAN.beginPacket(0x7df, 8);
}
CAN.write(0x02); // number of additional bytes
CAN.write(mode);
//CAN.write(pid);
if (CAN.endPacket()) {
// send success
break;
} else if (retries <= 1) {
return 0;
}
}
bool splitResponse = (length > 5);
for (unsigned long start = millis(); (millis() - start) < _responseTimeout;) {
if (CAN.parsePacket() != 0 &&
(splitResponse ? (CAN.read() == 0x10 && CAN.read()) : CAN.read()) &&
(CAN.read() == (mode | 0x40))) {
}
return 0;
}
I have added a function like this. While running this function, there is no output. could you please suggest any changes.
Thanks
The text was updated successfully, but these errors were encountered: