By r0tor
#5527
I've been successful in adding generic Mode 1 (labeled Mode 0 in the library?) PIDs to the library for various things supported by my Mazda.

I am now trying to figure out a way to query the CAN for Mode 22 vehicle specific PIDs.  I've done some research and have found the Tx/Rx CAN commands needed to do this - however I am not sure how to define these in the library.  Generically the first 4 characters are for the CAN protocol, followed by the 22 for the CAN mode, followed by a 4 digit PID number

Specifically I'm trying to add the following:

Knock Retard (KR) (in degrees)
TXD: 07E0221746
RXF: 046285170646
RXD: 3008

Wheel Pressure showing tenths place

Wheel 1 Pressure:
TXD: 075122C901
RXF: 046285C90601
RXD: 3008

Wheel 2 Pressure:
TXD: 075122C901
RXF: 046285C90601
RXD: 3808

Wheel 3 Pressure:
TXD: 075122C901
RXF: 046285C90601
RXD: 4008

Wheel 4 Pressure:
TXD: 075122C901
RXF: 046285C90601
RXD: 4808

(Sorry, I'm a mechanical engineer and not a programmer  ;) )
By r0tor
#5528
BUMP

If its not possible to easily add these to the library - could I get a brief example of how to directly query the CAN system with the PID codes and retrieve the data  from my project?
By r0tor
#5530
Any example of how to deal with a PID that contains 2 or 4 data bytes?  Like a wideband O2 (PID 24) has 4 bytes - first 2 are used to calculate the lambda value and the other 2 calculate the voltage value.

It looks like you have the OBD mode hard coded as a "1" in the library.  I changed it to a "22" for my mode 22 PID and seemed to get a response that made sense.  However, I think there are 4 bytes for this PID and I'm not sure how to get bytes 2-4.


BTW - I found an error with your PID for coolant temp in the library... needs to use getTemperatureValue(data) instead of getSmallValue(data)