parent
11074f389e
commit
318aa6d8c9
|
@ -52,6 +52,18 @@ static angle_t getRunningAdvance(int rpm, float engineLoad) {
|
||||||
config->ignitionRpmBins, rpm
|
config->ignitionRpmBins, rpm
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#if EFI_ANTILAG_SYSTEM
|
||||||
|
if (engine->antilagController.isAntilagCondition) {
|
||||||
|
auto tps = Sensor::get(SensorType::Tps1);
|
||||||
|
engine->antilagController.timingALSCorrection = interpolate3d(
|
||||||
|
config->ALSTimingRetardTable,
|
||||||
|
config->alsIgnRetardLoadBins, tps.Value,
|
||||||
|
config->alsIgnRetardrpmBins, rpm
|
||||||
|
);
|
||||||
|
advanceAngle += engine->antilagController.timingALSCorrection;
|
||||||
|
}
|
||||||
|
#endif /* EFI_ANTILAG_SYSTEM */
|
||||||
|
|
||||||
// Add any adjustments if configured
|
// Add any adjustments if configured
|
||||||
for (size_t i = 0; i < efi::size(config->ignBlends); i++) {
|
for (size_t i = 0; i < efi::size(config->ignBlends); i++) {
|
||||||
auto result = calculateBlend(config->ignBlends[i], rpm, engineLoad);
|
auto result = calculateBlend(config->ignBlends[i], rpm, engineLoad);
|
||||||
|
|
|
@ -14,7 +14,68 @@
|
||||||
#include "engine_state.h"
|
#include "engine_state.h"
|
||||||
#include "advance_map.h"
|
#include "advance_map.h"
|
||||||
|
|
||||||
AntilagSystemBase::AntilagSystemBase() {
|
bool AntilagSystemBase::isInsideALSSwitchCondition() {
|
||||||
|
isALSSwitchActivated = engineConfiguration->antiLagActivationMode != SWITCH_INPUT_ANTILAG;
|
||||||
|
|
||||||
|
if (isALSSwitchActivated) {
|
||||||
|
if (isBrainPinValid(engineConfiguration->ALSActivatePin)) {
|
||||||
|
ALSActivatePinState = engineConfiguration->ALSActivateInverted ^ efiReadPin(engineConfiguration->ALSActivatePin);
|
||||||
|
}
|
||||||
|
return ALSActivatePinState;
|
||||||
|
} else {
|
||||||
|
// ALWAYS_ACTIVE_ANTILAG
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AntilagSystemBase::isALSMinRPMCondition() const {
|
||||||
|
int rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||||
|
|
||||||
|
return engineConfiguration->ALSMinRPM < rpm;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AntilagSystemBase::isALSMaxRPMCondition() const {
|
||||||
|
int rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||||
|
|
||||||
|
return engineConfiguration->ALSMaxRPM > rpm;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AntilagSystemBase::isALSMinCLTCondition() const {
|
||||||
|
int clt = Sensor::getOrZero(SensorType::Clt);
|
||||||
|
|
||||||
|
return engineConfiguration->ALSMinCLT < clt;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AntilagSystemBase::isALSMaxCLTCondition() const {
|
||||||
|
int clt = Sensor::getOrZero(SensorType::Clt);
|
||||||
|
|
||||||
|
return engineConfiguration->ALSMaxCLT > clt;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AntilagSystemBase::isALSMaxTPSCondition() const {
|
||||||
|
int tps = Sensor::getOrZero(SensorType::Tps1);
|
||||||
|
|
||||||
|
return engineConfiguration->ALSMaxTPS > tps;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AntilagSystemBase::isAntilagConditionMet() {
|
||||||
|
|
||||||
|
ALSMinRPMCondition = isALSMinRPMCondition();
|
||||||
|
ALSMaxRPMCondition = isALSMaxRPMCondition();
|
||||||
|
ALSMinCLTCondition = isALSMinCLTCondition();
|
||||||
|
ALSMaxCLTCondition = isALSMaxCLTCondition();
|
||||||
|
ALSMaxTPSCondition = isALSMaxTPSCondition();
|
||||||
|
ALSSwitchCondition = isInsideALSSwitchCondition();
|
||||||
|
|
||||||
|
return ALSMinRPMCondition && ALSMaxRPMCondition && ALSMinCLTCondition && ALSMaxCLTCondition && ALSMaxTPSCondition && ALSSwitchCondition;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AntilagSystemBase::update() {
|
||||||
|
if (!engineConfiguration->antiLagEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isAntilagCondition = isAntilagConditionMet();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* EFI_ANTILAG_SYSTEM */
|
#endif /* EFI_ANTILAG_SYSTEM */
|
||||||
|
|
|
@ -14,8 +14,6 @@ void initAntilagSystem();
|
||||||
|
|
||||||
class AntilagSystemBase : public antilag_system_state_s {
|
class AntilagSystemBase : public antilag_system_state_s {
|
||||||
public:
|
public:
|
||||||
AntilagSystemBase();
|
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
bool isALSMinRPMCondition() const;
|
bool isALSMinRPMCondition() const;
|
||||||
|
@ -23,7 +21,7 @@ public:
|
||||||
bool isALSMinCLTCondition() const;
|
bool isALSMinCLTCondition() const;
|
||||||
bool isALSMaxCLTCondition() const;
|
bool isALSMaxCLTCondition() const;
|
||||||
bool isALSMaxTPSCondition() const;
|
bool isALSMaxTPSCondition() const;
|
||||||
bool isAntilagConditionMet(int rpm);
|
bool isAntilagConditionMet();
|
||||||
bool isInsideALSSwitchCondition();
|
bool isInsideALSSwitchCondition();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -129,6 +129,8 @@ float getRunningFuel(float baseFuel) {
|
||||||
|
|
||||||
float runningFuel = baseFuel * baroCorrection * iatCorrection * cltCorrection * postCrankingFuelCorrection;
|
float runningFuel = baseFuel * baroCorrection * iatCorrection * cltCorrection * postCrankingFuelCorrection;
|
||||||
|
|
||||||
|
runningFuel *= (1 + engine->antilagController.fuelALSCorrection);
|
||||||
|
|
||||||
#if EFI_LAUNCH_CONTROL
|
#if EFI_LAUNCH_CONTROL
|
||||||
runningFuel *= engine->launchController.getFuelCoefficient();
|
runningFuel *= engine->launchController.getFuelCoefficient();
|
||||||
#endif
|
#endif
|
||||||
|
@ -391,6 +393,23 @@ float getBaroCorrection() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto tps = Sensor::get(SensorType::Tps1);
|
||||||
|
auto rpm = Sensor::get(SensorType::Rpm);
|
||||||
|
float getfuelALSCorrection(int rpm, float engineLoad) {
|
||||||
|
#if EFI_ANTILAG_SYSTEM
|
||||||
|
if (engine->antilagController.isAntilagCondition) {
|
||||||
|
auto AlsFuelAdd = interpolate3d(
|
||||||
|
config->ALSFuelAdjustment,
|
||||||
|
config->alsFuelAdjustmentLoadBins, tps.Value,
|
||||||
|
config->alsFuelAdjustmentrpmBins, rpm
|
||||||
|
);
|
||||||
|
return AlsFuelAdd;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif /* EFI_ANTILAG_SYSTEM */
|
||||||
|
}
|
||||||
|
|
||||||
#if EFI_ENGINE_CONTROL
|
#if EFI_ENGINE_CONTROL
|
||||||
/**
|
/**
|
||||||
* @return Duration of fuel injection while craning
|
* @return Duration of fuel injection while craning
|
||||||
|
|
Loading…
Reference in New Issue