progress towards idle unit test

This commit is contained in:
rusefi 2019-08-29 23:50:20 -04:00
parent 375d64417d
commit 162264fe08
6 changed files with 19 additions and 16 deletions

View File

@ -138,7 +138,7 @@ static void applyAlternatorPinState(int stateIndex, PwmConfig *state) /* pwm_gen
output->setValue(value); output->setValue(value);
} }
void setDefaultAlternatorParameters(void) { void setDefaultAlternatorParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->alternatorOffAboveTps = 120; engineConfiguration->alternatorOffAboveTps = 120;
engineConfiguration->targetVBatt = 14; engineConfiguration->targetVBatt = 14;

View File

@ -16,7 +16,7 @@ void setAltPFactor(float p);
void setAltIFactor(float p); void setAltIFactor(float p);
void setAltDFactor(float p); void setAltDFactor(float p);
void showAltInfo(void); void showAltInfo(void);
void setDefaultAlternatorParameters(void); void setDefaultAlternatorParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void onConfigurationChangeAlternatorCallback(engine_configuration_s *previousConfiguration); void onConfigurationChangeAlternatorCallback(engine_configuration_s *previousConfiguration);

View File

@ -395,6 +395,13 @@ static void applyPidSettings(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
idlePid.updateFactors(engineConfiguration->idleRpmPid.pFactor, engineConfiguration->idleRpmPid.iFactor, engineConfiguration->idleRpmPid.dFactor); idlePid.updateFactors(engineConfiguration->idleRpmPid.pFactor, engineConfiguration->idleRpmPid.iFactor, engineConfiguration->idleRpmPid.dFactor);
} }
void setDefaultIdleParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->idleRpmPid.pFactor = 0.1f;
engineConfiguration->idleRpmPid.iFactor = 0.05f;
engineConfiguration->idleRpmPid.dFactor = 0.0f;
engineConfiguration->idleRpmPid.periodMs = 10;
}
#if ! EFI_UNIT_TEST #if ! EFI_UNIT_TEST
void onConfigurationChangeIdleCallback(engine_configuration_s *previousConfiguration) { void onConfigurationChangeIdleCallback(engine_configuration_s *previousConfiguration) {
@ -446,13 +453,6 @@ void startIdleBench(void) {
showIdleInfo(); showIdleInfo();
} }
void setDefaultIdleParameters(void) {
engineConfiguration->idleRpmPid.pFactor = 0.1f;
engineConfiguration->idleRpmPid.iFactor = 0.05f;
engineConfiguration->idleRpmPid.dFactor = 0.0f;
engineConfiguration->idleRpmPid.periodMs = 10;
}
static void applyIdleSolenoidPinState(int stateIndex, PwmConfig *state) /* pwm_gen_callback */ { static void applyIdleSolenoidPinState(int stateIndex, PwmConfig *state) /* pwm_gen_callback */ {
efiAssertVoid(CUSTOM_ERR_6645, stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex"); efiAssertVoid(CUSTOM_ERR_6645, stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex");
efiAssertVoid(CUSTOM_ERR_6646, state->multiWave.waveCount == 1, "invalid idle waveCount"); efiAssertVoid(CUSTOM_ERR_6646, state->multiWave.waveCount == 1, "invalid idle waveCount");

View File

@ -14,7 +14,7 @@
percent_t getIdlePosition(void); percent_t getIdlePosition(void);
void setIdleValvePosition(int positionPercent); void setIdleValvePosition(int positionPercent);
void startIdleThread(Logging*sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX); void startIdleThread(Logging*sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
void setDefaultIdleParameters(void); void setDefaultIdleParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void startIdleBench(void); void startIdleBench(void);
void setIdleDT(int value); void setIdleDT(int value);
void setIdleOffset(float value); void setIdleOffset(float value);

View File

@ -179,7 +179,7 @@ void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
onConfigurationChangeElectronicThrottleCallback(&activeConfiguration); onConfigurationChangeElectronicThrottleCallback(&activeConfiguration);
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */ #endif /* EFI_ELECTRONIC_THROTTLE_BODY */
#if EFI_IDLE_CONTROL #if EFI_IDLE_CONTROL && ! EFI_UNIT_TEST
onConfigurationChangeIdleCallback(&activeConfiguration); onConfigurationChangeIdleCallback(&activeConfiguration);
#endif /* EFI_IDLE_CONTROL */ #endif /* EFI_IDLE_CONTROL */
@ -303,10 +303,6 @@ void prepareVoidConfiguration(engine_configuration_s *engineConfiguration) {
engineConfiguration->high_fuel_pressure_sensor_1 = EFI_ADC_NONE; engineConfiguration->high_fuel_pressure_sensor_1 = EFI_ADC_NONE;
engineConfiguration->high_fuel_pressure_sensor_2 = EFI_ADC_NONE; engineConfiguration->high_fuel_pressure_sensor_2 = EFI_ADC_NONE;
#if EFI_IDLE_CONTROL
setDefaultIdleParameters();
#endif /* EFI_IDLE_CONTROL */
boardConfiguration->clutchDownPinMode = PI_PULLUP; boardConfiguration->clutchDownPinMode = PI_PULLUP;
boardConfiguration->clutchUpPinMode = PI_PULLUP; boardConfiguration->clutchUpPinMode = PI_PULLUP;
engineConfiguration->brakePedalPinMode = PI_PULLUP; engineConfiguration->brakePedalPinMode = PI_PULLUP;
@ -585,9 +581,14 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
prepareVoidConfiguration(engineConfiguration); prepareVoidConfiguration(engineConfiguration);
#if EFI_ALTERNATOR_CONTROL #if EFI_ALTERNATOR_CONTROL
setDefaultAlternatorParameters(); setDefaultAlternatorParameters(PASS_CONFIG_PARAMETER_SIGNATURE);
#endif /* EFI_ALTERNATOR_CONTROL */ #endif /* EFI_ALTERNATOR_CONTROL */
#if EFI_IDLE_CONTROL
setDefaultIdleParameters(PASS_CONFIG_PARAMETER_SIGNATURE);
#endif /* EFI_IDLE_CONTROL */
#if EFI_ELECTRONIC_THROTTLE_BODY #if EFI_ELECTRONIC_THROTTLE_BODY
setDefaultEtbParameters(PASS_ENGINE_PARAMETER_SIGNATURE); setDefaultEtbParameters(PASS_ENGINE_PARAMETER_SIGNATURE);
setDefaultEtbBiasCurve(PASS_ENGINE_PARAMETER_SIGNATURE); setDefaultEtbBiasCurve(PASS_ENGINE_PARAMETER_SIGNATURE);

View File

@ -14,6 +14,8 @@
#define EFI_CJ125 TRUE #define EFI_CJ125 TRUE
#define EFI_IDLE_CONTROL TRUE
#define SPARK_EXTREME_LOGGING TRUE #define SPARK_EXTREME_LOGGING TRUE
#define EFI_ENABLE_CRITICAL_ENGINE_STOP TRUE #define EFI_ENABLE_CRITICAL_ENGINE_STOP TRUE