-
-
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
Added function to clear diagnostic trouble codes (DTC) #7
Conversation
…04 functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tonkaman awesome work! Thanks for opening this pull request!
I've left a few minor comments, please let me know what you think!
src/OBD2.cpp
Outdated
@@ -695,6 +695,36 @@ int OBD2Class::supportedPidsRead() | |||
return 1; | |||
} | |||
|
|||
int OBD2Class::clearAllStoredDTC() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add an entry for clearAllStoredDTC
in both keywords.txt
and API.md
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I'll add the function to the keywords.txt file. How do you feel about this for the API.md?
Clear Stored Diagnostic Trouble Codes (DTC)
Clears any stored DTCs in the vehicle ECU, and turns off Malfunction Indicator Light (MIL, more commonly known as the Check Engine light).
int success = OBD2.clearAllStoredDTC();
Returns 1 if successful, or 0 on failure
…04 functionality. Added clearAllStoredDTC function to keywords.txt file Corrected return value of clearAllStoredDTC function to return 1 upon success
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tonkaman updates look good!
I'm just going to make some minor style changes before merging.
@tonkaman awesome work! |
@sandeepmistry No problem. Eventually when I have time I want to tackle trying to read the DTC codes from a vehicle as well. That's not quite as simple as clearing them. Apologies for the messiness of my commits. This was my first time using Git, and I'm still learning the proper workflow. |
@tonkaman I was writing a reply on my issue on your repo, but you made it private so I could not do it. All I was going to say is I found that repo because of your PR here. I am going to test what I mentioned in your issue with am obd2 scanner and clear the codes and sniff the bus to see what command actually gets sent. I can then update you with what the command is from here if it differs |
Yes. I made it private because I realized it was unintentionally public. You were commenting on the wrong repo for that function. The repo you were commenting on was one I was still working on for converting OBDII diagnostic codes to text that describes what the code means. I’m a mechanical engineer by trade, so I’m still learning how GitHub works.
Please update me with the results, and I’m glad to hear this is a useful idea.
|
Hmm, this is really strange. I wasn't able to see the clear fault codes command when I executed it with my obd2 adapter |
I figured out how to purposely trigger a fault code on my 2011 Chevy Cruze by unplugging the O2 sensor. You are correct the function as written does not work. I'm stumped at the moment because I seem to get the response that it worked (returns 1), but the light doesn't go out on the dash. My guess is the message format is incorrect, but I can't find any documentation that's not behind an SAE or ISO paywall. `
} |
Ok well at least I am not going crazy. I am really interested in trying to get this working. I wonder if there is another way to sniff the bus to get this info? |
Just an idea. Does it need to do some sort of search/request for error codes before it can clear them? I am doubtful as it doesn't pass and specific data when it clears. but its just an idea |
I'm in the same boat. At least my Cruze is somewhat modern. My other vehicle is a 1997 pickup that predates CAN. My fiance also has a Cruze, so effectively we're limited to a single vehicle to test with at my house. I'm going to keep trying things, but I think I might need to pony up the $85 for the 16 page SAE J2012_201612 document. |
Do you use Discord or something like that that we could collaborate a bit more together on @tonkaman ? |
Created function to clear DTC codes from vehicle ECU using Service 04 functionality, using format documented at:
https://en.wikipedia.org/wiki/OBD-II_PIDs#Service_04
https://en.wikipedia.org/wiki/OBD-II_PIDs#Query
ECU should return 0 data bytes. PID not required. This is part of Open Issue #5