Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in LTOBD2ProtocolISO15765_4 #48

Open
mlawlerau opened this issue May 24, 2023 · 1 comment
Open

Bug in LTOBD2ProtocolISO15765_4 #48

mlawlerau opened this issue May 24, 2023 · 1 comment

Comments

@mlawlerau
Copy link

mlawlerau commented May 24, 2023

I think there is a bug in LTOBD2ProtocolISO15765_4 where it incorrectly applies the "Clunky workaround for mode 06 behavior".

I noticed that my app was showing weird decoded values for LTOBD2PID_SHORT_TERM_FUEL_TRIM_1_06 vs LTOBD2PID_SHORT_TERM_FUEL_TRIM_2_08. PID

I noticed that pid 0x08 works fine, but pid 0x06 was sometimes giving strange results. 06 is the magic pid number to trigger the bug.

I tracked it down to the section where the protocol applies "clunky workaround". This causes it to (in some cases) decode incorrect values.

i.e. given a command: 0106, response: 7E80341067C -> that should be a single 0x7C response value which should be dec 124.

However, this workaround code, causes the library to apply the "decrementing the numberOfBytesInCommand" which engages the 'originalCommandCorrective' modifier, which causes it to return two numbers [ 06, 124 ] in the payload.

This means when you are expecting a single byte for this command and take the first byte in the payload, ala 'decodeSingleByteDoubleValueWithOffset' then you'll decode the 06 and get the wrong value.

The workaround seems to be reading the sid and pid incorrectly. In response '7E80341067C' it thinks the sid=6 and the pid =7c, but actually the sid is 01 and the pid is 06. Perhaps there are too many +1's being applied to the headerLength in this function.

@mlawlerau
Copy link
Author

Are we ok just to comment this bit of code out if we are not using Mode 06?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant