idle_min through FSIO not working as intended #1553
This commit is contained in:
parent
a462f75050
commit
23e6ea5475
|
@ -57,6 +57,10 @@ static Logging *logger;
|
|||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
#if EFI_UNIT_TEST
|
||||
Engine *unitTestEngine;
|
||||
#endif
|
||||
|
||||
static bool prettyClose = false;
|
||||
|
||||
static bool shouldResetPid = false;
|
||||
|
@ -74,7 +78,12 @@ PidCic idlePid;
|
|||
class PidWithOverrides : public Pid {
|
||||
public:
|
||||
float getOffset() const override {
|
||||
#if EFI_FSIO && ! EFI_UNIT_TEST
|
||||
#if EFI_UNIT_TEST
|
||||
Engine *engine = unitTestEngine;
|
||||
EXPAND_Engine;
|
||||
#endif
|
||||
|
||||
#if EFI_FSIO
|
||||
if (engineConfiguration->useFSIO12ForIdleOffset) {
|
||||
return ENGINE(fsioState.fsioIdleOffset);
|
||||
}
|
||||
|
@ -83,7 +92,11 @@ public:
|
|||
}
|
||||
|
||||
float getMinValue() const override {
|
||||
#if EFI_FSIO && ! EFI_UNIT_TEST
|
||||
#if EFI_UNIT_TEST
|
||||
Engine *engine = unitTestEngine;
|
||||
EXPAND_Engine;
|
||||
#endif
|
||||
#if EFI_FSIO
|
||||
if (engineConfiguration->useFSIO13ForIdleMinValue) {
|
||||
return ENGINE(fsioState.fsioIdleMinValue);
|
||||
}
|
||||
|
@ -95,6 +108,11 @@ public:
|
|||
PidWithOverrides idlePid;
|
||||
#endif /* EFI_IDLE_PID_CIC */
|
||||
|
||||
|
||||
float getIdlePidOffset() {
|
||||
return idlePid.getOffset();
|
||||
}
|
||||
|
||||
// todo: extract interface for idle valve hardware, with solenoid and stepper implementations?
|
||||
static SimplePwm idleSolenoidOpen("idle open");
|
||||
static SimplePwm idleSolenoidClose("idle close");
|
||||
|
|
|
@ -36,4 +36,4 @@ void stopIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
|||
void initIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
bool isIdleHardwareRestartNeeded();
|
||||
void onConfigurationChangeIdleCallback(engine_configuration_s *previousConfiguration);
|
||||
|
||||
float getIdlePidOffset();
|
||||
|
|
|
@ -19,9 +19,13 @@
|
|||
extern IdleController idleControllerInstance;
|
||||
extern int timeNowUs;
|
||||
|
||||
extern Engine *unitTestEngine;
|
||||
|
||||
TEST(idle, fsioPidParameters) {
|
||||
WITH_ENGINE_TEST_HELPER(MIATA_NA6_MAP);
|
||||
|
||||
unitTestEngine = engine;
|
||||
|
||||
engineConfiguration->idleRpmPid.offset = 40;
|
||||
engineConfiguration->idleRpmPid2.offset = 50;
|
||||
|
||||
|
@ -39,14 +43,14 @@ TEST(idle, fsioPidParameters) {
|
|||
ASSERT_EQ(1, getAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
|
||||
eth.engine.periodicSlowCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
ASSERT_EQ(40, ENGINE(fsioState.fsioIdleOffset));
|
||||
ASSERT_EQ(40, getIdlePidOffset());
|
||||
ASSERT_EQ(30, ENGINE(fsioState.fsioIdleMinValue));
|
||||
|
||||
setMockVoltage(engineConfiguration->acSwitchAdc, 5 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
ASSERT_EQ(0, getAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
|
||||
eth.engine.periodicSlowCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
ASSERT_EQ(50, ENGINE(fsioState.fsioIdleOffset));
|
||||
ASSERT_EQ(50, getIdlePidOffset());
|
||||
ASSERT_EQ(60, ENGINE(fsioState.fsioIdleMinValue));
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue