Closed thdankert closed 6 years ago
Thanks for reporting this issue! Would it be possible to add a log from a car that returns such a DTC?
Hi mickeyl,
I don't have the log available (it's from a yet unreleased car), but when debugging this issue, I used your "OBD II Expert" app in simulator mode and used the vehicle "Mercedes-Benz GL-Class...". This also produced DTCs with hex codes in them.
Please see the corresponding pull request for more details.
@JRJian You're commenting on a closed issue - is your code snippet related to this (my) fix, or is this something else? (If so, please create a separate issue, and attach sample responses to verify the described behaviour)
When DTCs are received (eg. as a result of a mode 03 request), they are converted from the native ELM327 format to SAE format, as defined in the ELM data sheet.
However, this conversion does not correctly convert received DTCs with hex characters. The error lies in function
-(NSString*)dtcCodeForA:(uint)A B:(uint)B
, which tries to convert all received values back to ASCII numbers.Example: DTC =
P2B4A
is received via ELM327 as2B4A
, but the function returns the following:;
and:
areA
andB
(ASCII hex lower nibble), respectively.I'll provide a push request shortly - the received characters should be passed through as-is.