This CLSID describes the adjustment to the fuel delivery calibration.
Fuel trim
Read, shareable or exclusive
Type: | VT_I4 (signed fixed point) |
Low: | –100.0 |
High: | 99.2 |
Type: | VT_UI4 (unsigned long) |
Low-order word: | VIOFUELTRIM_SHORTTERM = 0, VIOFUELTRIM_LONGTERM = 1 |
High-order word: | Cylinder bank number (range 0-n). |
Type: | VT_I2 (signed fixed point) |
Measurement: | VIOMEASUREMENT_PERCENTAGE |
Units: | VIOUNITS_PERCENT |
Long term fuel trim is an adjustment made due to long term changes in engine function. Short term fuel trim is based on instantaneous input from the engine — for example, from the oxygen sensors. The fuel trim is returned as a percentage increase or decrease from the maximum value of fuel being delivered from the nominal rate.
API device objects expect the following data types and sizes when sending data to and from the mini-drivers:
Type: | DWORD * |
Size: | 4 bytes |
Low-order word: | One of the VIOFUELTRIM_* values |
High-order word | Cylinder bank number |
Type: | ULONG * |
Size: | 4 bytes |
Description: | Percentage of fuel flow adjustment in 0.01% increments |
HRESULT hr;
VIODEVICEMETRICS dmFuelTrim;
IVIO_Device *pFuelTrim;
VARIANT vDeviceData;
float fFuelTrimPct;
//Create an instance of the fuel trim device and get its
//IVIO_Device interface.
hr = CoCreateInstance(CLSID_VIO_FUEL_TRIM, NULL,
CLSCTX_INPROC_SERVER, IID_VIODEVICE,
&pFuelTrim);
//Get the metrics for the fixed-point precision value.
pFuelTrim->get_Metrics(&dmFuelTrim);
//Initialize the VARIANT for the input data.
VariantInit(&vDeviceData);
vDeviceData.vt = VT_UI4;
//For bank 0, set the input data for long term fuel trim.
vDeviceData.ulVal = MAKELONG((WORD) VIOFUELTRIM_LONGTERM, 0);
//Ask the device for the long term fuel trim for bank 0.
pFuelTrim->GetData(&vDeviceData, 3000);
//Convert the fixed-point percentage to a floating point value.
fFuelTrimPct = ((float) vDeviceData.lVal) * (10.0 ^ dmFuelTrim.lExponent);
//Release the reference to the interface.
pFuelTrim->Release();