I'll try this out later. Can you explain the A-40 equation? I don't understand that one. Are the raw thermal sensors returning C or F? Based on that equation, it looks like they return F + 40° but that doesn't make sense??
Most all automotive sensors natively return values in SI units or SI derived units. So temperatures are natively degrees celsius.
Many Apps have a setting that will do the conversions for you before displaying the values on a gauge in a dashboard.
For example I beleive Torque Pro has such a setting and then PIDs whose definition states the value is in °C will be converted to °F by Torque Pro for display if the user has made such a selection in settings.
Sometimes you will see the conversion done in the equation. In this case the PID definition should state the units are in °F so Torque Pro won't apply the conversion a second time rendering an incorrect value for display.
All the sensor data and indeed most all the serial data is in hexadecimal. In basic hexadecimal there are no negative values. No fractional values either. One bit, two bits, three bits, but no half bits and no negative bits.
So how do you transmit in hexadecimal a temperature value in the negatives? You add an offset value to it that you can then subtract later after the conversion from hexadecimal to decimal.
I cannot claim to know why they chose 40 as the offset for temperature values. Might have something to do with the fact that -40°C is equal to -40°F??
The letter "A" is called a 'token' that Torque assigns to the first data byte in a message. The second data byte is "B" and so on.
So "A" in a Torque Pro equation the is the decimal equivalent to the first hexadecimal data byte in a PID response message.
Lets say your transmission fluid temp is -10°C.
The PCM will add 40 decimal to this making it 30°C so there is no negative value.
30 decimal is 1E hexadecimal. The PCM sends this 1E back in response the the PID query.
Torque Pro or OBDFusion will convert this hexadecimal 1E to decimal 30 and assign the token "A" to this value.
The equation or formula for the PID will subtract the 40 offset from "A" (which is 30) to arrive back at the -10°C we began with.
If the user has selected to have Torque Pro or OBDFusion to display temperatures in °F instead of ° C and the PID is defined as °C, then the app will do the conversion for them when the value is displayed in a dial or gauge on a dashboard.
Clear as mud right??