From fc804bb345380a256616564ef43dabc2097b5919 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Sun, 12 Nov 2023 20:52:52 -0800 Subject: [PATCH] simplify dead code --- .../actuators/alternator_controller.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/firmware/controllers/actuators/alternator_controller.cpp b/firmware/controllers/actuators/alternator_controller.cpp index 1559535700..e807f4a5f4 100644 --- a/firmware/controllers/actuators/alternator_controller.cpp +++ b/firmware/controllers/actuators/alternator_controller.cpp @@ -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 outputValue) { } void AlternatorController::onConfigurationChange(engine_configuration_s const * previousConfiguration) { - shouldResetPid = !alternatorPid.isSame(&previousConfiguration->alternatorControl); + if(!alternatorPid.isSame(&previousConfiguration->alternatorControl)) { + alternatorPid.reset(); + } } void initAlternatorCtrl() {