simplify dead code

This commit is contained in:
Matthew Kennedy 2023-11-12 20:52:52 -08:00
parent b26e3a193c
commit fc804bb345
1 changed files with 3 additions and 16 deletions

View File

@ -22,26 +22,11 @@
static SimplePwm alternatorControl("alt");
static Pid alternatorPid(&persistentState.persistentConfiguration.engineConfiguration.alternatorControl);
static percent_t currentAltDuty;
static bool shouldResetPid = false;
static void pidReset() {
alternatorPid.reset();
}
void AlternatorController::onFastCallback() {
if (!isBrainPinValid(engineConfiguration->alternatorControlPin)) {
return;
}
#if ! EFI_UNIT_TEST
if (shouldResetPid) {
pidReset();
shouldResetPid = false;
}
#endif
// this block could be executed even in on/off alternator control mode
// but at least we would reflect latest state
#if EFI_TUNER_STUDIO
@ -85,7 +70,9 @@ void AlternatorController::setOutput(expected<percent_t> outputValue) {
}
void AlternatorController::onConfigurationChange(engine_configuration_s const * previousConfiguration) {
shouldResetPid = !alternatorPid.isSame(&previousConfiguration->alternatorControl);
if(!alternatorPid.isSame(&previousConfiguration->alternatorControl)) {
alternatorPid.reset();
}
}
void initAlternatorCtrl() {