preparation for #961

more unified access to pre-calculated value
This commit is contained in:
rusefi 2019-10-10 08:25:58 -04:00
parent 71e904e421
commit 62577c47da
8 changed files with 16 additions and 14 deletions

View File

@ -363,7 +363,7 @@ static percent_t automaticIdleController(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
finishIdleTestIfNeeded();
undoIdleBlipIfNeeded();
float clt = engine->sensors.clt;
float clt = getCoolantTemperature();
#if EFI_SHAFT_POSITION_INPUT
bool isRunning = engine->rpmCalculator.isRunning(PASS_ENGINE_PARAMETER_SIGNATURE);
#else

View File

@ -254,7 +254,7 @@ static void showLine(lcd_line_e line, int screenY) {
lcdPrintf("CLT corr %.2f", getCltFuelCorrection(PASS_ENGINE_PARAMETER_SIGNATURE));
return;
case LL_FUEL_IAT_CORRECTION:
lcdPrintf("IAT corr %.2f", getIatFuelCorrection(engine->sensors.iat PASS_ENGINE_PARAMETER_SIGNATURE));
lcdPrintf("IAT corr %.2f", getIatFuelCorrection(getIntakeAirTemperature() PASS_ENGINE_PARAMETER_SIGNATURE));
return;
case LL_FUEL_INJECTOR_LAG:
lcdPrintf("ING LAG %.2f", getInjectorLag(engine->sensors.vBatt PASS_ENGINE_PARAMETER_SIGNATURE));

View File

@ -26,6 +26,7 @@
#include "engine_math.h"
#include "tps.h"
#include "idle_thread.h"
#include "allsensors.h"
EXTERN_ENGINE
;
@ -115,7 +116,7 @@ angle_t getAdvanceCorrections(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (cisnan(engine->sensors.iat)) {
iatCorrection = 0;
} else {
iatCorrection = iatAdvanceCorrectionMap.getValue((float) rpm, engine->sensors.iat);
iatCorrection = iatAdvanceCorrectionMap.getValue((float) rpm, getIntakeAirTemperature());
}
// PID Ignition Advance angle correction
float pidTimingCorrection = 0.0f;

View File

@ -160,7 +160,7 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
// todo: move this into slow callback, no reason for IAT corr to be here
running.intakeTemperatureCoefficient = getIatFuelCorrection(engine->sensors.iat PASS_ENGINE_PARAMETER_SUFFIX);
running.intakeTemperatureCoefficient = getIatFuelCorrection(getIntakeAirTemperature() PASS_ENGINE_PARAMETER_SUFFIX);
// todo: move this into slow callback, no reason for CLT corr to be here
running.coolantTemperatureCoefficient = getCltFuelCorrection(PASS_ENGINE_PARAMETER_SIGNATURE);

View File

@ -544,7 +544,7 @@ void setTargetRpmCurve(int rpm DECLARE_CONFIG_PARAMETER_SUFFIX) {
}
int getTargetRpmForIdleCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
float clt = engine->sensors.clt;
float clt = getCoolantTemperature();
int targetRpm;
if (cisnan(clt)) {
// error is already reported, let's take first value from the table should be good enough error handing solution

View File

@ -37,6 +37,7 @@
#include "tps.h"
#include "engine_math.h"
#include "fuel_math.h"
#include "allsensors.h"
extern CANTxFrame txmsg;
@ -140,7 +141,7 @@ static void handleGetDataRequest(CANRxFrame *rx) {
break;
case PID_COOLANT_TEMP:
scheduleMsg(&logger, "Got CLT request");
obdSendValue(1, pid, 1, engine->sensors.clt + 40.0f);
obdSendValue(1, pid, 1, getCoolantTemperature() + 40.0f);
break;
case PID_INTAKE_MAP:
scheduleMsg(&logger, "Got MAP request");
@ -163,7 +164,7 @@ static void handleGetDataRequest(CANRxFrame *rx) {
}
case PID_INTAKE_TEMP:
scheduleMsg(&logger, "Got IAT request");
obdSendValue(1, pid, 1, engine->sensors.iat + 40.0f);
obdSendValue(1, pid, 1, getIntakeAirTemperature() + 40.0f);
break;
case PID_INTAKE_MAF:
scheduleMsg(&logger, "Got MAF request");

View File

@ -41,7 +41,7 @@ temperature_t getIntakeAirTemperatureM(DECLARE_ENGINE_PARAMETER_SIGNATURE);
* for actual slow calculation see 'getCoolantTemperatureM'
*/
#define getCoolantTemperature() engine->sensors.clt
#define getIntakeAirTemperature() getIntakeAirTemperatureM(PASS_ENGINE_PARAMETER_SIGNATURE)
#define getIntakeAirTemperature() engine->sensors.iat
bool isValidIntakeAirTemperature(temperature_t temperature);
bool hasIatSensorM(DECLARE_ENGINE_PARAMETER_SIGNATURE);

View File

@ -146,7 +146,7 @@ static void canDashboardBMW(void) {
sendCanMessage();
commonTxInit(CAN_BMW_E46_DME2);
setShortValue(&txmsg, (int) ((engine->sensors.clt + 48.373) / 0.75), 1);
setShortValue(&txmsg, (int) ((getCoolantTemperature() + 48.373) / 0.75), 1);
sendCanMessage();
}
@ -177,7 +177,7 @@ static void canMazdaRX8(void) {
sendCanMessage();
commonTxInit(CAN_MAZDA_RX_STATUS_2);
txmsg.data8[0] = (uint8_t)(engine->sensors.clt + 69); //temp gauge //~170 is red, ~165 last bar, 152 centre, 90 first bar, 92 second bar
txmsg.data8[0] = (uint8_t)(getCoolantTemperature() + 69); //temp gauge //~170 is red, ~165 last bar, 152 centre, 90 first bar, 92 second bar
txmsg.data8[1] = ((int16_t)(engine->engineState.vssEventCounter*(engineConfiguration->vehicleSpeedCoef*0.277*2.58))) & 0xff;
txmsg.data8[2] = 0x00; // unknown
txmsg.data8[3] = 0x00; //unknown
@ -187,7 +187,7 @@ static void canMazdaRX8(void) {
if ((GET_RPM()>0) && (engine->sensors.vBatt<13)) {
setTxBit(6, 6); // battery light
}
if (engine->sensors.clt > 105) {
if (getCoolantTemperature() > 105) {
setTxBit(6, 1); // coolant light, 101 - red zone, light means its get too hot
}
//oil pressure warning lamp bit is 7
@ -198,7 +198,7 @@ static void canMazdaRX8(void) {
static void canDashboardFiat(void) {
//Fiat Dashboard
commonTxInit(CAN_FIAT_MOTOR_INFO);
setShortValue(&txmsg, (int) (engine->sensors.clt - 40), 3); //Coolant Temp
setShortValue(&txmsg, (int) (getCoolantTemperature() - 40), 3); //Coolant Temp
setShortValue(&txmsg, GET_RPM() / 32, 6); //RPM
sendCanMessage();
}
@ -210,11 +210,11 @@ static void canDashboardVAG(void) {
sendCanMessage();
commonTxInit(CAN_VAG_CLT);
setShortValue(&txmsg, (int) ((engine->sensors.clt + 48.373) / 0.75), 1); //Coolant Temp
setShortValue(&txmsg, (int) ((getCoolantTemperature() + 48.373) / 0.75), 1); //Coolant Temp
sendCanMessage();
commonTxInit(CAN_VAG_CLT_V2);
setShortValue(&txmsg, (int) ((engine->sensors.clt + 48.373) / 0.75), 4); //Coolant Temp
setShortValue(&txmsg, (int) ((getCoolantTemperature() + 48.373) / 0.75), 4); //Coolant Temp
sendCanMessage();
commonTxInit(CAN_VAG_IMMO);