mickeyl / LTSupportAutomotive

An iOS / watchOS / macOS support library for OBD2, VIN-Decoding, and more.
MIT License
212 stars 59 forks source link

Fix #6: Wrong conversion of DTC codes to ASCII #7

Closed thdankert closed 6 years ago

thdankert commented 6 years ago

Correctly handle hex chars (A-F) in DTC response from adapter. When converting characters other than 0-9, we need to add 0x37 to receive the same ASCII character as the hex char.

Added code to check this in -dtcCodeForA:B:

thdankert commented 6 years ago

To debug this issue, I used your "OBD II Expert" app in simulator mode and used the vehicle "Mercedes-Benz GL-Class...", which has some stored DTCs with hex chars.

This is only a workaround for the wrong conversion - one could also rewrite the whole method (and it's caller) to not work with ascii values, but passthrough the received DTC as-is (after converting the first character).

mickeyl commented 6 years ago

Thanks for your contribution!