mickeyl / LTSupportAutomotive

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

Bug in LTOBD2PID_DISTANCE_SINCE_DTC_CLEARED_31 #51

Closed pegan closed 3 months ago

pegan commented 3 months ago

The -(NSString*)formattedResponse method in @implementation LTOBD2PID_DISTANCE_SINCE_DTC_CLEARED_31 uses -(NSString*)formatSingleByteDoubleValueWithString:(NSString*)formatString offset:(double)offset factor:(double)factor

It should use instead: -(NSString*)formatTwoByteDoubleValueWithString:(NSString*)formatString offset:(double)offset factor:(double)factor with factor: 1

Source: https://en.wikipedia.org/wiki/OBD-II_PIDs The formula for Distance traveled since codes cleared: 256A + B

mickeyl commented 3 months ago

Indeed. Thanks @pegan.