From 92a4895b13799145042fc17cc985002a3f811ae9 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sun, 22 Jan 2023 07:40:42 -0500 Subject: [PATCH] refactoring: inside the boost controller instead of depending on the engine god object --- firmware/controllers/actuators/boost_control.cpp | 10 ++++------ firmware/controllers/actuators/boost_control.h | 2 -- firmware/controllers/algo/engine.cpp | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/firmware/controllers/actuators/boost_control.cpp b/firmware/controllers/actuators/boost_control.cpp index d371bef405..4f88a67b03 100644 --- a/firmware/controllers/actuators/boost_control.cpp +++ b/firmware/controllers/actuators/boost_control.cpp @@ -150,6 +150,10 @@ void BoostController::setOutput(expected output) { } void BoostController::update() { + if (!hasInitBoost) { + return; + } + m_pid.iTermMin = -50; m_pid.iTermMax = 50; @@ -165,12 +169,6 @@ void BoostController::update() { } } -void updateBoostControl() { - if (engine->boostController.hasInitBoost) { - engine->boostController.update(); - } -} - void setDefaultBoostParameters() { engineConfiguration->boostPwmFrequency = 33; engineConfiguration->boostPid.offset = 0; diff --git a/firmware/controllers/actuators/boost_control.h b/firmware/controllers/actuators/boost_control.h index d80f96470f..167b18c764 100644 --- a/firmware/controllers/actuators/boost_control.h +++ b/firmware/controllers/actuators/boost_control.h @@ -46,5 +46,3 @@ void startBoostPin(); void initBoostCtrl(); void setDefaultBoostParameters(); void onConfigurationChangeBoostCallback(engine_configuration_s *previousConfiguration); - -void updateBoostControl(); diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index 09e7e27a80..e996112fc2 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -155,7 +155,7 @@ void Engine::periodicSlowCallback() { updateFans(module().unmock().isAcEnabled()); #if EFI_BOOST_CONTROL - updateBoostControl(); + engine->boostController.update(); #endif // EFI_BOOST_CONTROL #if (BOARD_TLE8888_COUNT > 0)