diff --git a/firmware/bootloader/src/rusefi_stubs.cpp b/firmware/bootloader/src/rusefi_stubs.cpp
index 69231ab24d..75721cdb0d 100644
--- a/firmware/bootloader/src/rusefi_stubs.cpp
+++ b/firmware/bootloader/src/rusefi_stubs.cpp
@@ -1,6 +1,6 @@
-#include "global.h"
+#include "pch.h"
+
#include "hardware.h"
-#include "efi_gpio.h"
/*
* We need only a small portion of code from rusEFI codebase in the bootloader.
diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp
index 9b57488461..c87c09f1ad 100644
--- a/firmware/console/status_loop.cpp
+++ b/firmware/console/status_loop.cpp
@@ -24,10 +24,9 @@
*
*/
-#include "global.h"
+#include "pch.h"
#include "status_loop.h"
#include "hip9011_logic.h"
-#include "engine_controller.h"
#include "adc_inputs.h"
#if EFI_LOGIC_ANALYZER
@@ -35,10 +34,7 @@
#endif /* EFI_LOGIC_ANALYZER */
#include "trigger_central.h"
-#include "allsensors.h"
#include "sensor_reader.h"
-#include "io_pins.h"
-#include "efi_gpio.h"
#include "mmc_card.h"
#include "console_io.h"
#include "malfunction_central.h"
@@ -48,15 +44,11 @@
#include "tunerstudio.h"
#include "fuel_math.h"
#include "main_trigger_callback.h"
-#include "engine_math.h"
#include "spark_logic.h"
#include "idle_thread.h"
-#include "engine_configuration.h"
#include "os_util.h"
#include "svnversion.h"
-#include "engine.h"
#include "lcd_controller.h"
-#include "settings.h"
#include "can_hw.h"
#include "periodic_thread_controller.h"
#include "cdm_ion_sense.h"
diff --git a/firmware/controllers/actuators/ac_control.cpp b/firmware/controllers/actuators/ac_control.cpp
index 84a1beb87e..e71d9251b0 100644
--- a/firmware/controllers/actuators/ac_control.cpp
+++ b/firmware/controllers/actuators/ac_control.cpp
@@ -1,10 +1,7 @@
-#include "ac_control.h"
-#include "engine.h"
+#include "pch.h"
+#include "ac_control.h"
#include "deadband.h"
-#include "efi_gpio.h"
-#include "sensor.h"
-#include "tunerstudio_outputs.h"
// Deadbands to prevent rapid switching on/off of AC
static Deadband<200> maxRpmDeadband;
diff --git a/firmware/controllers/actuators/alternator_controller.cpp b/firmware/controllers/actuators/alternator_controller.cpp
index bfe6d853c5..2945bf2463 100644
--- a/firmware/controllers/actuators/alternator_controller.cpp
+++ b/firmware/controllers/actuators/alternator_controller.cpp
@@ -7,24 +7,14 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "global.h"
-
-#if EFI_TUNER_STUDIO
-#include "tunerstudio_outputs.h"
-#endif /* EFI_TUNER_STUDIO */
+#include "pch.h"
#if EFI_ALTERNATOR_CONTROL
-#include "engine.h"
-#include "rpm_calculator.h"
#include "alternator_controller.h"
#include "pid.h"
#include "local_version_holder.h"
#include "periodic_task.h"
-#include "pwm_generator_logic.h"
-#include "pin_repository.h"
-
-
#if defined(HAS_OS_ACCESS)
#error "Unexpected OS ACCESS HERE"
#endif /* HAS_OS_ACCESS */
diff --git a/firmware/controllers/actuators/boost_control.cpp b/firmware/controllers/actuators/boost_control.cpp
index b38aca70a7..f7314d7d24 100644
--- a/firmware/controllers/actuators/boost_control.cpp
+++ b/firmware/controllers/actuators/boost_control.cpp
@@ -4,18 +4,11 @@
* Created on: 13. des. 2019
* Author: Ola Ruud
*/
-#include "global.h"
+#include "pch.h"
#if EFI_BOOST_CONTROL
-#if EFI_TUNER_STUDIO
-#include "tunerstudio_outputs.h"
-#endif /* EFI_TUNER_STUDIO */
-#include "engine.h"
#include "boost_control.h"
-#include "sensor.h"
-#include "pin_repository.h"
-#include "pwm_generator_logic.h"
#include "pid_auto_tune.h"
#include "electronic_throttle.h"
diff --git a/firmware/controllers/actuators/dc_motors.cpp b/firmware/controllers/actuators/dc_motors.cpp
index 87607a74ff..ca7566ed19 100644
--- a/firmware/controllers/actuators/dc_motors.cpp
+++ b/firmware/controllers/actuators/dc_motors.cpp
@@ -5,18 +5,13 @@
* @author Matthew Kennedy (c) 2020
*/
-#include "engine.h"
-#include "io_pins.h"
-#include "engine_configuration.h"
-#include "engine_controller.h"
+#include "pch.h"
+
#include "periodic_task.h"
#include "dc_motors.h"
#include "dc_motor.h"
-#include "efi_gpio.h"
-#include "pwm_generator_logic.h"
-
class DcHardware {
private:
OutputPin m_pinEnable;
diff --git a/firmware/controllers/actuators/electronic_throttle.cpp b/firmware/controllers/actuators/electronic_throttle.cpp
index 673cbaabe8..b89311765d 100644
--- a/firmware/controllers/actuators/electronic_throttle.cpp
+++ b/firmware/controllers/actuators/electronic_throttle.cpp
@@ -72,14 +72,11 @@
* If not, see .
*/
-#include "global.h"
+#include "pch.h"
#if EFI_ELECTRONIC_THROTTLE_BODY
#include "electronic_throttle_impl.h"
-#include "engine.h"
-#include "tps.h"
-#include "sensor.h"
#include "dc_motor.h"
#include "dc_motors.h"
#include "pid_auto_tune.h"
diff --git a/firmware/controllers/actuators/fan_control.cpp b/firmware/controllers/actuators/fan_control.cpp
index e07cbd8a78..4fbdf6b457 100644
--- a/firmware/controllers/actuators/fan_control.cpp
+++ b/firmware/controllers/actuators/fan_control.cpp
@@ -1,9 +1,8 @@
+#include "pch.h"
+
#include "fan_control.h"
-#include "engine.h"
#include "bench_test.h"
-#include "efi_gpio.h"
-#include "sensor.h"
static void fanControl(bool acActive, OutputPin& pin, int8_t fanOnTemp, int8_t fanOffTemp, bool enableWithAc, bool disableWhenStopped DECLARE_ENGINE_PARAMETER_SUFFIX) {
auto [cltValid, clt] = Sensor::get(SensorType::Clt);
diff --git a/firmware/controllers/actuators/gppwm/gppwm.cpp b/firmware/controllers/actuators/gppwm/gppwm.cpp
index fbae874cd9..e4103309cc 100644
--- a/firmware/controllers/actuators/gppwm/gppwm.cpp
+++ b/firmware/controllers/actuators/gppwm/gppwm.cpp
@@ -1,10 +1,7 @@
-#include "global.h"
-#include "engine.h"
-#include "pin_repository.h"
+#include "pch.h"
#include "gppwm_channel.h"
-#include "pwm_generator_logic.h"
static GppwmChannel channels[GPPWM_CHANNELS];
static OutputPin pins[GPPWM_CHANNELS];
diff --git a/firmware/controllers/actuators/gppwm/gppwm_channel.cpp b/firmware/controllers/actuators/gppwm/gppwm_channel.cpp
index 0b3b7bfbf1..6be49fb380 100644
--- a/firmware/controllers/actuators/gppwm/gppwm_channel.cpp
+++ b/firmware/controllers/actuators/gppwm/gppwm_channel.cpp
@@ -1,12 +1,10 @@
+#include "pch.h"
+
#include "gppwm_channel.h"
-#include "engine.h"
-#include "pwm_generator_logic.h"
#include "table_helper.h"
#include "expected.h"
-#include "sensor.h"
-#include "engine_math.h"
expected readGppwmChannel(gppwm_channel_e channel DECLARE_ENGINE_PARAMETER_SUFFIX) {
switch (channel) {
diff --git a/firmware/controllers/actuators/idle_hardware.cpp b/firmware/controllers/actuators/idle_hardware.cpp
index 61eaecf8fc..b405b6e52f 100644
--- a/firmware/controllers/actuators/idle_hardware.cpp
+++ b/firmware/controllers/actuators/idle_hardware.cpp
@@ -7,20 +7,16 @@
* This is just the hardware interface - deciding where to put the valve happens in idle_thread.cpp
*/
-#include "global.h"
+#include "pch.h"
#if EFI_IDLE_CONTROL
-#include "engine_configuration.h"
#include "idle_hardware.h"
-#include "engine.h"
#include "electronic_throttle.h"
-#include "pwm_generator_logic.h"
#include "dc_motors.h"
#if ! EFI_UNIT_TEST
#include "stepper.h"
-#include "pin_repository.h"
static StepDirectionStepper iacStepperHw;
static DualHBridgeStepper iacHbridgeHw;
StepperMotor iacMotor;
diff --git a/firmware/controllers/actuators/idle_thread.cpp b/firmware/controllers/actuators/idle_thread.cpp
index dfad105f70..274435989b 100644
--- a/firmware/controllers/actuators/idle_thread.cpp
+++ b/firmware/controllers/actuators/idle_thread.cpp
@@ -27,20 +27,14 @@
*
*/
-#include "global.h"
+#include "pch.h"
#if EFI_IDLE_CONTROL
-#include "engine_configuration.h"
-#include "rpm_calculator.h"
#include "idle_thread.h"
#include "idle_hardware.h"
-#include "engine_math.h"
-#include "engine.h"
#include "periodic_task.h"
-#include "allsensors.h"
#include "vehicle_speed.h"
-#include "sensor.h"
#include "dc_motors.h"
#if EFI_TUNER_STUDIO
diff --git a/firmware/controllers/actuators/pwm_tester.cpp b/firmware/controllers/actuators/pwm_tester.cpp
index 1574aec264..49f4624474 100644
--- a/firmware/controllers/actuators/pwm_tester.cpp
+++ b/firmware/controllers/actuators/pwm_tester.cpp
@@ -6,14 +6,11 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "global.h"
+#include "pch.h"
#if EFI_PWM_TESTER
#include "pwm_tester.h"
-#include "state_requence.h"
-#include "pwm_generator_logic.h"
-#include "engine.h"
static SimplePwm pwmTest[5];
diff --git a/firmware/controllers/actuators/vvt.cpp b/firmware/controllers/actuators/vvt.cpp
index 6e6c175672..2180c3f730 100644
--- a/firmware/controllers/actuators/vvt.cpp
+++ b/firmware/controllers/actuators/vvt.cpp
@@ -5,14 +5,12 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
+#include "pch.h"
+
#include "local_version_holder.h"
-#include "allsensors.h"
#include "vvt.h"
-#include "tunerstudio_outputs.h"
#include "fsio_impl.h"
-#include "engine_math.h"
-#include "pin_repository.h"
#define NO_PIN_PERIOD 500
diff --git a/firmware/controllers/algo/accel_enrichment.cpp b/firmware/controllers/algo/accel_enrichment.cpp
index bbf1c19048..96e4e12f4d 100644
--- a/firmware/controllers/algo/accel_enrichment.cpp
+++ b/firmware/controllers/algo/accel_enrichment.cpp
@@ -21,16 +21,9 @@
* @author Matthew Kennedy
*/
-#include "global.h"
-#include "engine.h"
+#include "pch.h"
#include "trigger_central.h"
#include "accel_enrichment.h"
-#include "allsensors.h"
-#include "engine_math.h"
-#include "perf_trace.h"
-#if EFI_TUNER_STUDIO
-#include "tunerstudio_outputs.h"
-#endif /* EFI_TUNER_STUDIO */
static tps_tps_Map3D_t tpsTpsMap;
diff --git a/firmware/controllers/algo/advance_map.cpp b/firmware/controllers/algo/advance_map.cpp
index 586cd93456..6d46a64685 100644
--- a/firmware/controllers/algo/advance_map.cpp
+++ b/firmware/controllers/algo/advance_map.cpp
@@ -18,15 +18,10 @@
* If not, see .
*/
-#include "global.h"
-#include "engine_configuration.h"
-#include "engine.h"
+#include "pch.h"
+
#include "advance_map.h"
-#include "interpolation.h"
-#include "engine_math.h"
-#include "sensor.h"
#include "idle_thread.h"
-#include "allsensors.h"
#include "launch_control.h"
#if EFI_ENGINE_CONTROL
diff --git a/firmware/controllers/algo/airmass/airmass.cpp b/firmware/controllers/algo/airmass/airmass.cpp
index a51459cbf0..d44e208f91 100644
--- a/firmware/controllers/algo/airmass/airmass.cpp
+++ b/firmware/controllers/algo/airmass/airmass.cpp
@@ -1,5 +1,6 @@
+#include "pch.h"
+
#include "airmass.h"
-#include "sensor.h"
#include "idle_thread.h"
AirmassVeModelBase::AirmassVeModelBase(const ValueProvider3D& veTable) : m_veTable(&veTable) {}
diff --git a/firmware/controllers/algo/airmass/alphan_airmass.cpp b/firmware/controllers/algo/airmass/alphan_airmass.cpp
index fb5869493f..e0df6bf021 100644
--- a/firmware/controllers/algo/airmass/alphan_airmass.cpp
+++ b/firmware/controllers/algo/airmass/alphan_airmass.cpp
@@ -1,5 +1,6 @@
+#include "pch.h"
+
#include "alphan_airmass.h"
-#include "sensor.h"
AirmassResult AlphaNAirmass::getAirmass(int rpm) {
auto tps = Sensor::get(SensorType::Tps1);
diff --git a/firmware/controllers/algo/airmass/maf_airmass.cpp b/firmware/controllers/algo/airmass/maf_airmass.cpp
index a0996a10d4..4c216ff66a 100644
--- a/firmware/controllers/algo/airmass/maf_airmass.cpp
+++ b/firmware/controllers/algo/airmass/maf_airmass.cpp
@@ -1,5 +1,4 @@
-#include "global.h"
-#include "engine.h"
+#include "pch.h"
#include "maf_airmass.h"
#include "maf.h"
diff --git a/firmware/controllers/algo/airmass/speed_density_airmass.cpp b/firmware/controllers/algo/airmass/speed_density_airmass.cpp
index f8dc76058c..6fb874fb5e 100644
--- a/firmware/controllers/algo/airmass/speed_density_airmass.cpp
+++ b/firmware/controllers/algo/airmass/speed_density_airmass.cpp
@@ -1,7 +1,5 @@
-#include "global.h"
-#include "engine.h"
+#include "pch.h"
#include "speed_density_airmass.h"
-#include "perf_trace.h"
AirmassResult SpeedDensityAirmass::getAirmass(int rpm) {
ScopePerf perf(PE::GetSpeedDensityFuel);
diff --git a/firmware/controllers/algo/defaults/default_base_engine.cpp b/firmware/controllers/algo/defaults/default_base_engine.cpp
index cbd7e3aab5..923940c275 100644
--- a/firmware/controllers/algo/defaults/default_base_engine.cpp
+++ b/firmware/controllers/algo/defaults/default_base_engine.cpp
@@ -1,5 +1,6 @@
+#include "pch.h"
+
#include "defaults.h"
-#include "engine_configuration.h"
static void setDefaultAlternatorParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->alternatorOffAboveTps = 120;
diff --git a/firmware/controllers/algo/defaults/default_cranking.cpp b/firmware/controllers/algo/defaults/default_cranking.cpp
index b28c9cb0b1..5321838245 100644
--- a/firmware/controllers/algo/defaults/default_cranking.cpp
+++ b/firmware/controllers/algo/defaults/default_cranking.cpp
@@ -1,5 +1,6 @@
+#include "pch.h"
+
#include "defaults.h"
-#include "engine_configuration.h"
#include "table_helper.h"
void setDefaultCranking(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
diff --git a/firmware/controllers/algo/defaults/default_fuel.cpp b/firmware/controllers/algo/defaults/default_fuel.cpp
index 83f601ece2..f23878434b 100644
--- a/firmware/controllers/algo/defaults/default_fuel.cpp
+++ b/firmware/controllers/algo/defaults/default_fuel.cpp
@@ -1,5 +1,6 @@
+#include "pch.h"
+
#include "defaults.h"
-#include "engine_configuration.h"
#include "table_helper.h"
#include "mazda_miata_vvt.h"
diff --git a/firmware/controllers/algo/defaults/default_ignition.cpp b/firmware/controllers/algo/defaults/default_ignition.cpp
index c65019a91e..f961a7883a 100644
--- a/firmware/controllers/algo/defaults/default_ignition.cpp
+++ b/firmware/controllers/algo/defaults/default_ignition.cpp
@@ -1,6 +1,6 @@
+#include "pch.h"
+
#include "defaults.h"
-#include "engine_configuration.h"
-#include "engine_math.h"
#include "table_helper.h"
static void setDefaultMultisparkParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
diff --git a/firmware/controllers/algo/dynoview.cpp b/firmware/controllers/algo/dynoview.cpp
index 9abe5630e5..e27c5a2bcb 100644
--- a/firmware/controllers/algo/dynoview.cpp
+++ b/firmware/controllers/algo/dynoview.cpp
@@ -5,18 +5,12 @@
* @author Alexandru Miculescu, (c) 2012-2020
*/
-#include "engine.h"
-#include "pin_repository.h"
+#include "pch.h"
#if EFI_DYNO_VIEW
#include "dynoview.h"
#include "vehicle_speed.h"
-#if EFI_TUNER_STUDIO
-#include "tunerstudio_outputs.h"
-extern TunerStudioOutputChannels tsOutputChannels;
-#endif /* EFI_TUNER_STUDIO */
-
DynoView dynoInstance;
void DynoView::update(vssSrc src) {
diff --git a/firmware/controllers/algo/engine2.cpp b/firmware/controllers/algo/engine2.cpp
index 7c63e19769..90fefc6e83 100644
--- a/firmware/controllers/algo/engine2.cpp
+++ b/firmware/controllers/algo/engine2.cpp
@@ -7,21 +7,16 @@
// todo: move this code to more proper locations
-#include "engine.h"
+#include "pch.h"
#include "thermistors.h"
#include "speed_density.h"
-#include "allsensors.h"
#include "fuel_math.h"
-#include "engine_math.h"
#include "advance_map.h"
#include "aux_valves.h"
-#include "perf_trace.h"
#include "closed_loop_fuel.h"
-#include "sensor.h"
#include "launch_control.h"
#include "injector_model.h"
-
#if EFI_PROD_CODE
#include "svnversion.h"
#endif
diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp
index 5fb86c9cb6..57df71416c 100644
--- a/firmware/controllers/algo/engine_configuration.cpp
+++ b/firmware/controllers/algo/engine_configuration.cpp
@@ -20,16 +20,12 @@
*
*/
-#include "global.h"
+#include "pch.h"
+
#include "os_access.h"
-#include "engine_configuration.h"
#include "fsio_impl.h"
-#include "allsensors.h"
-#include "interpolation.h"
-#include "engine_math.h"
#include "speed_density.h"
#include "advance_map.h"
-#include "sensor.h"
#include "flash_main.h"
#include "hip9011_logic.h"
diff --git a/firmware/controllers/algo/event_registry.cpp b/firmware/controllers/algo/event_registry.cpp
index 7746fb9ca0..17f929c784 100644
--- a/firmware/controllers/algo/event_registry.cpp
+++ b/firmware/controllers/algo/event_registry.cpp
@@ -20,9 +20,9 @@
* If not, see .
*/
+#include "pch.h"
+
#include "event_registry.h"
-#include "global.h"
-#include "engine_math.h"
InjectionEvent::InjectionEvent() {
memset(outputs, 0, sizeof(outputs));
diff --git a/firmware/controllers/algo/fuel/injector_model.cpp b/firmware/controllers/algo/fuel/injector_model.cpp
index 465e71dc1d..bcec740263 100644
--- a/firmware/controllers/algo/fuel/injector_model.cpp
+++ b/firmware/controllers/algo/fuel/injector_model.cpp
@@ -1,6 +1,6 @@
+#include "pch.h"
+
#include "injector_model.h"
-#include "tunerstudio_outputs.h"
-#include "map.h"
void InjectorModelBase::prepare() {
m_massFlowRate = getInjectorMassFlowRate();
diff --git a/firmware/controllers/algo/fuel_math.cpp b/firmware/controllers/algo/fuel_math.cpp
index 92f629e650..7051320693 100644
--- a/firmware/controllers/algo/fuel_math.cpp
+++ b/firmware/controllers/algo/fuel_math.cpp
@@ -21,7 +21,8 @@
*
*/
-#include "global.h"
+#include "pch.h"
+
#include "airmass.h"
#include "alphan_airmass.h"
#include "maf_airmass.h"
@@ -29,14 +30,7 @@
#include "fuel_math.h"
#include "fuel_computer.h"
#include "injector_model.h"
-#include "interpolation.h"
-#include "engine_configuration.h"
-#include "allsensors.h"
-#include "engine_math.h"
-#include "rpm_calculator.h"
#include "speed_density.h"
-#include "perf_trace.h"
-#include "sensor.h"
#include "speed_density_base.h"
#include "lua_hooks.h"
diff --git a/firmware/controllers/algo/launch_control.cpp b/firmware/controllers/algo/launch_control.cpp
index 16b64edad0..38a97f4f3d 100644
--- a/firmware/controllers/algo/launch_control.cpp
+++ b/firmware/controllers/algo/launch_control.cpp
@@ -5,21 +5,13 @@
* Author: Ola Ruud
*/
-#include "engine.h"
+#include "pch.h"
#if EFI_LAUNCH_CONTROL
#include "boost_control.h"
#include "vehicle_speed.h"
#include "launch_control.h"
-#include "io_pins.h"
-#include "engine_configuration.h"
-#include "engine_controller.h"
#include "periodic_task.h"
-#include "pin_repository.h"
-#include "allsensors.h"
-#include "sensor.h"
-#include "engine_math.h"
-#include "efi_gpio.h"
#include "advance_map.h"
#include "engine_state.h"
#include "advance_map.h"
@@ -28,11 +20,6 @@ static bool isInit = false;
LaunchControlBase launchInstance;
-#if EFI_TUNER_STUDIO
-#include "tunerstudio_outputs.h"
-extern TunerStudioOutputChannels tsOutputChannels;
-#endif /* EFI_TUNER_STUDIO */
-
static int retardThresholdRpm;
/**
diff --git a/firmware/controllers/bench_test.cpp b/firmware/controllers/bench_test.cpp
index 8b10e2df91..4bdcc3bb40 100644
--- a/firmware/controllers/bench_test.cpp
+++ b/firmware/controllers/bench_test.cpp
@@ -21,7 +21,7 @@
*/
// todo: rename this file
-#include "global.h"
+#include "pch.h"
#if EFI_ENGINE_CONTROL
#if !EFI_UNIT_TEST
@@ -29,19 +29,12 @@
#include "os_access.h"
#include "flash_main.h"
#include "bench_test.h"
-#include "io_pins.h"
#include "main_trigger_callback.h"
-#include "engine_configuration.h"
-#include "pin_repository.h"
-#include "efi_gpio.h"
-#include "settings.h"
#include "idle_thread.h"
#include "periodic_thread_controller.h"
-#include "tps.h"
#include "electronic_throttle.h"
#include "cj125.h"
#include "malfunction_central.h"
-#include "tunerstudio_outputs.h"
#include "trigger_emulator_algo.h"
#include "microsecond_timer.h"
diff --git a/firmware/controllers/buttonshift.cpp b/firmware/controllers/buttonshift.cpp
index 56b3a498d5..fd7d6c959f 100644
--- a/firmware/controllers/buttonshift.cpp
+++ b/firmware/controllers/buttonshift.cpp
@@ -5,8 +5,10 @@
* @date Aug 31, 2020
* @author David Holdeman, (c) 2020
*/
+
+#include "pch.h"
+
#include "buttonshift.h"
-#include "engine.h"
ButtonShiftController buttonShiftController;
diff --git a/firmware/controllers/can/can_dash.cpp b/firmware/controllers/can/can_dash.cpp
index 4502b20b84..2d12fc2883 100644
--- a/firmware/controllers/can/can_dash.cpp
+++ b/firmware/controllers/can/can_dash.cpp
@@ -7,15 +7,12 @@
* @author Matthew Kennedy, (c) 2020
*/
-#include "globalaccess.h"
-#if EFI_CAN_SUPPORT
+#include "pch.h"
-#include "engine.h"
+#if EFI_CAN_SUPPORT
#include "can_dash.h"
#include "can_msg_tx.h"
-#include "sensor.h"
-#include "allsensors.h"
#include "vehicle_speed.h"
#include "rtc_helper.h"
#include "fuel_math.h"
diff --git a/firmware/controllers/can/can_rx.cpp b/firmware/controllers/can/can_rx.cpp
index 383486bb46..a480b48738 100644
--- a/firmware/controllers/can/can_rx.cpp
+++ b/firmware/controllers/can/can_rx.cpp
@@ -8,8 +8,7 @@
* @author Matthew Kennedy, (c) 2020
*/
-#include "global.h"
-#include "engine.h"
+#include "pch.h"
typedef float fsio_table_8x8_f32t_linear[FSIO_TABLE_8 * FSIO_TABLE_8];
@@ -53,7 +52,6 @@ bool acceptCanRx(int sid DECLARE_ENGINE_PARAMETER_SUFFIX) {
#include "can.h"
#include "obd2.h"
-#include "engine.h"
#include "can_sensor.h"
#include "can_vss.h"
#include "rusefi_wideband.h"
diff --git a/firmware/controllers/can/can_tx.cpp b/firmware/controllers/can/can_tx.cpp
index ce511de5f8..fe52f9a0be 100644
--- a/firmware/controllers/can/can_tx.cpp
+++ b/firmware/controllers/can/can_tx.cpp
@@ -7,10 +7,9 @@
* @author Matthew Kennedy, (c) 2020
*/
-#include "globalaccess.h"
-#if EFI_CAN_SUPPORT
+#include "pch.h"
-#include "engine.h"
+#if EFI_CAN_SUPPORT
#include "can.h"
#include "can_hw.h"
#include "can_dash.h"
diff --git a/firmware/controllers/can/can_verbose.cpp b/firmware/controllers/can/can_verbose.cpp
index ed38d7c54c..72f74c370b 100644
--- a/firmware/controllers/can/can_verbose.cpp
+++ b/firmware/controllers/can/can_verbose.cpp
@@ -6,16 +6,12 @@
* @author Matthew Kennedy, (c) 2020
*/
-#include "globalaccess.h"
+#include "pch.h"
#if EFI_CAN_SUPPORT
-#include "engine.h"
-
#include "scaled_channel.h"
#include "can_msg_tx.h"
-#include "sensor.h"
#include "can.h"
-#include "allsensors.h"
#include "fuel_math.h"
#include "spark_logic.h"
#include "vehicle_speed.h"
diff --git a/firmware/controllers/can/can_vss.cpp b/firmware/controllers/can/can_vss.cpp
index 63b0f12849..f78acef429 100644
--- a/firmware/controllers/can/can_vss.cpp
+++ b/firmware/controllers/can/can_vss.cpp
@@ -7,11 +7,10 @@
* @author Alex Miculescu, (c) 2020
*/
-#include "globalaccess.h"
+#include "pch.h"
+
#if EFI_CAN_SUPPORT
#include "can.h"
-#include "engine_configuration.h"
-#include "engine.h"
#include "vehicle_speed.h"
#include "dynoview.h"
diff --git a/firmware/controllers/can/obd2.cpp b/firmware/controllers/can/obd2.cpp
index 416c104ddb..38b0ad47c3 100644
--- a/firmware/controllers/can/obd2.cpp
+++ b/firmware/controllers/can/obd2.cpp
@@ -21,19 +21,14 @@
* If not, see .
*/
-#include "global.h"
+#include "pch.h"
#if EFI_CAN_SUPPORT
#include "os_access.h"
-#include "engine.h"
#include "obd2.h"
#include "can.h"
#include "can_msg_tx.h"
#include "vehicle_speed.h"
-#include "map.h"
-#include "maf.h"
-#include "sensor.h"
-#include "engine_math.h"
#include "fuel_math.h"
#include "thermistors.h"
diff --git a/firmware/controllers/can/rusefi_wideband.cpp b/firmware/controllers/can/rusefi_wideband.cpp
index df72021a41..b1f13e1fbb 100644
--- a/firmware/controllers/can/rusefi_wideband.cpp
+++ b/firmware/controllers/can/rusefi_wideband.cpp
@@ -1,12 +1,10 @@
-#include "global.h"
+#include "pch.h"
#if EFI_WIDEBAND_FIRMWARE_UPDATE && EFI_CAN_SUPPORT
#include "ch.h"
#include "can_msg_tx.h"
#include "rusefi_wideband.h"
-#include "sensor.h"
-#include "engine.h"
// This file contains an array called build_wideband_noboot_bin
// This array contains the firmware image for the wideband contoller
diff --git a/firmware/controllers/core/error_handling.cpp b/firmware/controllers/core/error_handling.cpp
index f76675b84d..2376561e2f 100644
--- a/firmware/controllers/core/error_handling.cpp
+++ b/firmware/controllers/core/error_handling.cpp
@@ -5,9 +5,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "engine.h"
+#include "pch.h"
#include "os_access.h"
-#include "perf_trace.h"
static critical_msg_t warningBuffer;
static critical_msg_t criticalErrorMessageBuffer;
diff --git a/firmware/controllers/core/fsio_impl.cpp b/firmware/controllers/core/fsio_impl.cpp
index 30b9ef4e88..cc113dd8b0 100644
--- a/firmware/controllers/core/fsio_impl.cpp
+++ b/firmware/controllers/core/fsio_impl.cpp
@@ -11,10 +11,9 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "global.h"
+#include "pch.h"
+
#include "fsio_impl.h"
-#include "allsensors.h"
-#include "sensor.h"
#if EFI_PROD_CODE
@@ -25,10 +24,6 @@
#if EFI_FSIO
#include "os_access.h"
-#include "settings.h"
-#include "rpm_calculator.h"
-#include "efi_gpio.h"
-#include "pwm_generator_logic.h"
/**
* in case of zero frequency pin is operating as simple on/off. '1' for ON and '0' for OFF
@@ -177,9 +172,6 @@ FsioResult getEngineValue(le_action_e action DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if EFI_PROD_CODE
-#include "pin_repository.h"
-#include "pwm_generator_logic.h"
-
static void setFsioAnalogInputPin(const char *indexStr, const char *pinName) {
// todo: reduce code duplication between all "set pin methods"
int index = atoi(indexStr) - 1;
diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp
index c10bb3a495..3f9533573e 100644
--- a/firmware/controllers/engine_controller.cpp
+++ b/firmware/controllers/engine_controller.cpp
@@ -21,22 +21,18 @@
* If not, see .
*/
-#include "global.h"
+#include "pch.h"
+
#include "os_access.h"
#include "trigger_central.h"
-#include "engine_controller.h"
#include "fsio_core.h"
#include "fsio_impl.h"
#include "idle_thread.h"
#include "advance_map.h"
-#include "rpm_calculator.h"
#include "main_trigger_callback.h"
-#include "io_pins.h"
#include "flash_main.h"
#include "bench_test.h"
#include "os_util.h"
-#include "engine_math.h"
-#include "allsensors.h"
#include "electronic_throttle.h"
#include "map_averaging.h"
#include "high_pressure_fuel_pump.h"
@@ -46,12 +42,10 @@
#include "local_version_holder.h"
#include "alternator_controller.h"
#include "fuel_math.h"
-#include "settings.h"
#include "spark_logic.h"
#include "aux_valves.h"
#include "accelerometer.h"
#include "vvt.h"
-#include "perf_trace.h"
#include "boost_control.h"
#include "launch_control.h"
#include "tachometer.h"
@@ -89,12 +83,10 @@
#endif /* EFI_UNIT_TEST */
#include "adc_inputs.h"
-#include "pwm_generator_logic.h"
#if EFI_PROD_CODE
#include "pwm_tester.h"
#include "lcd_controller.h"
-#include "pin_repository.h"
#endif /* EFI_PROD_CODE */
#if EFI_CJ125
diff --git a/firmware/controllers/engine_controller_misc.cpp b/firmware/controllers/engine_controller_misc.cpp
index 4e6e690405..e70a035c6f 100644
--- a/firmware/controllers/engine_controller_misc.cpp
+++ b/firmware/controllers/engine_controller_misc.cpp
@@ -5,10 +5,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "engine_controller.h"
-#include "perf_trace.h"
+#include "pch.h"
#include "os_access.h"
-#include "settings.h"
extern ButtonDebounce startStopButtonDebounce;
diff --git a/firmware/controllers/engine_cycle/aux_valves.cpp b/firmware/controllers/engine_cycle/aux_valves.cpp
index 1cf3c01bef..4f50ce54eb 100644
--- a/firmware/controllers/engine_cycle/aux_valves.cpp
+++ b/firmware/controllers/engine_cycle/aux_valves.cpp
@@ -13,11 +13,9 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "pin_repository.h"
-#include "engine_math.h"
+#include "pch.h"
+
#include "aux_valves.h"
-#include "allsensors.h"
-#include "sensor.h"
#include "trigger_central.h"
#include "spark_logic.h"
diff --git a/firmware/controllers/engine_cycle/fuel_schedule.cpp b/firmware/controllers/engine_cycle/fuel_schedule.cpp
index 4a72c25047..f79165ac15 100644
--- a/firmware/controllers/engine_cycle/fuel_schedule.cpp
+++ b/firmware/controllers/engine_cycle/fuel_schedule.cpp
@@ -4,9 +4,7 @@
* Handles injection scheduling
*/
-#include "global.h"
-#include "engine.h"
-#include "engine_math.h"
+#include "pch.h"
#include "event_registry.h"
#if EFI_ENGINE_CONTROL
diff --git a/firmware/controllers/engine_cycle/knock_logic.cpp b/firmware/controllers/engine_cycle/knock_logic.cpp
index 4597bfcc60..488f842e90 100644
--- a/firmware/controllers/engine_cycle/knock_logic.cpp
+++ b/firmware/controllers/engine_cycle/knock_logic.cpp
@@ -5,7 +5,7 @@
* @author Andrey Gusakov
*/
-#include "engine.h"
+#include "pch.h"
#include "knock_logic.h"
#include "os_access.h"
diff --git a/firmware/controllers/engine_cycle/main_trigger_callback.cpp b/firmware/controllers/engine_cycle/main_trigger_callback.cpp
index 1c6a71e20e..a63217c8da 100644
--- a/firmware/controllers/engine_cycle/main_trigger_callback.cpp
+++ b/firmware/controllers/engine_cycle/main_trigger_callback.cpp
@@ -21,7 +21,8 @@
* If not, see .
*/
-#include "global.h"
+#include "pch.h"
+
#include "os_access.h"
#if EFI_PRINTF_FUEL_DETAILS
@@ -31,27 +32,16 @@
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
#include "main_trigger_callback.h"
-#include "efi_gpio.h"
-#include "engine_math.h"
#include "trigger_central.h"
#include "spark_logic.h"
-#include "rpm_calculator.h"
-#include "engine_configuration.h"
-#include "interpolation.h"
#include "advance_map.h"
-#include "allsensors.h"
#include "cyclic_buffer.h"
#include "fuel_math.h"
#include "cdm_ion_sense.h"
-#include "engine_controller.h"
-#include "efi_gpio.h"
#include "tooth_logger.h"
#include "os_util.h"
#include "local_version_holder.h"
#include "event_queue.h"
-#include "engine.h"
-#include "perf_trace.h"
-#include "sensor.h"
#include "injector_model.h"
#if EFI_LAUNCH_CONTROL
#include "launch_control.h"
diff --git a/firmware/controllers/engine_cycle/map_averaging.cpp b/firmware/controllers/engine_cycle/map_averaging.cpp
index 47b1f3a990..71cd804a40 100644
--- a/firmware/controllers/engine_cycle/map_averaging.cpp
+++ b/firmware/controllers/engine_cycle/map_averaging.cpp
@@ -21,22 +21,15 @@
* If not, see .
*/
-#include "global.h"
-#include "os_access.h"
+#include "pch.h"
-#include "map.h"
+#include "os_access.h"
#if EFI_MAP_AVERAGING
#include "map_averaging.h"
#include "trigger_central.h"
#include "adc_inputs.h"
-#include "allsensors.h"
-#include "engine_configuration.h"
-#include "interpolation.h"
-#include "engine.h"
-#include "engine_math.h"
-#include "perf_trace.h"
#if EFI_SENSOR_CHART
#include "sensor_chart.h"
diff --git a/firmware/controllers/engine_cycle/rpm_calculator.cpp b/firmware/controllers/engine_cycle/rpm_calculator.cpp
index 778dc539bd..66294b399a 100644
--- a/firmware/controllers/engine_cycle/rpm_calculator.cpp
+++ b/firmware/controllers/engine_cycle/rpm_calculator.cpp
@@ -13,15 +13,10 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "globalaccess.h"
+#include "pch.h"
#include "os_access.h"
-#include "engine.h"
-#include "rpm_calculator.h"
#include "trigger_central.h"
-#include "engine_configuration.h"
-#include "engine_math.h"
-#include "perf_trace.h"
#include "tooth_logger.h"
#if EFI_PROD_CODE
diff --git a/firmware/controllers/engine_cycle/spark_logic.cpp b/firmware/controllers/engine_cycle/spark_logic.cpp
index 260d3fab93..02001940e1 100644
--- a/firmware/controllers/engine_cycle/spark_logic.cpp
+++ b/firmware/controllers/engine_cycle/spark_logic.cpp
@@ -5,25 +5,20 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
+#include "pch.h"
+
#include "software_knock.h"
#include "spark_logic.h"
#include "os_access.h"
-#include "engine_math.h"
#include "utlist.h"
#include "event_queue.h"
-#include "perf_trace.h"
#include "tooth_logger.h"
#include "hip9011.h"
-#include "engine_ptr.h"
#if EFI_ENGINE_CONTROL
-#if EFI_TUNER_STUDIO
-#include "tunerstudio_outputs.h"
-#endif /* EFI_TUNER_STUDIO */
-
#if EFI_UNIT_TEST
extern bool verboseMode;
#endif /* EFI_UNIT_TEST */
diff --git a/firmware/controllers/flash_main.cpp b/firmware/controllers/flash_main.cpp
index 0825725369..79a449a661 100644
--- a/firmware/controllers/flash_main.cpp
+++ b/firmware/controllers/flash_main.cpp
@@ -7,14 +7,14 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "global.h"
+#include "pch.h"
+
#if EFI_INTERNAL_FLASH
#include "os_access.h"
#include "flash_main.h"
#include "eficonsole.h"
#include "flash_int.h"
-#include "engine_math.h"
#if EFI_TUNER_STUDIO
#include "tunerstudio.h"
@@ -22,8 +22,6 @@
#include "runtime_state.h"
-#include "engine_controller.h"
-
static bool needToWriteConfiguration = false;
extern persistent_config_container_s persistentState;
diff --git a/firmware/controllers/gauges/lcd_controller.cpp b/firmware/controllers/gauges/lcd_controller.cpp
index 7fe09ac6eb..cea4e1e350 100644
--- a/firmware/controllers/gauges/lcd_controller.cpp
+++ b/firmware/controllers/gauges/lcd_controller.cpp
@@ -16,19 +16,14 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "global.h"
+#include "pch.h"
#if EFI_HD44780_LCD
#include "os_access.h"
#include "lcd_controller.h"
#include "HD44780.h"
-#include "rpm_calculator.h"
-#include "allsensors.h"
-#include "engine.h"
#include "rtc_helper.h"
-#include "io_pins.h"
-#include "efi_gpio.h"
#include "svnversion.h"
#include "joystick.h"
#include "utlist.h"
@@ -36,12 +31,9 @@
#include "memstreams.h"
#include "settings.h"
#include "bench_test.h"
-#include "engine_controller.h"
#include "mmc_card.h"
#include "idle_thread.h"
#include "fuel_math.h"
-#include "sensor.h"
-
static MenuItem ROOT(NULL, NULL);
diff --git a/firmware/controllers/gauges/lcd_menu_tree.cpp b/firmware/controllers/gauges/lcd_menu_tree.cpp
index 2f6c10ace1..5c103864ad 100644
--- a/firmware/controllers/gauges/lcd_menu_tree.cpp
+++ b/firmware/controllers/gauges/lcd_menu_tree.cpp
@@ -5,9 +5,10 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
+#include "pch.h"
+
#include "stddef.h"
#include "lcd_menu_tree.h"
-#include "error_handling.h"
MenuTree::MenuTree(MenuItem *root) {
this->root = root;
diff --git a/firmware/controllers/gauges/malfunction_indicator.cpp b/firmware/controllers/gauges/malfunction_indicator.cpp
index 65dfc05cee..d5cb7a521e 100644
--- a/firmware/controllers/gauges/malfunction_indicator.cpp
+++ b/firmware/controllers/gauges/malfunction_indicator.cpp
@@ -25,13 +25,11 @@
* If not, see .
*/
-#include "global.h"
+#include "pch.h"
#if EFI_MALFUNCTION_INDICATOR
-#include "io_pins.h"
#include "malfunction_central.h"
#include "malfunction_indicator.h"
-#include "efi_gpio.h"
#include "os_access.h"
#include "periodic_thread_controller.h"
diff --git a/firmware/controllers/gauges/tachometer.cpp b/firmware/controllers/gauges/tachometer.cpp
index f6f3c49359..0aa20655ac 100644
--- a/firmware/controllers/gauges/tachometer.cpp
+++ b/firmware/controllers/gauges/tachometer.cpp
@@ -8,9 +8,9 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "pin_repository.h"
+#include "pch.h"
+
#include "tachometer.h"
-#include "pwm_generator_logic.h"
static SimplePwm tachControl("tach");
static float tachFreq;
diff --git a/firmware/controllers/gear_controller.cpp b/firmware/controllers/gear_controller.cpp
index 0bd2f258c1..b3f551d0a3 100644
--- a/firmware/controllers/gear_controller.cpp
+++ b/firmware/controllers/gear_controller.cpp
@@ -1,5 +1,6 @@
+#include "pch.h"
+
#include "gear_controller.h"
-#include "tunerstudio_outputs.h"
void GearControllerBase::init(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
INJECT_ENGINE_REFERENCE(&transmissionController);
diff --git a/firmware/controllers/limp_manager.cpp b/firmware/controllers/limp_manager.cpp
index 1a824e969c..ecbc1588ab 100644
--- a/firmware/controllers/limp_manager.cpp
+++ b/firmware/controllers/limp_manager.cpp
@@ -1,6 +1,6 @@
+#include "pch.h"
+
#include "limp_manager.h"
-#include "engine.h"
-#include "efilib.h"
void LimpManager::updateState(int rpm, efitick_t nowNt) {
Clearable allowFuel = CONFIG(isInjectionEnabled);
diff --git a/firmware/controllers/lua/lua.cpp b/firmware/controllers/lua/lua.cpp
index 95deec1bf2..d989893175 100644
--- a/firmware/controllers/lua/lua.cpp
+++ b/firmware/controllers/lua/lua.cpp
@@ -1,7 +1,7 @@
+#include "pch.h"
#include "rusefi_lua.h"
#include "thread_controller.h"
-#include "perf_trace.h"
#include "thread_priority.h"
#if EFI_LUA
@@ -13,8 +13,6 @@
#if EFI_PROD_CODE || EFI_SIMULATOR
#include "ch.h"
-#include "engine.h"
-#include "tunerstudio_outputs.h"
#define LUA_HEAP_SIZE 20000
diff --git a/firmware/controllers/lua/lua_hooks.cpp b/firmware/controllers/lua/lua_hooks.cpp
index 4d8d221f17..5e6bb893df 100644
--- a/firmware/controllers/lua/lua_hooks.cpp
+++ b/firmware/controllers/lua/lua_hooks.cpp
@@ -1,16 +1,13 @@
+#include "pch.h"
+
#include "lua.hpp"
#include "lua_hooks.h"
-#include "engine.h"
#include "loggingcentral.h"
-#include "sensor.h"
#include "adc_inputs.h"
-#include "efilib.h"
-#include "tunerstudio_outputs.h"
#include "fuel_math.h"
#include "airmass.h"
#include "lua_airmass.h"
-#include "pwm_generator_logic.h"
#include "can_msg_tx.h"
// Some functions lean on existing FSIO implementation
diff --git a/firmware/controllers/math/closed_loop_fuel.cpp b/firmware/controllers/math/closed_loop_fuel.cpp
index 691144daa6..66bbcbd1a6 100644
--- a/firmware/controllers/math/closed_loop_fuel.cpp
+++ b/firmware/controllers/math/closed_loop_fuel.cpp
@@ -1,10 +1,7 @@
+#include "pch.h"
+
#include "closed_loop_fuel.h"
#include "closed_loop_fuel_cell.h"
-
-#include "engine.h"
-
-#include "sensor.h"
-#include "engine_math.h"
#include "deadband.h"
struct FuelingBank {
diff --git a/firmware/controllers/math/closed_loop_fuel_cell.cpp b/firmware/controllers/math/closed_loop_fuel_cell.cpp
index 43aba9197d..c820aa71aa 100644
--- a/firmware/controllers/math/closed_loop_fuel_cell.cpp
+++ b/firmware/controllers/math/closed_loop_fuel_cell.cpp
@@ -1,7 +1,6 @@
+#include "pch.h"
+
#include "closed_loop_fuel_cell.h"
-#include "engine.h"
-#include "engine_configuration_generated_structures.h"
-#include "sensor.h"
constexpr float integrator_dt = FAST_CALLBACK_PERIOD_MS * 0.001f;
diff --git a/firmware/controllers/math/engine_math.cpp b/firmware/controllers/math/engine_math.cpp
index c87f6cde2c..27c7eb7dd8 100644
--- a/firmware/controllers/math/engine_math.cpp
+++ b/firmware/controllers/math/engine_math.cpp
@@ -19,14 +19,9 @@
* If not, see .
*/
-#include "global.h"
-#include "engine_math.h"
-#include "engine_configuration.h"
-#include "interpolation.h"
-#include "allsensors.h"
-#include "sensor.h"
+#include "pch.h"
+
#include "event_registry.h"
-#include "efi_gpio.h"
#include "fuel_math.h"
#include "advance_map.h"
diff --git a/firmware/controllers/math/speed_density.cpp b/firmware/controllers/math/speed_density.cpp
index 2033f3b4e1..f564b86b01 100644
--- a/firmware/controllers/math/speed_density.cpp
+++ b/firmware/controllers/math/speed_density.cpp
@@ -7,15 +7,9 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "global.h"
+#include "pch.h"
#include "speed_density.h"
#include "fuel_math.h"
-#include "interpolation.h"
-#include "engine.h"
-#include "engine_math.h"
-#include "perf_trace.h"
-#include "sensor.h"
-#include "map.h"
#if defined(HAS_OS_ACCESS)
#error "Unexpected OS ACCESS HERE"
diff --git a/firmware/controllers/persistent_store.cpp b/firmware/controllers/persistent_store.cpp
index fb2236de5a..dacc27a45c 100644
--- a/firmware/controllers/persistent_store.cpp
+++ b/firmware/controllers/persistent_store.cpp
@@ -21,12 +21,11 @@
* If not, see .
*/
-#include "global.h"
+#include "pch.h"
+
#if !EFI_UNIT_TEST
#include "sensor_chart.h"
-#include "engine_configuration.h"
#include "trigger_central.h"
-#include "engine_controller.h"
persistent_config_container_s persistentState CCM_OPTIONAL;
diff --git a/firmware/controllers/sensors/AemXSeriesLambda.cpp b/firmware/controllers/sensors/AemXSeriesLambda.cpp
index 87245ff8ae..54e2aae123 100644
--- a/firmware/controllers/sensors/AemXSeriesLambda.cpp
+++ b/firmware/controllers/sensors/AemXSeriesLambda.cpp
@@ -1,13 +1,7 @@
-#include "global.h"
+#include "pch.h"
#if EFI_CAN_SUPPORT
#include "AemXSeriesLambda.h"
-#include "efilib.h"
-
-#if EFI_TUNER_STUDIO
-#include "tunerstudio_outputs.h"
-#include "engine.h"
-#endif
AemXSeriesWideband::AemXSeriesWideband(uint8_t sensorIndex, SensorType type)
: CanSensorBase(
diff --git a/firmware/controllers/sensors/allsensors.cpp b/firmware/controllers/sensors/allsensors.cpp
index 6bacf683ff..ef8a7113b4 100644
--- a/firmware/controllers/sensors/allsensors.cpp
+++ b/firmware/controllers/sensors/allsensors.cpp
@@ -7,9 +7,7 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "engine.h"
-#include "pin_repository.h"
-#include "allsensors.h"
+#include "pch.h"
ButtonDebounce acDebounce("ac_switch");
diff --git a/firmware/controllers/sensors/ego.cpp b/firmware/controllers/sensors/ego.cpp
index d88ef3dcee..1b4aa2cc57 100644
--- a/firmware/controllers/sensors/ego.cpp
+++ b/firmware/controllers/sensors/ego.cpp
@@ -11,9 +11,9 @@
* 3) CJ125 internal wideband controller is known to work with both 4.2 and 4.9
*
*/
+#include "pch.h"
+
#include "ego.h"
-#include "interpolation.h"
-#include "engine.h"
#include "adc_inputs.h"
#include "cyclic_buffer.h"
diff --git a/firmware/controllers/sensors/flex_sensor.cpp b/firmware/controllers/sensors/flex_sensor.cpp
index a63dca5b14..74e02788f6 100644
--- a/firmware/controllers/sensors/flex_sensor.cpp
+++ b/firmware/controllers/sensors/flex_sensor.cpp
@@ -1,4 +1,5 @@
-#include "engine.h"
+#include "pch.h"
+
#include "digital_input_exti.h"
#include "flex_sensor.h"
diff --git a/firmware/controllers/sensors/maf.cpp b/firmware/controllers/sensors/maf.cpp
index d0ea2643aa..6d7327c037 100644
--- a/firmware/controllers/sensors/maf.cpp
+++ b/firmware/controllers/sensors/maf.cpp
@@ -1,6 +1,4 @@
-#include "global.h"
-#include "engine.h"
-#include "maf.h"
+#include "pch.h"
static void fillTheRest(persistent_config_s *e, int i) {
/**
diff --git a/firmware/controllers/sensors/map.cpp b/firmware/controllers/sensors/map.cpp
index 36a20fa52a..efbc0850ac 100644
--- a/firmware/controllers/sensors/map.cpp
+++ b/firmware/controllers/sensors/map.cpp
@@ -5,19 +5,13 @@
*
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "global.h"
-#include "engine_configuration.h"
-#include "engine_math.h"
+#include "pch.h"
+
#include "adc_inputs.h"
-#include "interpolation.h"
-#include "map.h"
-#include "engine_controller.h"
-#include "sensor.h"
#if EFI_PROD_CODE
#include "digital_input_icu.h"
#include "digital_input_exti.h"
-#include "pin_repository.h"
#endif
#if EFI_ANALOG_SENSORS
diff --git a/firmware/controllers/sensors/sensor.cpp b/firmware/controllers/sensors/sensor.cpp
index fbceb2482d..d654dd6efa 100644
--- a/firmware/controllers/sensors/sensor.cpp
+++ b/firmware/controllers/sensors/sensor.cpp
@@ -1,6 +1,5 @@
-#include "global.h"
-#include "sensor.h"
-#include "efilib.h"
+#include "pch.h"
+
#include "loggingcentral.h"
static const char* const s_sensorNames[] = {
diff --git a/firmware/controllers/sensors/software_knock.cpp b/firmware/controllers/sensors/software_knock.cpp
index 1d814fc62d..a67a8b9e19 100644
--- a/firmware/controllers/sensors/software_knock.cpp
+++ b/firmware/controllers/sensors/software_knock.cpp
@@ -1,7 +1,6 @@
-#include "global.h"
-#include "engine.h"
+#include "pch.h"
+
#include "biquad.h"
-#include "perf_trace.h"
#include "thread_controller.h"
#include "knock_logic.h"
#include "software_knock.h"
diff --git a/firmware/controllers/sensors/thermistors.cpp b/firmware/controllers/sensors/thermistors.cpp
index b837abb4fb..26f3df559a 100644
--- a/firmware/controllers/sensors/thermistors.cpp
+++ b/firmware/controllers/sensors/thermistors.cpp
@@ -10,10 +10,9 @@
* http://en.wikipedia.org/wiki/Steinhart%E2%80%93Hart_equation
*/
-#include "global.h"
+#include "pch.h"
+
#include "thermistors.h"
-#include "engine_configuration.h"
-#include "engine_math.h"
void setDodgeSensor(ThermistorConf *thermistorConf, float pullup) {
thermistorConf->config = {-40, 30, 120, 336660, 7550, 390, pullup};
diff --git a/firmware/controllers/sensors/tps.cpp b/firmware/controllers/sensors/tps.cpp
index 6b5433da63..8e0ac5407c 100644
--- a/firmware/controllers/sensors/tps.cpp
+++ b/firmware/controllers/sensors/tps.cpp
@@ -1,12 +1,7 @@
/**
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "engine.h"
-#include "tps.h"
-#include "sensor.h"
-#if EFI_PROD_CODE
-#include "settings.h"
-#endif /* EFI_PROD_CODE */
+#include "pch.h"
void grabTPSIsClosed() {
#if EFI_PROD_CODE
diff --git a/firmware/controllers/serial/serial_rx.cpp b/firmware/controllers/serial/serial_rx.cpp
index 6e13362366..45890e3b81 100644
--- a/firmware/controllers/serial/serial_rx.cpp
+++ b/firmware/controllers/serial/serial_rx.cpp
@@ -7,15 +7,13 @@
* @author Konstantin Smola, (c) 2020
*/
-#include "globalaccess.h"
+#include "pch.h"
#if EFI_AUX_SERIAL
-#include "engine.h"
#include "serial.h"
#include "serial_hw.h"
#include "serial_sensor.h"
-#include "allsensors.h"
#include "vehicle_speed.h"
#include "thread_priority.h"
diff --git a/firmware/controllers/serial/serial_sensor.cpp b/firmware/controllers/serial/serial_sensor.cpp
index f3c51ee231..6cc03df26d 100644
--- a/firmware/controllers/serial/serial_sensor.cpp
+++ b/firmware/controllers/serial/serial_sensor.cpp
@@ -6,11 +6,11 @@
* @author Konstantin Smola, (c) 2020
*/
-#include "global.h"
+#include "pch.h"
+
#if EFI_AUX_SERIAL
#include "serial.h"
#include "serial_sensor.h"
-#include "engine.h"
#define NUM_INNOVATE_O2_SENSORS 1
#define AFR_MULTIPLIER 147
diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp
index 5d9b460c95..90d7d11660 100644
--- a/firmware/controllers/settings.cpp
+++ b/firmware/controllers/settings.cpp
@@ -6,36 +6,26 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "global.h"
-#include "engine_configuration.h"
-#include "engine_math.h"
+#include "pch.h"
#if !EFI_UNIT_TEST
#include "os_access.h"
-#include "settings.h"
#include "eficonsole.h"
#include "adc_inputs.h"
-#include "engine_controller.h"
#include "thermistors.h"
#include "adc_inputs.h"
-#include "interpolation.h"
-#include "map.h"
#include "trigger_decoder.h"
#include "console_io.h"
-#include "engine.h"
-#include "efi_gpio.h"
#include "idle_thread.h"
#include "allsensors.h"
#include "alternator_controller.h"
#include "trigger_emulator_algo.h"
-#include "sensor.h"
#if EFI_PROD_CODE
#include "vehicle_speed.h"
#include "rtc_helper.h"
#include "can_hw.h"
#include "rusefi.h"
-#include "pin_repository.h"
#include "hardware.h"
#endif /* EFI_PROD_CODE */
diff --git a/firmware/controllers/simple_tcu.cpp b/firmware/controllers/simple_tcu.cpp
index 813604110b..a77fe2877a 100644
--- a/firmware/controllers/simple_tcu.cpp
+++ b/firmware/controllers/simple_tcu.cpp
@@ -1,7 +1,6 @@
+#include "pch.h"
+
#include "simple_tcu.h"
-#include "efi_gpio.h"
-#include "tunerstudio_outputs.h"
-#include "engine_configuration.h"
void SimpleTransmissionController::init() {
for (size_t i = 0; i < efi::size(CONFIG(tcu_solenoid)); i++) {
diff --git a/firmware/controllers/start_stop.cpp b/firmware/controllers/start_stop.cpp
index 1b9fdba554..8ff5650de2 100644
--- a/firmware/controllers/start_stop.cpp
+++ b/firmware/controllers/start_stop.cpp
@@ -1,5 +1,6 @@
+#include "pch.h"
+
#include "start_stop.h"
-#include "engine.h"
ButtonDebounce startStopButtonDebounce("start_button");
diff --git a/firmware/controllers/system/dc_motor.cpp b/firmware/controllers/system/dc_motor.cpp
index e3780161f7..02469537b5 100644
--- a/firmware/controllers/system/dc_motor.cpp
+++ b/firmware/controllers/system/dc_motor.cpp
@@ -6,9 +6,9 @@
* @author Matthew Kennedy
*/
+#include "pch.h"
+
#include "dc_motor.h"
-#include "efi_gpio.h"
-#include "pwm_generator_logic.h"
TwoPinDcMotor::TwoPinDcMotor(OutputPin& disablePin)
: m_disable(&disablePin)
diff --git a/firmware/controllers/system/efi_gpio.cpp b/firmware/controllers/system/efi_gpio.cpp
index 17ef1f54e4..de33736c9f 100644
--- a/firmware/controllers/system/efi_gpio.cpp
+++ b/firmware/controllers/system/efi_gpio.cpp
@@ -6,18 +6,10 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "global.h"
-#include "engine.h"
-#include "efi_gpio.h"
+#include "pch.h"
+
#include "os_access.h"
#include "drivers/gpio/gpio_ext.h"
-#include "perf_trace.h"
-#include "engine_controller.h"
-
-#if EFI_GPIO_HARDWARE
-#include "pin_repository.h"
-#include "io_pins.h"
-#endif /* EFI_GPIO_HARDWARE */
#if EFI_ELECTRONIC_THROTTLE_BODY
#include "electronic_throttle.h"
diff --git a/firmware/controllers/system/timer/pwm_generator_logic.cpp b/firmware/controllers/system/timer/pwm_generator_logic.cpp
index f622c943cd..e59ab8f081 100644
--- a/firmware/controllers/system/timer/pwm_generator_logic.cpp
+++ b/firmware/controllers/system/timer/pwm_generator_logic.cpp
@@ -8,14 +8,11 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "global.h"
+#include "pch.h"
#include "os_access.h"
-#include "pwm_generator_logic.h"
-#include "perf_trace.h"
#if EFI_PROD_CODE
#include "mpu_util.h"
-#include "engine.h"
#endif // EFI_PROD_CODE
// 1% duty cycle
diff --git a/firmware/controllers/system/timer/signal_executor_sleep.cpp b/firmware/controllers/system/timer/signal_executor_sleep.cpp
index 9b1a2f82ed..c77e263644 100644
--- a/firmware/controllers/system/timer/signal_executor_sleep.cpp
+++ b/firmware/controllers/system/timer/signal_executor_sleep.cpp
@@ -22,16 +22,11 @@
* If not, see .
*/
-#include "global.h"
+#include "pch.h"
#include "os_access.h"
#include "scheduler.h"
#include "main_trigger_callback.h"
-#if EFI_SIMULATOR
-// this is about debugging
-#include "efi_gpio.h"
-#endif /* EFI_SIMULATOR */
-
#if EFI_PRINTF_FUEL_DETAILS
bool printSchedulerDebug = true;
#endif // EFI_PRINTF_FUEL_DETAILS
diff --git a/firmware/controllers/system/timer/single_timer_executor.cpp b/firmware/controllers/system/timer/single_timer_executor.cpp
index 69a43b5651..6e5298529e 100644
--- a/firmware/controllers/system/timer/single_timer_executor.cpp
+++ b/firmware/controllers/system/timer/single_timer_executor.cpp
@@ -20,19 +20,17 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "global.h"
+#include "pch.h"
+
#include "os_access.h"
#include "single_timer_executor.h"
#include "efitime.h"
-#include "perf_trace.h"
#if EFI_SIGNAL_EXECUTOR_ONE_TIMER
#include "microsecond_timer.h"
-#include "tunerstudio_outputs.h"
#include "os_util.h"
-#include "engine.h"
uint32_t hwSetTimerDuration;
void globalTimerCallback() {
diff --git a/firmware/controllers/tcu.cpp b/firmware/controllers/tcu.cpp
index 0af00c45c5..f416016e13 100644
--- a/firmware/controllers/tcu.cpp
+++ b/firmware/controllers/tcu.cpp
@@ -6,8 +6,9 @@
* @author David Holdeman, (c) 2020
*/
+#include "pch.h"
+
#include "tcu.h"
-#include "tunerstudio_outputs.h"
void TransmissionControllerBase::update(gear_e gear) {
setCurrentGear(gear);
diff --git a/firmware/controllers/trigger/decoders/trigger_mazda.cpp b/firmware/controllers/trigger/decoders/trigger_mazda.cpp
index b145dcc4b8..a6a7f37951 100644
--- a/firmware/controllers/trigger/decoders/trigger_mazda.cpp
+++ b/firmware/controllers/trigger/decoders/trigger_mazda.cpp
@@ -18,8 +18,9 @@
* If not, see .
*/
+#include "pch.h"
+
#include "trigger_mazda.h"
-#include "error_handling.h"
#define NB_CRANK_MAGIC 70
diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp
index 1f43828b82..d7d54efe39 100644
--- a/firmware/controllers/trigger/decoders/trigger_structure.cpp
+++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp
@@ -19,9 +19,9 @@
*/
-#include "global.h"
+#include "pch.h"
+
#include "os_access.h"
-#include "engine.h"
#include "trigger_chrysler.h"
#include "trigger_gm.h"
#include "trigger_nissan.h"
@@ -41,9 +41,6 @@
#include "sensor_chart.h"
#endif /* EFI_SENSOR_CHART */
-#include "engine_configuration.h"
- extern persistent_config_container_s persistentState;
-
void event_trigger_position_s::setAngle(angle_t angle DECLARE_ENGINE_PARAMETER_SUFFIX) {
findTriggerPosition(&ENGINE(triggerCentral.triggerShape),
&ENGINE(triggerCentral.triggerFormDetails),
diff --git a/firmware/controllers/trigger/decoders/trigger_universal.cpp b/firmware/controllers/trigger/decoders/trigger_universal.cpp
index 5a3aec72ef..e20eb18d39 100644
--- a/firmware/controllers/trigger/decoders/trigger_universal.cpp
+++ b/firmware/controllers/trigger/decoders/trigger_universal.cpp
@@ -5,8 +5,9 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
+#include "pch.h"
+
#include "trigger_universal.h"
-#include "error_handling.h"
/**
* @see getCycleDuration
diff --git a/firmware/controllers/trigger/decoders/trigger_vw.cpp b/firmware/controllers/trigger/decoders/trigger_vw.cpp
index 13eace7fe6..58cd6cf4a3 100644
--- a/firmware/controllers/trigger/decoders/trigger_vw.cpp
+++ b/firmware/controllers/trigger/decoders/trigger_vw.cpp
@@ -5,9 +5,9 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
+#include "pch.h"
#include "trigger_vw.h"
#include "trigger_universal.h"
-#include "error_handling.h"
void setSkodaFavorit(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CRANK_SENSOR);
diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp
index a7cd1b866f..1a7fafd8f3 100644
--- a/firmware/controllers/trigger/trigger_central.cpp
+++ b/firmware/controllers/trigger/trigger_central.cpp
@@ -6,36 +6,25 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "global.h"
+#include "pch.h"
#include "os_access.h"
#include "trigger_central.h"
#include "trigger_decoder.h"
#include "main_trigger_callback.h"
-#include "engine_configuration.h"
#include "listener_array.h"
-#include "pwm_generator_logic.h"
#include "tooth_logger.h"
#include "hip9011.h"
#include "logic_analyzer.h"
-#include "settings.h"
-#include "engine_math.h"
#include "local_version_holder.h"
#include "trigger_simulator.h"
#include "trigger_emulator_algo.h"
-#include "rpm_calculator.h"
#include "tooth_logger.h"
-#include "perf_trace.h"
#include "map_averaging.h"
#include "main_trigger_callback.h"
-
-#if EFI_PROD_CODE
-#include "pin_repository.h"
-#endif /* EFI_PROD_CODE */
-
#if EFI_TUNER_STUDIO
#include "tunerstudio.h"
#endif /* EFI_TUNER_STUDIO */
diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp
index bc9cc27139..e05afd6e5b 100644
--- a/firmware/controllers/trigger/trigger_decoder.cpp
+++ b/firmware/controllers/trigger/trigger_decoder.cpp
@@ -24,18 +24,15 @@
* If not, see .
*/
-#include "global.h"
+#include "pch.h"
+
#include "os_access.h"
#include "obd_error_codes.h"
#include "trigger_decoder.h"
#include "cyclic_buffer.h"
-#include "efi_gpio.h"
-#include "engine.h"
-#include "engine_math.h"
#include "trigger_central.h"
#include "trigger_simulator.h"
-#include "perf_trace.h"
#if EFI_SENSOR_CHART
#include "sensor_chart.h"
diff --git a/firmware/controllers/trigger/trigger_emulator_algo.cpp b/firmware/controllers/trigger/trigger_emulator_algo.cpp
index 4dfe57c72e..bba98cb046 100644
--- a/firmware/controllers/trigger/trigger_emulator_algo.cpp
+++ b/firmware/controllers/trigger/trigger_emulator_algo.cpp
@@ -13,10 +13,8 @@
* @date Mar 3, 2014
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "state_sequence.h"
-#include "global.h"
-#include "efi_gpio.h"
-#include "pin_repository.h"
+
+#include "pch.h"
int getPreviousIndex(const int currentIndex, const int size) {
return (currentIndex + size - 1) % size;
@@ -32,13 +30,9 @@ bool needEvent(const int currentIndex, const int size, const MultiChannelStateSe
#if EFI_EMULATE_POSITION_SENSORS
-#include "engine.h"
#include "trigger_emulator_algo.h"
-#include "engine_configuration.h"
#include "trigger_central.h"
#include "trigger_simulator.h"
-#include "settings.h"
-#include "pwm_generator_logic.h"
TriggerEmulatorHelper::TriggerEmulatorHelper() {
}
diff --git a/firmware/controllers/trigger/trigger_simulator.cpp b/firmware/controllers/trigger/trigger_simulator.cpp
index 903b8cbae1..1b31961a7a 100644
--- a/firmware/controllers/trigger/trigger_simulator.cpp
+++ b/firmware/controllers/trigger/trigger_simulator.cpp
@@ -5,8 +5,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "global.h"
-#include "engine.h"
+#include "pch.h"
+
#include "trigger_simulator.h"
#include "trigger_emulator_algo.h"
diff --git a/firmware/development/perf_trace.cpp b/firmware/development/perf_trace.cpp
index a7bea6e020..f94cd23ff5 100644
--- a/firmware/development/perf_trace.cpp
+++ b/firmware/development/perf_trace.cpp
@@ -7,9 +7,8 @@
*/
-#include "efifeatures.h"
-#include "perf_trace.h"
-#include "efitime.h"
+#include "pch.h"
+
#include "os_util.h"
#ifndef ENABLE_PERF_TRACE
diff --git a/firmware/hw_layer/digital_input/digital_input_exti.cpp b/firmware/hw_layer/digital_input/digital_input_exti.cpp
index efa8c6b5f6..0082b12514 100644
--- a/firmware/hw_layer/digital_input/digital_input_exti.cpp
+++ b/firmware/hw_layer/digital_input/digital_input_exti.cpp
@@ -5,13 +5,10 @@
* @author Andrey Belomutskiy, (c) 2012-2021
*/
-#include "global.h"
+#include "pch.h"
#if HAL_USE_PAL && EFI_PROD_CODE
#include "digital_input_exti.h"
-#include "efi_gpio.h"
-#include "error_handling.h"
-#include "pin_repository.h"
/**
* EXTI is a funny thing: you can only use same pin on one port. For example, you can use
diff --git a/firmware/hw_layer/drivers/can/can_msg_tx.cpp b/firmware/hw_layer/drivers/can/can_msg_tx.cpp
index 2fd979f424..023d2e0849 100644
--- a/firmware/hw_layer/drivers/can/can_msg_tx.cpp
+++ b/firmware/hw_layer/drivers/can/can_msg_tx.cpp
@@ -7,13 +7,12 @@
* @author Matthew Kennedy, (c) 2012-2020
*/
-#include "efifeatures.h"
-#include "global.h"
+#include "pch.h"
+
#include "can_msg_tx.h"
#if EFI_CAN_SUPPORT
#include "can.h"
-#include "engine_configuration.h"
extern int canWriteOk;
extern int canWriteNotOk;
diff --git a/firmware/hw_layer/drivers/i2c/i2c_bb.cpp b/firmware/hw_layer/drivers/i2c/i2c_bb.cpp
index 25512831a9..79c4e5de5e 100644
--- a/firmware/hw_layer/drivers/i2c/i2c_bb.cpp
+++ b/firmware/hw_layer/drivers/i2c/i2c_bb.cpp
@@ -6,11 +6,9 @@
* @author Matthew Kennedy, (c) 2020
*/
-#include "i2c_bb.h"
+#include "pch.h"
-#include "io_pins.h"
-#include "efi_gpio.h"
-#include "pin_repository.h"
+#include "i2c_bb.h"
void BitbangI2c::sda_high() {
#if EFI_PROD_CODE
diff --git a/firmware/hw_layer/io_pins.cpp b/firmware/hw_layer/io_pins.cpp
index 809c0c22ac..e35667ad9b 100644
--- a/firmware/hw_layer/io_pins.cpp
+++ b/firmware/hw_layer/io_pins.cpp
@@ -7,11 +7,7 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "global.h"
-#include "io_pins.h"
-#include "efi_gpio.h"
-#include "engine.h"
-#include "pin_repository.h"
+#include "pch.h"
#if EFI_PROD_CODE
#include "os_access.h"
diff --git a/firmware/hw_layer/mc33816.cpp b/firmware/hw_layer/mc33816.cpp
index c3f5356ce5..2161d064c9 100644
--- a/firmware/hw_layer/mc33816.cpp
+++ b/firmware/hw_layer/mc33816.cpp
@@ -14,19 +14,15 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "global.h"
+#include "pch.h"
#if EFI_MC33816
#include "mc33816.h"
#include "mc33816_memory_map.h"
-#include "engine.h"
-#include "efi_gpio.h"
-#include "pin_repository.h"
#include "hardware.h"
#include "mc33816_data.h"
#include "mpu_util.h"
-#include "allsensors.h"
static bool isInitializaed = false;
diff --git a/firmware/hw_layer/ports/stm32/stm32_adc_v2.cpp b/firmware/hw_layer/ports/stm32/stm32_adc_v2.cpp
index 5f9a567db7..d6b4cd7449 100644
--- a/firmware/hw_layer/ports/stm32/stm32_adc_v2.cpp
+++ b/firmware/hw_layer/ports/stm32/stm32_adc_v2.cpp
@@ -6,8 +6,7 @@
* @author Matthew Kennedy, (c) 2021
*/
-#include "engine_ptr.h"
-#include "engine_configuration.h"
+#include "pch.h"
#if HAL_USE_ADC
diff --git a/firmware/hw_layer/ports/stm32/stm32_common.cpp b/firmware/hw_layer/ports/stm32/stm32_common.cpp
index 1d083665ca..330cb6c854 100644
--- a/firmware/hw_layer/ports/stm32/stm32_common.cpp
+++ b/firmware/hw_layer/ports/stm32/stm32_common.cpp
@@ -6,8 +6,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "engine_ptr.h"
-#include "efi_gpio.h"
+#include "pch.h"
+
#include "expected.h"
#include "hardware.h"
diff --git a/firmware/hw_layer/ports/stm32/stm32_pins.cpp b/firmware/hw_layer/ports/stm32/stm32_pins.cpp
index d140a60a14..81edf345f8 100644
--- a/firmware/hw_layer/ports/stm32/stm32_pins.cpp
+++ b/firmware/hw_layer/ports/stm32/stm32_pins.cpp
@@ -6,11 +6,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "global.h"
-#include "engine.h"
-#include "efi_gpio.h"
-#include "pin_repository.h"
-#include "io_pins.h"
+#include "pch.h"
+
#include "smart_gpio.h"
#if EFI_GPIO_HARDWARE
diff --git a/firmware/hw_layer/sensors/cj125.cpp b/firmware/hw_layer/sensors/cj125.cpp
index addeea621f..4204927cbc 100644
--- a/firmware/hw_layer/sensors/cj125.cpp
+++ b/firmware/hw_layer/sensors/cj125.cpp
@@ -14,10 +14,8 @@
*
*/
-#include "engine.h"
+#include "pch.h"
#include "cj125.h"
-#include "pwm_generator_logic.h"
-#include "rpm_calculator.h"
#include "thread_priority.h"
#if EFI_CJ125
@@ -33,7 +31,6 @@
#include "hardware.h"
#include "backup_ram.h"
-#include "pin_repository.h"
static CJ125 globalInstance;
diff --git a/firmware/hw_layer/sensors/cj125_logic.cpp b/firmware/hw_layer/sensors/cj125_logic.cpp
index 59c1aa53d4..dcf3070a86 100644
--- a/firmware/hw_layer/sensors/cj125_logic.cpp
+++ b/firmware/hw_layer/sensors/cj125_logic.cpp
@@ -5,9 +5,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
+#include "pch.h"
#include "cj125_logic.h"
-#include "engine.h"
-#include "error_handling.h"
#define LOW_VOLTAGE "Low Voltage"
diff --git a/firmware/hw_layer/smart_gpio.cpp b/firmware/hw_layer/smart_gpio.cpp
index 5537daee55..d6bc2afd4b 100644
--- a/firmware/hw_layer/smart_gpio.cpp
+++ b/firmware/hw_layer/smart_gpio.cpp
@@ -5,22 +5,18 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "global.h"
+#include "pch.h"
#if EFI_PROD_CODE
#include "smart_gpio.h"
-#include "efi_gpio.h"
-#include "engine_configuration.h"
#include "hardware.h"
#include "mpu_util.h"
#include "gpio_ext.h"
-#include "pin_repository.h"
#include "drivers/gpio/tle6240.h"
#include "drivers/gpio/mc33972.h"
#include "drivers/gpio/mc33810.h"
#include "drivers/gpio/tle8888.h"
#include "drivers/gpio/drv8860.h"
-#include "engine.h"
#if (BOARD_TLE6240_COUNT > 0)
// todo: migrate to TS or board config
diff --git a/firmware/hw_layer/stepper.cpp b/firmware/hw_layer/stepper.cpp
index 6438d51eb5..f3624792e4 100644
--- a/firmware/hw_layer/stepper.cpp
+++ b/firmware/hw_layer/stepper.cpp
@@ -7,15 +7,12 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "engine.h"
+#include "pch.h"
// todo: EFI_STEPPER macro
#if EFI_PROD_CODE || EFI_SIMULATOR
#include "stepper.h"
-#include "pin_repository.h"
-#include "engine_controller.h"
#include "adc_inputs.h"
-#include "sensor.h"
#include "thread_priority.h"
void StepperMotor::saveStepperPos(int pos) {
diff --git a/firmware/hw_layer/stepper_dual_hbridge.cpp b/firmware/hw_layer/stepper_dual_hbridge.cpp
index df473e98a9..c56213f181 100644
--- a/firmware/hw_layer/stepper_dual_hbridge.cpp
+++ b/firmware/hw_layer/stepper_dual_hbridge.cpp
@@ -1,5 +1,5 @@
-#include "efifeatures.h"
+#include "pch.h"
#if !EFI_UNIT_TEST
diff --git a/firmware/init/sensor/init_fluid_pressure.cpp b/firmware/init/sensor/init_fluid_pressure.cpp
index 55a2855938..39ba4730ef 100644
--- a/firmware/init/sensor/init_fluid_pressure.cpp
+++ b/firmware/init/sensor/init_fluid_pressure.cpp
@@ -1,9 +1,8 @@
+#include "pch.h"
+
#include "init.h"
#include "adc_inputs.h"
#include "adc_subscription.h"
-#include "engine.h"
-#include "error_handling.h"
-#include "global.h"
#include "functional_sensor.h"
#include "proxy_sensor.h"
#include "linear_func.h"
diff --git a/firmware/init/sensor/init_lambda.cpp b/firmware/init/sensor/init_lambda.cpp
index 3c104ef4e2..0a646e8eef 100644
--- a/firmware/init/sensor/init_lambda.cpp
+++ b/firmware/init/sensor/init_lambda.cpp
@@ -1,10 +1,8 @@
+#include "pch.h"
+
#include "init.h"
#include "adc_subscription.h"
-#include "engine.h"
-#include "error_handling.h"
-#include "global.h"
#include "function_pointer_sensor.h"
-#include "ego.h"
struct GetAfrWrapper {
DECLARE_ENGINE_PTR;
diff --git a/firmware/init/sensor/init_sensors.cpp b/firmware/init/sensor/init_sensors.cpp
index b058f559cd..44f652a21f 100644
--- a/firmware/init/sensor/init_sensors.cpp
+++ b/firmware/init/sensor/init_sensors.cpp
@@ -2,9 +2,10 @@
* @file init_sensorss.cpp
*/
+#include "pch.h"
+
#include "init.h"
#include "cli_registry.h"
-#include "sensor.h"
static void initSensorCli();
diff --git a/firmware/init/sensor/init_thermistors.cpp b/firmware/init/sensor/init_thermistors.cpp
index 80b4d87977..907f53da98 100644
--- a/firmware/init/sensor/init_thermistors.cpp
+++ b/firmware/init/sensor/init_thermistors.cpp
@@ -1,8 +1,7 @@
-#include "global.h"
+#include "pch.h"
+
#include "adc_inputs.h"
#include "adc_subscription.h"
-#include "engine.h"
-#include "error_handling.h"
#include "functional_sensor.h"
#include "func_chain.h"
#include "linear_func.h"
diff --git a/firmware/init/sensor/init_tps.cpp b/firmware/init/sensor/init_tps.cpp
index 6162c154fa..79ae13410d 100644
--- a/firmware/init/sensor/init_tps.cpp
+++ b/firmware/init/sensor/init_tps.cpp
@@ -1,8 +1,7 @@
-#include "global.h"
+#include "pch.h"
+
#include "adc_inputs.h"
#include "adc_subscription.h"
-#include "engine.h"
-#include "error_handling.h"
#include "functional_sensor.h"
#include "redundant_sensor.h"
#include "redundant_ford_tps.h"
diff --git a/firmware/pch/pch.h b/firmware/pch/pch.h
index 7456ae87c1..7edaae2b0e 100644
--- a/firmware/pch/pch.h
+++ b/firmware/pch/pch.h
@@ -23,4 +23,12 @@
#include "sensor.h"
#include "error_handling.h"
#include "settings.h"
+#include "interpolation.h"
+#include "perf_trace.h"
+#if EFI_UNIT_TEST
+#include
+#include
+#include "engine_test_helper.h"
+#include "mocks.h"
+#endif
diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp
index 12a057852e..001280e8a1 100644
--- a/firmware/rusefi.cpp
+++ b/firmware/rusefi.cpp
@@ -106,12 +106,10 @@
*
*/
-#include "global.h"
+#include "pch.h"
#include "os_access.h"
#include "trigger_structure.h"
#include "hardware.h"
-#include "engine_controller.h"
-#include "efi_gpio.h"
#include "rfi_perftest.h"
#include "rusefi.h"
@@ -119,9 +117,7 @@
#include "eficonsole.h"
#include "status_loop.h"
-#include "pin_repository.h"
#include "custom_engine.h"
-#include "engine_math.h"
#include "mpu_util.h"
#include "tunerstudio.h"
#include "mmc_card.h"
diff --git a/firmware/util/efilib.cpp b/firmware/util/efilib.cpp
index f998b7d949..d6601236af 100644
--- a/firmware/util/efilib.cpp
+++ b/firmware/util/efilib.cpp
@@ -7,12 +7,12 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
+#include "pch.h"
+
#include
#include
-#include "efilib.h"
#include "datalogging.h"
#include "histogram.h"
-#include "error_handling.h"
const char * boolToString(bool value) {
return value ? "Yes" : "No";
diff --git a/firmware/util/math/biquad.cpp b/firmware/util/math/biquad.cpp
index ac082bc7f2..3ae911329f 100644
--- a/firmware/util/math/biquad.cpp
+++ b/firmware/util/math/biquad.cpp
@@ -5,10 +5,9 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "biquad.h"
-#include "error_handling.h"
+#include "pch.h"
-#include "efilib.h"
+#include "biquad.h"
Biquad::Biquad() {
// Default to passthru
diff --git a/simulator/simulator/rusEfiFunctionalTest.cpp b/simulator/simulator/rusEfiFunctionalTest.cpp
index 1eb62c2c11..0e31595c49 100644
--- a/simulator/simulator/rusEfiFunctionalTest.cpp
+++ b/simulator/simulator/rusEfiFunctionalTest.cpp
@@ -5,27 +5,21 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "global.h"
+#include "pch.h"
+
#include "boards.h"
#include "rusEfiFunctionalTest.h"
#include "console_io.h"
#include "eficonsole.h"
-#include "engine_configuration.h"
-#include "rusefi_enums.h"
-#include "pwm_generator_logic.h"
#include "trigger_central.h"
#include "datalogging.h"
-#include "rpm_calculator.h"
#include "engine_sniffer.h"
#include "status_loop.h"
#include "trigger_emulator_algo.h"
#include "main_trigger_callback.h"
-#include "allsensors.h"
#include "sensor_chart.h"
#include "bench_test.h"
-#include "engine.h"
#include "tunerstudio.h"
-#include "engine_controller.h"
#include "map_averaging.h"
#include "memstreams.h"
#include
diff --git a/unit_tests/engine_test_helper.cpp b/unit_tests/engine_test_helper.cpp
index e24af83022..b81e14998e 100644
--- a/unit_tests/engine_test_helper.cpp
+++ b/unit_tests/engine_test_helper.cpp
@@ -5,16 +5,14 @@
* @author Andrey Belomutskiy, (c) 2012-2014
*/
+#include "pch.h"
+
#include "engine_test_helper.h"
-#include "stddef.h"
#include "trigger_decoder.h"
#include "speed_density.h"
#include "fuel_math.h"
#include "accel_enrichment.h"
-#include "allsensors.h"
-#include "engine_controller.h"
#include "advance_map.h"
-#include "sensor.h"
#include "tooth_logger.h"
#include "logicdata.h"
#include "hardware.h"
diff --git a/unit_tests/tests/ignition_injection/test_fuelCut.cpp b/unit_tests/tests/ignition_injection/test_fuelCut.cpp
index 05a7397ce9..a9fd42140f 100644
--- a/unit_tests/tests/ignition_injection/test_fuelCut.cpp
+++ b/unit_tests/tests/ignition_injection/test_fuelCut.cpp
@@ -5,10 +5,9 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "engine_math.h"
-#include "engine_test_helper.h"
+#include "pch.h"
+
#include "event_queue.h"
-#include "sensor.h"
#include "fsio_impl.h"
using ::testing::_;
diff --git a/unit_tests/tests/ignition_injection/test_fuel_map.cpp b/unit_tests/tests/ignition_injection/test_fuel_map.cpp
index 65c85ca170..ab48f348b2 100644
--- a/unit_tests/tests/ignition_injection/test_fuel_map.cpp
+++ b/unit_tests/tests/ignition_injection/test_fuel_map.cpp
@@ -5,16 +5,12 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
+#include "pch.h"
+
#include "fuel_math.h"
#include "trigger_structure.h"
-#include "allsensors.h"
-#include "engine_math.h"
#include "trigger_decoder.h"
-#include "engine_test_helper.h"
-#include "efi_gpio.h"
#include "advance_map.h"
-#include "sensor.h"
-#include "mocks.h"
using ::testing::FloatNear;
diff --git a/unit_tests/tests/lua/test_lua_hooks.cpp b/unit_tests/tests/lua/test_lua_hooks.cpp
index b2fa71acd5..3f0bd383b1 100644
--- a/unit_tests/tests/lua/test_lua_hooks.cpp
+++ b/unit_tests/tests/lua/test_lua_hooks.cpp
@@ -1,7 +1,6 @@
+#include "pch.h"
+
#include "rusefi_lua.h"
-#include
-#include "engine_test_helper.h"
-#include "sensor.h"
static const char* getSensorTest = R"(
diff --git a/unit_tests/tests/sensor/mock_sensor.cpp b/unit_tests/tests/sensor/mock_sensor.cpp
index 39ad906e34..9831f09d67 100644
--- a/unit_tests/tests/sensor/mock_sensor.cpp
+++ b/unit_tests/tests/sensor/mock_sensor.cpp
@@ -1,9 +1,7 @@
+#include "pch.h"
+
#include "mock/mock_sensor.h"
-#include "sensor.h"
-
-#include
-
class SensorMocking : public ::testing::Test {
protected:
MockSensor realSensor;
diff --git a/unit_tests/tests/sensor/test_sensor_init.cpp b/unit_tests/tests/sensor/test_sensor_init.cpp
index 68c8200ed1..15f11ecda1 100644
--- a/unit_tests/tests/sensor/test_sensor_init.cpp
+++ b/unit_tests/tests/sensor/test_sensor_init.cpp
@@ -1,11 +1,9 @@
+#include "pch.h"
+
#include "unit_test_framework.h"
#include "init.h"
-#include "sensor.h"
#include "functional_sensor.h"
-#include "engine_test_helper.h"
-#include
-
static void postToFuncSensor(Sensor* s, float value) {
static_cast(s)->postRawValue(value, getTimeNowNt());
}
diff --git a/unit_tests/tests/test_accel_enrichment.cpp b/unit_tests/tests/test_accel_enrichment.cpp
index ec5eee358d..5e1e86d60b 100644
--- a/unit_tests/tests/test_accel_enrichment.cpp
+++ b/unit_tests/tests/test_accel_enrichment.cpp
@@ -8,9 +8,9 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "engine_test_helper.h"
+#include "pch.h"
+
#include "accel_enrichment.h"
-#include "sensor.h"
TEST(fuel, testTpsAccelEnrichmentMath) {
printf("====================================================================================== testAccelEnrichment\r\n");
diff --git a/unit_tests/tests/test_aux_valves.cpp b/unit_tests/tests/test_aux_valves.cpp
index d199da8590..67234db7db 100644
--- a/unit_tests/tests/test_aux_valves.cpp
+++ b/unit_tests/tests/test_aux_valves.cpp
@@ -5,9 +5,9 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "engine_test_helper.h"
+#include "pch.h"
+
#include "aux_valves.h"
-#include "sensor.h"
TEST(misc, testAuxValves) {
Sensor::setMockValue(SensorType::DriverThrottleIntent, 0);
diff --git a/unit_tests/tests/test_etb.cpp b/unit_tests/tests/test_etb.cpp
index 7752a01637..1b35469293 100644
--- a/unit_tests/tests/test_etb.cpp
+++ b/unit_tests/tests/test_etb.cpp
@@ -5,11 +5,10 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "engine_test_helper.h"
+#include "pch.h"
+
#include "electronic_throttle_impl.h"
#include "dc_motor.h"
-#include "engine_controller.h"
-#include "sensor.h"
#include "idle_thread.h"
#include "mocks.h"
diff --git a/unit_tests/tests/test_fan_control.cpp b/unit_tests/tests/test_fan_control.cpp
index 0643b51bd8..b202278fbd 100644
--- a/unit_tests/tests/test_fan_control.cpp
+++ b/unit_tests/tests/test_fan_control.cpp
@@ -1,7 +1,6 @@
-#include "efi_gpio.h"
-#include "engine_test_helper.h"
+#include "pch.h"
+
#include "fan_control.h"
-#include "sensor.h"
TEST(FanControl, fan1) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
diff --git a/unit_tests/tests/test_gpio.cpp b/unit_tests/tests/test_gpio.cpp
index dc269ffa30..68bff01ef0 100644
--- a/unit_tests/tests/test_gpio.cpp
+++ b/unit_tests/tests/test_gpio.cpp
@@ -1,7 +1,4 @@
-#include "efi_gpio.h"
-#include "engine_test_helper.h"
-#include "unit_test_framework.h"
-#include
+#include "pch.h"
TEST(gpio, testPinInitNonInverted) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
diff --git a/unit_tests/tests/test_gppwm.cpp b/unit_tests/tests/test_gppwm.cpp
index 1a7d3ecfd3..e654c16706 100644
--- a/unit_tests/tests/test_gppwm.cpp
+++ b/unit_tests/tests/test_gppwm.cpp
@@ -1,8 +1,7 @@
+#include "pch.h"
-#include "engine_test_helper.h"
#include "gppwm_channel.h"
#include "gppwm.h"
-#include "sensor.h"
#include "mocks.h"
diff --git a/unit_tests/tests/test_idle_controller.cpp b/unit_tests/tests/test_idle_controller.cpp
index 27bbab6719..375b8dea96 100644
--- a/unit_tests/tests/test_idle_controller.cpp
+++ b/unit_tests/tests/test_idle_controller.cpp
@@ -5,16 +5,13 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "engine_test_helper.h"
+#include "pch.h"
+
#include "advance_map.h"
-#include "tps.h"
#include "pid.h"
#include "fsio_impl.h"
#include "idle_thread.h"
-#include "allsensors.h"
-#include "engine_controller.h"
#include "electronic_throttle.h"
-#include "sensor.h"
#include "vehicle_speed.h"
using ::testing::StrictMock;
diff --git a/unit_tests/tests/test_pwm_generator.cpp b/unit_tests/tests/test_pwm_generator.cpp
index cd2f9d3ffe..5c96455e5f 100644
--- a/unit_tests/tests/test_pwm_generator.cpp
+++ b/unit_tests/tests/test_pwm_generator.cpp
@@ -5,9 +5,7 @@
* Author: user
*/
-#include "global.h"
-#include "unit_test_framework.h"
-#include "pwm_generator_logic.h"
+#include "pch.h"
#define LOW_VALUE 0
#define HIGH_VALUE 1
diff --git a/unit_tests/tests/test_signal_executor.cpp b/unit_tests/tests/test_signal_executor.cpp
index b4e6ef6bc3..6c3f066989 100644
--- a/unit_tests/tests/test_signal_executor.cpp
+++ b/unit_tests/tests/test_signal_executor.cpp
@@ -5,12 +5,9 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "global.h"
+#include "pch.h"
-#include "io_pins.h"
#include "event_queue.h"
-#include "pwm_generator_logic.h"
-#include "unit_test_framework.h"
static int callbackCounter = 0;
diff --git a/unit_tests/tests/test_util.cpp b/unit_tests/tests/test_util.cpp
index b284e3106a..890b020dd4 100644
--- a/unit_tests/tests/test_util.cpp
+++ b/unit_tests/tests/test_util.cpp
@@ -5,29 +5,23 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
+#include "pch.h"
+
#include
#include "cyclic_buffer.h"
-#include "global.h"
#include "histogram.h"
#include "malfunction_central.h"
#include "cli_registry.h"
-#include "unit_test_framework.h"
-#include "engine_controller.h"
#include "nmea.h"
#include "mmc_card.h"
#include "lcd_menu_tree.h"
#include "crc.h"
#include "fl_stack.h"
-#include "io_pins.h"
-#include "efi_gpio.h"
-#include "efilib.h"
#include "peak_detect.h"
-#include "gtest/gtest.h"
-
TEST(util, negativeZero) {
ASSERT_TRUE(IS_NEGATIVE_ZERO(-0.0));
diff --git a/unit_tests/tests/trigger/test_trigger_decoder.cpp b/unit_tests/tests/trigger/test_trigger_decoder.cpp
index ba6787c2c9..403f326b20 100644
--- a/unit_tests/tests/trigger/test_trigger_decoder.cpp
+++ b/unit_tests/tests/trigger/test_trigger_decoder.cpp
@@ -5,11 +5,9 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
-#include "engine_test_helper.h"
+#include "pch.h"
+
#include "trigger_decoder.h"
-#include "engine_math.h"
-#include "allsensors.h"
-#include "engine_controller.h"
#include "ford_aspire.h"
#include "dodge_neon.h"
#include "ford_1995_inline_6.h"
@@ -21,7 +19,6 @@
#include "fuel_math.h"
#include "spark_logic.h"
#include "trigger_universal.h"
-#include "sensor.h"
using ::testing::_;