Best way to use checkErrorMessage
Posted: Tue Dec 19, 2023 3:06 am
Good morning,
I am rather novice at C++, but purchased the UART adaptor and have it working very well on my vehicle. While testing, I noted that some PID requests were incrementing the obd.errors variable (which is totally fine). I wanted to determine what the error was so that I could programmatically skip over those PID(s) in the future. Looking in the library, I see the function "checkErrorMessage", but I'm not clear how to utilize it. Below is some example code where I am checking the PID_INTAKE_MAP value. My particular vehicle uses MAF and not MAP, so I know I am getting an error on this request. Obviously I can simply remove it, but if I hook the Freematics UART connector to another vehicle that uses MAP, i would like it to function. All that said, how can I get the error code from my vehicle when requesting PID_INTAKE_MAP?
I'd basically update the loop() function and from a logic perspective say "Update boost data. If you get an error, check what that error is. If the error is not "TIMEOUT", then skip this function in the future."
Thanks for any guidance you can provide!
I am rather novice at C++, but purchased the UART adaptor and have it working very well on my vehicle. While testing, I noted that some PID requests were incrementing the obd.errors variable (which is totally fine). I wanted to determine what the error was so that I could programmatically skip over those PID(s) in the future. Looking in the library, I see the function "checkErrorMessage", but I'm not clear how to utilize it. Below is some example code where I am checking the PID_INTAKE_MAP value. My particular vehicle uses MAF and not MAP, so I know I am getting an error on this request. Obviously I can simply remove it, but if I hook the Freematics UART connector to another vehicle that uses MAP, i would like it to function. All that said, how can I get the error code from my vehicle when requesting PID_INTAKE_MAP?
Code: Select all
void updateBoostData() {
int value;
obd.readPID(PID_INTAKE_MAP, value); // getting an error here, but unclear what that error is
gaugeData.bv = value;
}
Thanks for any guidance you can provide!