parent
d017948f2f
commit
1afa6fa99a
|
@ -15,12 +15,14 @@
|
||||||
#include "advance_map.h"
|
#include "advance_map.h"
|
||||||
|
|
||||||
bool AntilagSystemBase::isInsideALSSwitchCondition() {
|
bool AntilagSystemBase::isInsideALSSwitchCondition() {
|
||||||
isALSSwitchActivated = engineConfiguration->antiLagActivationMode != SWITCH_INPUT_ANTILAG;
|
isALSSwitchActivated = engineConfiguration->antiLagActivationMode == SWITCH_INPUT_ANTILAG;
|
||||||
|
|
||||||
if (isALSSwitchActivated) {
|
if (isALSSwitchActivated) {
|
||||||
if (isBrainPinValid(engineConfiguration->ALSActivatePin)) {
|
if (isBrainPinValid(engineConfiguration->ALSActivatePin)) {
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
ALSActivatePinState = engineConfiguration->ALSActivateInverted ^ efiReadPin(engineConfiguration->ALSActivatePin);
|
ALSActivatePinState = engineConfiguration->ALSActivateInverted ^ efiReadPin(engineConfiguration->ALSActivatePin);
|
||||||
|
#else
|
||||||
|
ALSActivatePinState = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return ALSActivatePinState;
|
return ALSActivatePinState;
|
||||||
|
|
|
@ -9,11 +9,12 @@ TEST(Actuators, AntiLag) {
|
||||||
|
|
||||||
engineConfiguration->antiLagActivationMode = SWITCH_INPUT_ANTILAG;
|
engineConfiguration->antiLagActivationMode = SWITCH_INPUT_ANTILAG;
|
||||||
engine->periodicFastCallback();
|
engine->periodicFastCallback();
|
||||||
ASSERT_EQ(1, engine->antilagController.ALSSwitchCondition);
|
// in unit tests we pretend that physical swiych is always OFF
|
||||||
|
ASSERT_EQ(0, engine->antilagController.ALSSwitchCondition);
|
||||||
|
|
||||||
engineConfiguration->antiLagActivationMode = ALWAYS_ON_ANTILAG;
|
engineConfiguration->antiLagActivationMode = ALWAYS_ON_ANTILAG;
|
||||||
engine->periodicFastCallback();
|
engine->periodicFastCallback();
|
||||||
ASSERT_EQ(0, engine->antilagController.ALSSwitchCondition);
|
ASSERT_EQ(1, engine->antilagController.ALSSwitchCondition);
|
||||||
|
|
||||||
ASSERT_EQ(1, engine->antilagController.ALSMinCLTCondition);
|
ASSERT_EQ(1, engine->antilagController.ALSMinCLTCondition);
|
||||||
ASSERT_EQ(1, engine->antilagController.ALSMaxCLTCondition);
|
ASSERT_EQ(1, engine->antilagController.ALSMaxCLTCondition);
|
||||||
|
|
Loading…
Reference in New Issue