Fixed missing temp offset on the comms signal
This commit is contained in:
parent
67a1c1399d
commit
45e4cb6466
|
@ -117,8 +117,8 @@ void sendValues(int length)
|
|||
response[2] = currentStatus.engine; //Engine Status Bitfield
|
||||
response[3] = 0x00; //baro
|
||||
response[4] = currentStatus.MAP; //map
|
||||
response[5] = currentStatus.IAT; //mat
|
||||
response[6] = currentStatus.coolant; //Coolant ADC
|
||||
response[5] = (byte)(currentStatus.IAT + CALIBRATION_TEMPERATURE_OFFSET); //mat
|
||||
response[6] = (byte)(currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET); //Coolant ADC
|
||||
response[7] = currentStatus.tpsADC; //TPS (Raw 0-255)
|
||||
response[8] = currentStatus.battery10; //battery voltage
|
||||
response[9] = currentStatus.O2; //O2
|
||||
|
|
|
@ -53,6 +53,7 @@ struct statuses {
|
|||
int IAT;
|
||||
int iatADC;
|
||||
int batADC;
|
||||
int O2ADC;
|
||||
byte battery10; //The current BRV in volts (multiplied by 10. Eg 12.5V = 125)
|
||||
byte advance;
|
||||
byte corrections;
|
||||
|
|
|
@ -259,18 +259,19 @@ void loop()
|
|||
currentStatus.MAP = map(analogRead(pinMAP), 0, 1023, 10, 255); //Get the current MAP value
|
||||
currentStatus.tpsADC = map(analogRead(pinTPS), 0, 1023, 0, 255); //Get the current raw TPS ADC value and map it into a byte
|
||||
currentStatus.TPS = map(currentStatus.tpsADC, configPage1.tpsMin, configPage1.tpsMax, 0, 100); //Take the raw TPS ADC value and convert it into a TPS% based on the calibrated values
|
||||
//currentStatus.TPS = 70;
|
||||
currentStatus.O2 = map(analogRead(pinO2), 0, 1023, 74, 224); //Get the current O2 value. Calibration is from AFR values 7.35 to 22.4. This is the correct calibration for an Innovate Wideband 0v - 5V unit. Proper calibration is still a WIP
|
||||
|
||||
//The IAT and CLT readings can be done less frequently. This still runs about 10 times per second
|
||||
if ((mainLoopCount & 127) == 1)
|
||||
{
|
||||
currentStatus.cltADC = map(analogRead(pinCLT), 0, 1023, 0, 512); //Get the current raw CLT value
|
||||
currentStatus.iatADC = map(analogRead(pinIAT), 0, 1023, 0, 512); //Get the current raw IAT value
|
||||
currentStatus.O2ADC = map(analogRead(pinO2), 0, 1023, 0, 512); //Get the current O2 value. Calibration is from AFR values 7.35 to 22.4. This is the correct calibration for an Innovate Wideband 0v - 5V unit. Proper calibration is still a WIP
|
||||
currentStatus.battery10 = map(analogRead(pinBat), 0, 1023, 0, 245); //Get the current raw Battery value. Permissible values are from 0v to 24.5v (245)
|
||||
//currentStatus.batADC = map(analogRead(pinBat), 0, 1023, 0, 255); //Get the current raw Battery value
|
||||
|
||||
currentStatus.coolant = cltCalibrationTable[currentStatus.cltADC] - CALIBRATION_TEMPERATURE_OFFSET; //Temperature calibration values are stored as positive bytes. We subtract 40 from them to allow for negative temperatures
|
||||
currentStatus.IAT = iatCalibrationTable[currentStatus.iatADC] - CALIBRATION_TEMPERATURE_OFFSET;
|
||||
currentStatus.O2 = o2CalibrationTable[currentStatus.O2ADC];
|
||||
}
|
||||
|
||||
//Always check for sync
|
||||
|
|
Loading…
Reference in New Issue