preparation for #961

more unified access to pre-calculated value
This commit is contained in:
rusefi 2019-10-13 09:59:06 -04:00
parent 62577c47da
commit 5cb90d0e1b
5 changed files with 8 additions and 10 deletions

View File

@ -223,9 +223,7 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
void EngineState::updateTChargeK(int rpm, float tps DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if EFI_ENGINE_CONTROL
float coolantC = ENGINE(sensors.clt);
float intakeC = ENGINE(sensors.iat);
float newTCharge = getTCharge(rpm, tps, coolantC, intakeC PASS_ENGINE_PARAMETER_SUFFIX);
float newTCharge = getTCharge(rpm, tps, getCoolantTemperature(), getIntakeAirTemperature() PASS_ENGINE_PARAMETER_SUFFIX);
// convert to microsecs and then to seconds
efitick_t curTime = getTimeNowNt();
float secsPassed = (float)NT2US(curTime - timeSinceLastTChargeK) / 1000000.0f;

View File

@ -37,7 +37,7 @@
#include "tps.h"
#include "engine_math.h"
#include "fuel_math.h"
#include "allsensors.h"
#include "thermistors.h"
extern CANTxFrame txmsg;

View File

@ -337,7 +337,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE
static void fuelClosedLoopCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#if ! EFI_UNIT_TEST
if (GET_RPM_VALUE < CONFIG(fuelClosedLoopRpmThreshold) ||
ENGINE(sensors.clt) < CONFIG(fuelClosedLoopCltThreshold) ||
getCoolantTemperature() < CONFIG(fuelClosedLoopCltThreshold) ||
getTPS(PASS_ENGINE_PARAMETER_SIGNATURE) > CONFIG(fuelClosedLoopTpsThreshold) ||
ENGINE(sensors.currentAfr) < CONFIGB(fuelClosedLoopAfrLowThreshold) ||
ENGINE(sensors.currentAfr) > engineConfiguration->fuelClosedLoopAfrHighThreshold) {
@ -578,7 +578,7 @@ void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// If 'primeInjFalloffTemperature' is not specified (by default), we have a prime pulse deactivation at zero celsius degrees, which is okay.
const float maxPrimeInjAtTemperature = -40.0f; // at this temperature the pulse is maximal.
floatms_t pulseLength = interpolateClamped(maxPrimeInjAtTemperature, CONFIG(startOfCrankingPrimingPulse),
CONFIG(primeInjFalloffTemperature), 0.0f, ENGINE(sensors.clt));
CONFIG(primeInjFalloffTemperature), 0.0f, getCoolantTemperature());
if (pulseLength > 0) {
startSimultaniousInjection(engine);
efitimeus_t turnOffDelayUs = (efitimeus_t)efiRound(MS2US(pulseLength), 1.0f);

View File

@ -85,11 +85,10 @@ TEST(misc, testFuelMap) {
setFlatInjectorLag(0 PASS_CONFIG_PARAMETER_SUFFIX);
float iat = getIntakeAirTemperature();
ASSERT_FALSE(cisnan(iat));
ASSERT_FALSE(cisnan(getIntakeAirTemperature()));
float iatCorrection = getIatFuelCorrection(-KELV PASS_ENGINE_PARAMETER_SUFFIX);
ASSERT_EQ( 2, iatCorrection) << "IAT";
engine->sensors.clt = getCoolantTemperature();
ASSERT_FALSE(cisnan(getCoolantTemperature()));
float cltCorrection = getCltFuelCorrection(PASS_ENGINE_PARAMETER_SIGNATURE);
ASSERT_EQ( 1, cltCorrection) << "CLT";
float injectorLag = getInjectorLag(getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX);

View File

@ -11,6 +11,7 @@
#include "fsio_impl.h"
#include "cli_registry.h"
#include "engine_test_helper.h"
#include "thermistors.h"
#define TEST_POOL_SIZE 256
@ -19,7 +20,7 @@ float getEngineValue(le_action_e action DECLARE_ENGINE_PARAMETER_SUFFIX) {
case LE_METHOD_FAN:
return engine->fsioState.mockFan;
case LE_METHOD_COOLANT:
return engine->sensors.clt;
return getCoolantTemperature();
case LE_METHOD_RPM:
return engine->fsioState.mockRpm;
case LE_METHOD_CRANKING_RPM: