lemberg / obd2-swift-lib

car onboard diagnostic swift library
MIT License
144 stars 39 forks source link

Case "1D Oxygen sensors present" in Descriptor01 (calculateStringForData()) #2

Open hellensoloviy opened 7 years ago

hellensoloviy commented 7 years ago

Method calculateStringForData(data:) in Descriptor01 class have some problems. Case 1D is returning an empty string.

    func calculateStringForData(data : Data) -> String? {
        switch pid {
        case 0x03:
            return calculateFuelSystemStatus(data)
        case 0x12:
            return calculateSecondaryAirStatus(data)
        case 0x13:
            return calculateOxygenSensorsPresent(data)
        case 0x1C:
            return calculateDesignRequirements(data)
        case 0x1D:
            return "" 
        case 0x1E:
            return calculateAuxiliaryInputStatus(data)
        default:
            return nil
        }
    }

As this article says

1D Oxygen sensors present (in 4 banks)

And it is almost like case 0x13, but there 4 banks instead of 2. And I can see a not used method calculateOxygenSensorsPresentB() in Descriptor01. This method is very similar to calculateOxygenSensorsPresent() which used for case 0x13.

I recommend to use of to delete calculateOxygenSensorsPresentB() method, and fix case 0x1D.

mustundag commented 7 years ago

Hi, I am new to this library and I want to get exhoust emission DTC data from OBD2. Which code could I use to get emission data? Thanks.