python-OBD icon indicating copy to clipboard operation
python-OBD copied to clipboard

Trouble code reading

Open Rockybilly opened this issue 9 years ago • 5 comments

Currently testing with obdsim, it appears the dtc decoder does not parse the code correctly. obdsim sends P0103 by default as you may have looked. The code obtains this as P0300. I took a look at the code. in decoders.py changing line 392 from this,

d += message.data[2:]

to this

d += message.data[1:3]

currently appears to solve the problem for the first trouble code. The fact that GET_DTC returns a list, means that it supports multiple trouble codes, but now the program returns a single one, even with multiple dtc's recieved. The change I made above may cripple the structure of the code for multiple dtc's because I did not make a detailed reading, so I add this as an issue here if it helps a solution be created.

Rockybilly avatar Nov 06 '16 04:11 Rockybilly

Found out that this is caused by obdsim which does not provide DTC_Count, not even 00 in it's place. Is this behavior consistent among other vehicles ? If so, this may need to be reimplemented. checking the number of total bytes read, may solve the problem of detecting if the device provides dtc count.

Rockybilly avatar Nov 10 '16 15:11 Rockybilly

After 3 trouble codes, another frame is added to the response. These frames are not parsed within the program. So none of the trouble code gets to be shown. This is caused by "Dropping frame in multi-frame response not marked as FF or CF". This behavior is observed using obdsim.

Rockybilly avatar Nov 11 '16 00:11 Rockybilly

Sorry, my patch does not fix this issue.

ffries avatar Jun 27 '17 11:06 ffries

I'm a developer that made the pyobd remake, using python-obd library. Just recently we noticed that DTC is showing wrong. This is an important one for the library and my program to be of any use. Can we fix it somehow? I don't know right now how to do it, so all the help is appreciated.

I made

+= message.data[2:]

to this

d += message.data[1:3]

As previously stated now it shows the DTC correctly, but only one. Can we fix this? Thanks to every contributor.

barracuda-fsh avatar May 28 '24 12:05 barracuda-fsh

I fixed it under pyobd. See my code to fix this python-obd library. I can't do a pull request.

barracuda-fsh avatar May 30 '24 18:05 barracuda-fsh