Best way to use checkErrorMessage

Discussion about software developed by Freematics, including Freematics Builder and Freematics Emulator GUI
Post Reply
extremerotary
Posts: 3
Joined: Tue Dec 19, 2023 2:55 am

Best way to use checkErrorMessage

Post by extremerotary »

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?

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;
}
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!
Post Reply