Closed JRJian closed 3 years ago
Let me show you an example, here's communication over protocol 7:
I ask for 03
and get the following rawResponse
:
(lldb) po self.rawResponse
<__NSArrayM 0x28150cbd0>(
18DAF110100A430401100148,
18DAF1102101700210000000
)
Stripping the ECU IDs and reassembling the fragments gives me the following cookedResponse
:
(lldb) po self.cookedResponse
{
10 = (
4,
1,
16,
1,
72,
1,
112,
2,
16,
0,
0,
0
);
}
We are seeing ECU #10 responding with 12 bytes. To my knowledge, every DTC is encoded as 2 bytes and the first byte of the whole response to 03
and 07
is the actual number of encountered DTCs, i.e. in this example we are seeing 4 DTCs where as the actual values are P0110, P0148, P0170, and P0210.
If you think this is wrong, could you show me example data from your car?
Hello @mickeyl , I am getting "P2800" from this Library, but other apps or wired scanner reads "P1628". Please suggest or If I'll change the index to 0 will fix it as above mentioned by @JRJian In NSRange codeRange = NSMakeRange(1, bytes.count-1); NSArray<NSNumber> codeBytes = [bytes subarrayWithRange:codeRange]; screen shot of wired scanner.( what is mod $12 i don't familiar with)
NSRange codeRange = NSMakeRange(1, bytes.count-1); NSArray<NSNumber> codeBytes = [bytes subarrayWithRange:codeRange];
@JRJian @thdankert @mickeyl , is this code correct or have to change the RangeIndex to 0? Please Help. (Not getting ABS fault codes specifically "U0102" )
Thanks for opening this issue, I think you are up to something. My implementation of the DTC parsing code is based on SAE J1979_201408, which is the reference, but I may have mixed up some of the tables depicted in there (granted, it's quite a confusing spec in some places). I have developed the DTC-implementation against an OBD2 Simulator (since I do not possess so many cars with actual failures), it might be possible that this Simulator has a broken implementation of the DTC answer. I will double check with the spec later this week and report ASAP.
I may have spoken too soon. Upon my inquiry, the simulator developer just got back to me and claims that for all CAN-protocols, the answer to 03
has to report the number of DTCs before the actual codes. For all other protocols, this number will be omitted.
Can anyone confirm or deny that?
See also the accepted answer to https://mechanics.stackexchange.com/questions/51226/obd2-mode-3-wrong-response – I trust these folks, as they have a lot of experience in seeing "real world" values.
NSRange codeRange = NSMakeRange(1, bytes.count-1);
NSArray<NSNumber*>* codeBytes = [bytes subarrayWithRange:codeRange];
The returned result is different from other OBD apps.(Such as Auto Doctor、ELM327...)
If I change the index to 0,the result will be consistent.