From 2ce77778653348a91cc579e3cb6b5df243e2e969 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Fri, 16 Jul 2021 15:13:33 -0700 Subject: [PATCH] don't require EXTERN_ENGINE in every file (#2969) * move enginePins * no more extern engine * uses * more * extern config too * put this where it belongs * include correct header * merge --- .../hellen/cypress/board_configuration.cpp | 2 -- .../hellen121nissan/board_configuration.cpp | 2 -- .../hellen121vag/board_configuration.cpp | 2 -- .../hellen/hellen128/board_configuration.cpp | 2 -- .../board_configuration.cpp | 2 -- .../hellen/hellen72/board_configuration.cpp | 2 -- .../boards/kinetis/board_configuration.cpp | 2 -- .../microrusefi/board_configuration.cpp | 2 -- .../nucleo_f767/board_configuration.cpp | 2 -- .../boards/prometheus/board_configuration.cpp | 2 -- .../boards/proteus/board_configuration.cpp | 2 -- .../boards/skeleton/board_configuration.cpp | 2 -- .../subaru_eg33/board_configuration.cpp | 2 -- firmware/config/engines/GY6_139QMB.cpp | 2 -- firmware/config/engines/bmw_m73.cpp | 2 -- firmware/config/engines/bmw_m73_mre.cpp | 2 -- .../config/engines/chevrolet_camaro_4.cpp | 2 -- .../config/engines/citroenBerlingoTU3JP.cpp | 2 -- firmware/config/engines/custom_engine.cpp | 2 -- firmware/config/engines/dodge_neon.cpp | 2 -- firmware/config/engines/dodge_ram.cpp | 2 -- firmware/config/engines/engine_template.cpp | 2 -- .../config/engines/ford_1995_inline_6.cpp | 2 -- firmware/config/engines/ford_aspire.cpp | 2 -- firmware/config/engines/ford_festiva.cpp | 2 -- firmware/config/engines/honda_600.cpp | 2 -- firmware/config/engines/honda_accord.cpp | 2 -- firmware/config/engines/lada_kalina.cpp | 2 -- firmware/config/engines/m111.cpp | 2 -- firmware/config/engines/mazda_626.cpp | 2 -- firmware/config/engines/mazda_miata.cpp | 2 -- firmware/config/engines/mazda_miata_1_6.cpp | 2 -- .../config/engines/mazda_miata_base_maps.cpp | 2 -- .../engines/mazda_miata_custom_hunchback.cpp | 2 -- firmware/config/engines/mazda_miata_na8.cpp | 2 -- firmware/config/engines/mazda_miata_nb.cpp | 2 -- firmware/config/engines/mazda_miata_vvt.cpp | 2 -- firmware/config/engines/me7pnp.cpp | 2 -- firmware/config/engines/mitsubishi.cpp | 2 -- firmware/config/engines/nissan_primera.cpp | 2 -- firmware/config/engines/nissan_vq.cpp | 2 -- firmware/config/engines/sachs.cpp | 2 -- firmware/config/engines/subaru.cpp | 2 -- firmware/config/engines/test_engine.cpp | 2 -- firmware/config/engines/toyota_jzs147.cpp | 2 -- firmware/config/engines/vw.cpp | 2 -- firmware/config/engines/vw_b6.cpp | 2 -- firmware/console/binary/bluetooth.cpp | 2 -- firmware/console/binary/tooth_logger.cpp | 2 -- firmware/console/binary/tunerstudio.cpp | 2 -- firmware/console/binary/tunerstudio_io.cpp | 2 -- .../binary/tunerstudio_io_serial_ports.cpp | 2 -- firmware/console/console_io.cpp | 2 -- firmware/console/status_loop.cpp | 2 -- firmware/controllers/actuators/ac_control.cpp | 2 -- .../actuators/alternator_controller.cpp | 2 -- .../controllers/actuators/boost_control.cpp | 2 -- firmware/controllers/actuators/dc_motors.cpp | 2 -- .../actuators/electronic_throttle.cpp | 2 -- .../controllers/actuators/fan_control.cpp | 2 -- .../controllers/actuators/gppwm/gppwm.cpp | 2 -- .../actuators/gppwm/gppwm_channel.cpp | 2 -- .../controllers/actuators/idle_hardware.cpp | 2 -- .../controllers/actuators/idle_thread.cpp | 2 -- firmware/controllers/actuators/pwm_tester.cpp | 2 -- firmware/controllers/actuators/vvt.cpp | 2 -- .../controllers/algo/accel_enrichment.cpp | 2 -- firmware/controllers/algo/advance_map.cpp | 2 -- firmware/controllers/algo/airmass/airmass.cpp | 2 -- .../controllers/algo/airmass/maf_airmass.cpp | 2 -- .../algo/airmass/speed_density_airmass.cpp | 2 -- .../algo/airmass/speed_density_base.cpp | 2 -- .../algo/defaults/default_base_engine.cpp | 2 -- .../algo/defaults/default_cranking.cpp | 2 -- .../algo/defaults/default_fuel.cpp | 2 -- .../algo/defaults/default_ignition.cpp | 2 -- firmware/controllers/algo/dynoview.cpp | 2 -- firmware/controllers/algo/engine.cpp | 2 -- firmware/controllers/algo/engine.h | 6 +++- firmware/controllers/algo/engine2.cpp | 2 -- .../controllers/algo/engine_configuration.cpp | 2 -- .../controllers/algo/engine_configuration.h | 28 ++++++++++++++++++ .../controllers/algo/fuel/fuel_computer.cpp | 2 -- .../controllers/algo/fuel/injector_model.cpp | 2 -- firmware/controllers/algo/fuel_math.cpp | 2 -- firmware/controllers/algo/launch_control.cpp | 2 -- firmware/controllers/bench_test.cpp | 2 -- firmware/controllers/buttonshift.cpp | 2 -- firmware/controllers/can/can_dash.cpp | 2 -- firmware/controllers/can/can_rx.cpp | 3 -- firmware/controllers/can/can_tx.cpp | 2 -- firmware/controllers/can/can_verbose.cpp | 2 -- firmware/controllers/can/can_vss.cpp | 2 -- firmware/controllers/can/obd2.cpp | 2 -- firmware/controllers/can/rusefi_wideband.cpp | 2 -- firmware/controllers/core/common_headers.h | 14 --------- firmware/controllers/core/engine_ptr.h | 29 +------------------ firmware/controllers/core/error_handling.cpp | 2 -- firmware/controllers/core/fsio_core.cpp | 2 -- firmware/controllers/core/fsio_impl.cpp | 2 -- firmware/controllers/engine_controller.cpp | 2 -- .../controllers/engine_controller_misc.cpp | 2 -- .../controllers/engine_cycle/aux_valves.cpp | 2 -- .../engine_cycle/fuel_schedule.cpp | 2 -- .../engine_cycle/high_pressure_fuel_pump.cpp | 3 -- .../controllers/engine_cycle/knock_logic.cpp | 2 -- .../engine_cycle/main_trigger_callback.cpp | 2 -- .../engine_cycle/map_averaging.cpp | 2 -- .../engine_cycle/rpm_calculator.cpp | 2 -- .../controllers/engine_cycle/spark_logic.cpp | 1 - firmware/controllers/flash_main.cpp | 2 -- .../controllers/gauges/lcd_controller.cpp | 2 -- .../gauges/malfunction_indicator.cpp | 2 -- firmware/controllers/gauges/tachometer.cpp | 2 -- firmware/controllers/limp_manager.cpp | 2 -- firmware/controllers/lua/lua.cpp | 2 -- firmware/controllers/lua/lua_hooks.cpp | 2 -- .../controllers/math/closed_loop_fuel.cpp | 2 -- .../math/closed_loop_fuel_cell.cpp | 2 -- firmware/controllers/math/engine_math.cpp | 1 - firmware/controllers/math/speed_density.cpp | 2 -- .../controllers/sensors/AemXSeriesLambda.cpp | 2 -- firmware/controllers/sensors/allsensors.cpp | 2 -- firmware/controllers/sensors/ego.cpp | 2 -- firmware/controllers/sensors/flex_sensor.cpp | 2 -- firmware/controllers/sensors/maf.cpp | 2 -- firmware/controllers/sensors/map.cpp | 2 -- .../controllers/sensors/software_knock.cpp | 2 -- firmware/controllers/sensors/tps.cpp | 2 -- firmware/controllers/serial/serial_rx.cpp | 2 -- firmware/controllers/serial/serial_sensor.cpp | 2 -- firmware/controllers/settings.cpp | 2 -- firmware/controllers/simple_tcu.cpp | 2 -- firmware/controllers/start_stop.cpp | 2 -- firmware/controllers/system/efi_gpio.cpp | 2 -- firmware/controllers/system/efi_gpio.h | 2 ++ .../system/timer/pwm_generator_logic.cpp | 2 -- .../system/timer/single_timer_executor.cpp | 2 -- .../trigger/decoders/trigger_structure.cpp | 2 -- .../controllers/trigger/trigger_central.cpp | 4 --- .../controllers/trigger/trigger_decoder.cpp | 2 -- .../trigger/trigger_emulator_algo.cpp | 2 -- .../controllers/trigger/trigger_simulator.cpp | 2 -- firmware/development/engine_emulator.cpp | 2 -- firmware/development/engine_sniffer.cpp | 1 - firmware/development/hw_layer/poten.cpp | 2 -- firmware/development/logic_analyzer.cpp | 2 -- firmware/development/sensor_chart.cpp | 2 -- firmware/hw_layer/adc/adc_inputs.cpp | 4 --- firmware/hw_layer/adc/adc_subscription.cpp | 2 -- firmware/hw_layer/cdm_ion_sense.cpp | 2 -- .../digital_input/trigger/trigger_input.cpp | 2 -- .../trigger/trigger_input_comp.cpp | 2 -- .../trigger/trigger_input_exti.cpp | 2 -- .../trigger/trigger_input_icu.cpp | 2 -- firmware/hw_layer/drivers/can/can_hw.cpp | 2 -- firmware/hw_layer/drivers/can/can_msg_tx.cpp | 2 -- firmware/hw_layer/drivers/gpio/tle8888.cpp | 2 -- firmware/hw_layer/drivers/lcd/HD44780.cpp | 2 -- .../hw_layer/drivers/serial/serial_hw.cpp | 2 -- firmware/hw_layer/hardware.cpp | 2 -- firmware/hw_layer/io_pins.cpp | 2 -- firmware/hw_layer/mc33816.cpp | 2 -- .../microsecond_timer/microsecond_timer.cpp | 2 -- firmware/hw_layer/mmc_card.cpp | 2 -- firmware/hw_layer/mmc_card_access.cpp | 3 -- firmware/hw_layer/pin_repository.cpp | 4 --- firmware/hw_layer/ports/cypress/mpu_util.cpp | 2 -- firmware/hw_layer/ports/kinetis/mpu_util.cpp | 2 -- .../hw_layer/ports/stm32/stm32_adc_v2.cpp | 4 +-- .../hw_layer/ports/stm32/stm32_common.cpp | 2 -- firmware/hw_layer/sensors/accelerometer.cpp | 2 -- firmware/hw_layer/sensors/cj125.cpp | 2 -- firmware/hw_layer/sensors/cj125_logic.cpp | 2 -- firmware/hw_layer/sensors/gps_uart.cpp | 2 -- firmware/hw_layer/sensors/hip9011.cpp | 2 -- firmware/hw_layer/sensors/hip9011_logic.cpp | 2 -- firmware/hw_layer/sensors/joystick.cpp | 2 -- firmware/hw_layer/sensors/max31855.cpp | 2 -- firmware/hw_layer/sensors/yaw_rate_sensor.cpp | 2 -- firmware/hw_layer/servo.cpp | 2 -- firmware/hw_layer/smart_gpio.cpp | 2 -- firmware/hw_layer/stepper.cpp | 2 -- firmware/hw_layer/trigger_input_adc.cpp | 2 -- firmware/hw_layer/vehicle_speed.cpp | 2 -- firmware/init/sensor/init_aux.cpp | 2 -- firmware/init/sensor/init_baro.cpp | 2 -- firmware/init/sensor/init_can_sensors.cpp | 3 -- firmware/init/sensor/init_flex.cpp | 2 -- firmware/init/sensor/init_fluid_pressure.cpp | 2 -- firmware/init/sensor/init_fuel_level.cpp | 2 -- firmware/init/sensor/init_lambda.cpp | 2 -- firmware/init/sensor/init_maf.cpp | 2 -- firmware/init/sensor/init_map.cpp | 2 -- firmware/init/sensor/init_thermistors.cpp | 2 -- firmware/init/sensor/init_tps.cpp | 2 -- firmware/init/sensor/init_vbatt.cpp | 2 -- firmware/rusefi.cpp | 2 -- simulator/simulator/boards.cpp | 2 -- simulator/simulator/rusEfiFunctionalTest.cpp | 2 -- 200 files changed, 37 insertions(+), 441 deletions(-) diff --git a/firmware/config/boards/hellen/cypress/board_configuration.cpp b/firmware/config/boards/hellen/cypress/board_configuration.cpp index 7b258a5c04..fbe32d27d3 100644 --- a/firmware/config/boards/hellen/cypress/board_configuration.cpp +++ b/firmware/config/boards/hellen/cypress/board_configuration.cpp @@ -15,8 +15,6 @@ #include "tps.h" #include "trigger_input.h" -EXTERN_ENGINE; - void setBoardDefaultConfiguration(void) { setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR); diff --git a/firmware/config/boards/hellen/hellen121nissan/board_configuration.cpp b/firmware/config/boards/hellen/hellen121nissan/board_configuration.cpp index 2120cbee08..b2bf39902f 100644 --- a/firmware/config/boards/hellen/hellen121nissan/board_configuration.cpp +++ b/firmware/config/boards/hellen/hellen121nissan/board_configuration.cpp @@ -17,8 +17,6 @@ #include "fsio_impl.h" #include "engine_configuration.h" -EXTERN_ENGINE; - static void hellenWbo() { engineConfiguration->enableAemXSeries = true; } diff --git a/firmware/config/boards/hellen/hellen121vag/board_configuration.cpp b/firmware/config/boards/hellen/hellen121vag/board_configuration.cpp index f0d4a5f959..011d290b22 100644 --- a/firmware/config/boards/hellen/hellen121vag/board_configuration.cpp +++ b/firmware/config/boards/hellen/hellen121vag/board_configuration.cpp @@ -17,8 +17,6 @@ #include "fsio_impl.h" #include "engine_configuration.h" -EXTERN_ENGINE; - static void hellenWbo() { engineConfiguration->enableAemXSeries = true; } diff --git a/firmware/config/boards/hellen/hellen128/board_configuration.cpp b/firmware/config/boards/hellen/hellen128/board_configuration.cpp index c22752d7fe..fa4d420f0d 100644 --- a/firmware/config/boards/hellen/hellen128/board_configuration.cpp +++ b/firmware/config/boards/hellen/hellen128/board_configuration.cpp @@ -17,8 +17,6 @@ #include "fsio_impl.h" #include "engine_configuration.h" -EXTERN_ENGINE; - static void hellenWbo() { engineConfiguration->enableAemXSeries = true; } diff --git a/firmware/config/boards/hellen/hellen64_miataNA6_94/board_configuration.cpp b/firmware/config/boards/hellen/hellen64_miataNA6_94/board_configuration.cpp index 6c6db5e39a..8ec4c6f872 100644 --- a/firmware/config/boards/hellen/hellen64_miataNA6_94/board_configuration.cpp +++ b/firmware/config/boards/hellen/hellen64_miataNA6_94/board_configuration.cpp @@ -17,8 +17,6 @@ #include "fsio_impl.h" #include "engine_configuration.h" -EXTERN_ENGINE; - static void setInjectorPins() { engineConfiguration->injectionPins[0] = GPIOG_7; engineConfiguration->injectionPins[1] = GPIOG_8; diff --git a/firmware/config/boards/hellen/hellen72/board_configuration.cpp b/firmware/config/boards/hellen/hellen72/board_configuration.cpp index 78e33211a7..e345fa70b7 100644 --- a/firmware/config/boards/hellen/hellen72/board_configuration.cpp +++ b/firmware/config/boards/hellen/hellen72/board_configuration.cpp @@ -17,8 +17,6 @@ #include "fsio_impl.h" #include "engine_configuration.h" -EXTERN_ENGINE; - static void hellenWbo() { engineConfiguration->enableAemXSeries = true; } diff --git a/firmware/config/boards/kinetis/board_configuration.cpp b/firmware/config/boards/kinetis/board_configuration.cpp index 95571fcc53..67381e19c2 100644 --- a/firmware/config/boards/kinetis/board_configuration.cpp +++ b/firmware/config/boards/kinetis/board_configuration.cpp @@ -14,8 +14,6 @@ #include "engine_math.h" #include "tps.h" -EXTERN_ENGINE; - #if 0 char __debugBuffer[80]; int __debugEnabled = 0; diff --git a/firmware/config/boards/microrusefi/board_configuration.cpp b/firmware/config/boards/microrusefi/board_configuration.cpp index 9eb8b163b0..b317f489ac 100644 --- a/firmware/config/boards/microrusefi/board_configuration.cpp +++ b/firmware/config/boards/microrusefi/board_configuration.cpp @@ -25,8 +25,6 @@ #include "fsio_impl.h" #include "engine_configuration.h" -EXTERN_ENGINE; - static void setInjectorPins() { engineConfiguration->injectionPins[0] = TLE8888_PIN_1; engineConfiguration->injectionPins[1] = TLE8888_PIN_2; diff --git a/firmware/config/boards/nucleo_f767/board_configuration.cpp b/firmware/config/boards/nucleo_f767/board_configuration.cpp index 2fee3b0ca5..97ff0f36a5 100644 --- a/firmware/config/boards/nucleo_f767/board_configuration.cpp +++ b/firmware/config/boards/nucleo_f767/board_configuration.cpp @@ -13,8 +13,6 @@ #include "fsio_impl.h" #include "engine_configuration.h" -EXTERN_ENGINE; - // Warning! This is a test config! #undef SERIAL_SPEED diff --git a/firmware/config/boards/prometheus/board_configuration.cpp b/firmware/config/boards/prometheus/board_configuration.cpp index 311c292dc9..75c99b4a57 100644 --- a/firmware/config/boards/prometheus/board_configuration.cpp +++ b/firmware/config/boards/prometheus/board_configuration.cpp @@ -14,8 +14,6 @@ #include "fsio_impl.h" #include "engine_configuration.h" -EXTERN_ENGINE; - #ifdef STM32F469xx static bool is469 = true; #else diff --git a/firmware/config/boards/proteus/board_configuration.cpp b/firmware/config/boards/proteus/board_configuration.cpp index 6ad0b8e9e6..c423d6f609 100644 --- a/firmware/config/boards/proteus/board_configuration.cpp +++ b/firmware/config/boards/proteus/board_configuration.cpp @@ -11,8 +11,6 @@ #include "allsensors.h" #include "fsio_impl.h" -EXTERN_ENGINE; - static const brain_pin_e injPins[] = { GPIOD_7, GPIOG_9, diff --git a/firmware/config/boards/skeleton/board_configuration.cpp b/firmware/config/boards/skeleton/board_configuration.cpp index 51f537a3f5..0e67b16d50 100644 --- a/firmware/config/boards/skeleton/board_configuration.cpp +++ b/firmware/config/boards/skeleton/board_configuration.cpp @@ -34,8 +34,6 @@ #include "fsio_impl.h" #include "engine_configuration.h" -EXTERN_ENGINE; - // An example of how to configure complex features on the board. // Generally these should be local (static) functions, one function per chip. diff --git a/firmware/config/boards/subaru_eg33/board_configuration.cpp b/firmware/config/boards/subaru_eg33/board_configuration.cpp index b1f00a4ba9..60f4bf41f7 100644 --- a/firmware/config/boards/subaru_eg33/board_configuration.cpp +++ b/firmware/config/boards/subaru_eg33/board_configuration.cpp @@ -16,8 +16,6 @@ #include "smart_gpio.h" #include "drivers/gpio/mc33810.h" -EXTERN_ENGINE; - void setPinConfigurationOverrides(void) { } diff --git a/firmware/config/engines/GY6_139QMB.cpp b/firmware/config/engines/GY6_139QMB.cpp index 77093b272c..0e82e7f3d8 100644 --- a/firmware/config/engines/GY6_139QMB.cpp +++ b/firmware/config/engines/GY6_139QMB.cpp @@ -18,8 +18,6 @@ #include "allsensors.h" #include "advance_map.h" -EXTERN_CONFIG; - static void setDefault139qmbMaps(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setTimingLoadBin(1.2, 4.4 PASS_CONFIG_PARAMETER_SUFFIX); setTimingRpmBin(1000, 11000 PASS_CONFIG_PARAMETER_SUFFIX); diff --git a/firmware/config/engines/bmw_m73.cpp b/firmware/config/engines/bmw_m73.cpp index 28fab33ee8..e8b542fbf4 100644 --- a/firmware/config/engines/bmw_m73.cpp +++ b/firmware/config/engines/bmw_m73.cpp @@ -80,8 +80,6 @@ #include "electronic_throttle.h" #endif // EFI_ELECTRONIC_THROTTLE_BODY -EXTERN_CONFIG; - void m73engine(DECLARE_CONFIG_PARAMETER_SIGNATURE) { // 13641435991 injector engineConfiguration->injector.flow = 180; // cc/min, who knows if this number is real - no good source of info diff --git a/firmware/config/engines/bmw_m73_mre.cpp b/firmware/config/engines/bmw_m73_mre.cpp index 7cb39d6bcd..9576f5a188 100644 --- a/firmware/config/engines/bmw_m73_mre.cpp +++ b/firmware/config/engines/bmw_m73_mre.cpp @@ -63,8 +63,6 @@ #include "bmw_m73.h" #include "fsio_impl.h" -EXTERN_CONFIG; - void setEngineBMW_M73_microRusEfi(DECLARE_CONFIG_PARAMETER_SIGNATURE) { // 13641435991 injector engineConfiguration->injector.flow = 180; // cc/min, who knows if this number is real - no good source of info diff --git a/firmware/config/engines/chevrolet_camaro_4.cpp b/firmware/config/engines/chevrolet_camaro_4.cpp index a4510c8c57..124b1b6a4f 100644 --- a/firmware/config/engines/chevrolet_camaro_4.cpp +++ b/firmware/config/engines/chevrolet_camaro_4.cpp @@ -12,8 +12,6 @@ #include "engine_math.h" #include "custom_engine.h" -EXTERN_CONFIG; - void setCamaro4(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); diff --git a/firmware/config/engines/citroenBerlingoTU3JP.cpp b/firmware/config/engines/citroenBerlingoTU3JP.cpp index 2c3d922c69..31515dd001 100644 --- a/firmware/config/engines/citroenBerlingoTU3JP.cpp +++ b/firmware/config/engines/citroenBerlingoTU3JP.cpp @@ -39,8 +39,6 @@ static const uint8_t default_tps_advance_table[16][16] = { //static const float rpmSteps[16] = {400, 800, 1200, 1600, 2000, 2400, 2800, 3200, 3600, 4000, 4400, 4800, 5200, 5600, 6000, 6400}; //static const float mapSteps[16] = {25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100}; -EXTERN_CONFIG; - void setCitroenBerlingoTU3JPConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); diff --git a/firmware/config/engines/custom_engine.cpp b/firmware/config/engines/custom_engine.cpp index 48472ac1d8..a9d40a3b9d 100644 --- a/firmware/config/engines/custom_engine.cpp +++ b/firmware/config/engines/custom_engine.cpp @@ -26,8 +26,6 @@ #include "scheduler.h" #endif /* EFI_PROD_CODE */ -EXTERN_ENGINE; - #if EFI_PROD_CODE static int periodIndex = 0; diff --git a/firmware/config/engines/dodge_neon.cpp b/firmware/config/engines/dodge_neon.cpp index e9635f0ad5..9296770527 100644 --- a/firmware/config/engines/dodge_neon.cpp +++ b/firmware/config/engines/dodge_neon.cpp @@ -86,8 +86,6 @@ static const uint8_t veDodgeNeon2003Table[16][16] = { }; -EXTERN_CONFIG; - void setDodgeNeon1995EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); diff --git a/firmware/config/engines/dodge_ram.cpp b/firmware/config/engines/dodge_ram.cpp index 3b15302e1e..9a8da91f28 100644 --- a/firmware/config/engines/dodge_ram.cpp +++ b/firmware/config/engines/dodge_ram.cpp @@ -13,8 +13,6 @@ #include "allsensors.h" #include "engine_math.h" -EXTERN_CONFIG; - void setDodgeRam1996(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); diff --git a/firmware/config/engines/engine_template.cpp b/firmware/config/engines/engine_template.cpp index 60c62d2aa2..7e83ae5516 100644 --- a/firmware/config/engines/engine_template.cpp +++ b/firmware/config/engines/engine_template.cpp @@ -8,8 +8,6 @@ #include "engine_template.h" #include "custom_engine.h" -EXTERN_CONFIG; - void setEngineTemplateConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); } diff --git a/firmware/config/engines/ford_1995_inline_6.cpp b/firmware/config/engines/ford_1995_inline_6.cpp index df103f9ee8..e55275dbc0 100644 --- a/firmware/config/engines/ford_1995_inline_6.cpp +++ b/firmware/config/engines/ford_1995_inline_6.cpp @@ -16,8 +16,6 @@ #include "engine_math.h" #include "allsensors.h" -EXTERN_CONFIG; - /** * @brief Default values for persistent properties */ diff --git a/firmware/config/engines/ford_aspire.cpp b/firmware/config/engines/ford_aspire.cpp index 2e1ac3fb54..88f4e897de 100644 --- a/firmware/config/engines/ford_aspire.cpp +++ b/firmware/config/engines/ford_aspire.cpp @@ -40,8 +40,6 @@ static const int8_t default_aspire_timing_table[16][16] = { }; #endif -EXTERN_CONFIG; - static void setDefaultAspireMaps(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setTimingLoadBin(1.2, 4.4 PASS_CONFIG_PARAMETER_SUFFIX); setTimingRpmBin(800, 7000 PASS_CONFIG_PARAMETER_SUFFIX); diff --git a/firmware/config/engines/ford_festiva.cpp b/firmware/config/engines/ford_festiva.cpp index 823b0f42e9..a7a9f30881 100644 --- a/firmware/config/engines/ford_festiva.cpp +++ b/firmware/config/engines/ford_festiva.cpp @@ -62,8 +62,6 @@ static const uint8_t racingFestivaVeTable[16][16] = { {/* 15 160.000 *//* 0 800.0*/100, /* 1 1200.0*/100, /* 2 1600.0*/100, /* 3 2000.0*/100, /* 4 2400.0*/100, /* 5 2800.0*/120, /* 6 3200.0*/120, /* 7 3600.0*/120, /* 8 4100.0*/120, /* 9 4500.0*/120, /* 10 4900.0*/120, /* 11 5300.0*/120, /* 12 5700.0*/120, /* 13 6100.0*/120, /* 14 6500.0*/120, /* 15 7000.0*/120, }, }; -EXTERN_CONFIG; - /** * pin 1I/W9 - extra +5v * set engine_type 14 diff --git a/firmware/config/engines/honda_600.cpp b/firmware/config/engines/honda_600.cpp index e1e01c2d6b..44d2299000 100644 --- a/firmware/config/engines/honda_600.cpp +++ b/firmware/config/engines/honda_600.cpp @@ -34,8 +34,6 @@ static const uint8_t default_custom_timing_table[16][16] = { }; #endif -EXTERN_CONFIG; - static void setDefaultCustomMaps(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setTimingLoadBin(0,100 PASS_CONFIG_PARAMETER_SUFFIX); setTimingRpmBin(0,7000 PASS_CONFIG_PARAMETER_SUFFIX); diff --git a/firmware/config/engines/honda_accord.cpp b/firmware/config/engines/honda_accord.cpp index b18a782a34..146314c84b 100644 --- a/firmware/config/engines/honda_accord.cpp +++ b/firmware/config/engines/honda_accord.cpp @@ -35,8 +35,6 @@ #include "advance_map.h" #include "custom_engine.h" -EXTERN_CONFIG; - static void setHondaAccordConfigurationCommon(DECLARE_CONFIG_PARAMETER_SIGNATURE) { engineConfiguration->map.sensor.type = MT_DENSO183; diff --git a/firmware/config/engines/lada_kalina.cpp b/firmware/config/engines/lada_kalina.cpp index 5fe6868666..7ccbb7f105 100644 --- a/firmware/config/engines/lada_kalina.cpp +++ b/firmware/config/engines/lada_kalina.cpp @@ -11,8 +11,6 @@ #include "custom_engine.h" #include "fsio_impl.h" -EXTERN_CONFIG; - #if (BOARD_TLE8888_COUNT > 0) void setLadaKalina(DECLARE_CONFIG_PARAMETER_SIGNATURE) { /* MRE uses TLE8888_PIN_21 for fuel pump */ diff --git a/firmware/config/engines/m111.cpp b/firmware/config/engines/m111.cpp index 94b2152e35..fc25ed5195 100644 --- a/firmware/config/engines/m111.cpp +++ b/firmware/config/engines/m111.cpp @@ -8,8 +8,6 @@ #include "m111.h" -EXTERN_CONFIG; - void setM111EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { } diff --git a/firmware/config/engines/mazda_626.cpp b/firmware/config/engines/mazda_626.cpp index 3f8dcacd52..74cbc9b864 100644 --- a/firmware/config/engines/mazda_626.cpp +++ b/firmware/config/engines/mazda_626.cpp @@ -15,8 +15,6 @@ #include "fsio_impl.h" #include "settings.h" -EXTERN_CONFIG; - void setMazda626EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); diff --git a/firmware/config/engines/mazda_miata.cpp b/firmware/config/engines/mazda_miata.cpp index f30eb24eb8..49a47bf96d 100644 --- a/firmware/config/engines/mazda_miata.cpp +++ b/firmware/config/engines/mazda_miata.cpp @@ -75,8 +75,6 @@ static const uint8_t miataNA8_maf_advance_table[16][16] = { {/*0 engineLoad=1.2 +29, /*12 5760.0*/+28, /*13 6173.0*/+28, /*14 6586.0*/+27, /*15 7000.0*/+27 } }; #endif -EXTERN_ENGINE; - static void commonMiataNa(DECLARE_CONFIG_PARAMETER_SIGNATURE) { engineConfiguration->trigger.type = TT_MAZDA_MIATA_NA; engineConfiguration->engineChartSize = 100; diff --git a/firmware/config/engines/mazda_miata_1_6.cpp b/firmware/config/engines/mazda_miata_1_6.cpp index 18ede15db0..208f3e8dbd 100644 --- a/firmware/config/engines/mazda_miata_1_6.cpp +++ b/firmware/config/engines/mazda_miata_1_6.cpp @@ -18,8 +18,6 @@ #include "mazda_miata_1_6.h" #include "mazda_miata_base_maps.h" -EXTERN_CONFIG; - static const float hardCodedmafDecodingBins[256] = {0.099999905, 0.19999981, 0.29999924, 0.39999962, 0.5, 0.5999985, 0.70000076, 0.79999924, 0.9000015, 1.0, 1.0999985, 1.199997, 1.300003, 1.4000015, 1.5, 1.5999985, 1.699997, 1.800003, 1.9000015, 2.0, 2.100006, 2.2000122, 2.2999878, 2.399994, 2.5, 2.600006, 2.7000122, 2.7999878, 2.899994, 3.0, 3.100006, 3.2000122, 3.2999878, 3.399994, 3.5, 3.600006, 3.7000122, 3.7999878, 3.899994, 4.0, 4.0999756, 4.200012, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988, 4.299988}; static const float hardCodedmafDecoding[256] = {570.0, 437.0, 351.5, 293.55078, 237.0, 186.0, 145.0, 116.0, 96.0, 78.84961, 65.549805, 56.049805, 48.0, 40.0, 33.25, 29.449951, 25.649902, 22.800049, 20.899902, 19.0, 17.100098, 16.149902, 13.775024, 12.824951, 11.400024, 10.449951, 9.5, 8.550049, 8.454956, 8.359985, 8.300049, 8.199951, 7.5999756, 7.125, 7.125, 7.125, 6.6500244, 6.6500244, 6.6500244, 6.6500244, 6.6500244, 6.6500244, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; diff --git a/firmware/config/engines/mazda_miata_base_maps.cpp b/firmware/config/engines/mazda_miata_base_maps.cpp index ce22d57289..455895ec74 100644 --- a/firmware/config/engines/mazda_miata_base_maps.cpp +++ b/firmware/config/engines/mazda_miata_base_maps.cpp @@ -8,8 +8,6 @@ #include "engine_configuration.h" #include "table_helper.h" -EXTERN_CONFIG; - // todo: use these defaults wider? make them global defaults maybe? static const float hardCodedcrankingFuelBins[8] = {-20.0, -10.0, 3.6799927, 22.77002, 34.049805, 49.95996, 65.0, 90.0}; static const float hardCodedcrankingFuelCoef[8] = {2.7999878, 2.2000122, 1.6900024, 1.2900009, 1.199997, 1.050003, 1.0, 1.0}; diff --git a/firmware/config/engines/mazda_miata_custom_hunchback.cpp b/firmware/config/engines/mazda_miata_custom_hunchback.cpp index 0ba2b21e9d..75ad5466af 100644 --- a/firmware/config/engines/mazda_miata_custom_hunchback.cpp +++ b/firmware/config/engines/mazda_miata_custom_hunchback.cpp @@ -20,8 +20,6 @@ #include "ego.h" #include "thermistors.h" -EXTERN_CONFIG; - // todo: why would this not work? //extern const float mazda_miata_nb2_RpmBins[FUEL_RPM_COUNT]; //extern const float mazda_miata_nb2_LoadBins[FUEL_LOAD_COUNT]; diff --git a/firmware/config/engines/mazda_miata_na8.cpp b/firmware/config/engines/mazda_miata_na8.cpp index f0724f2445..c8363cede3 100644 --- a/firmware/config/engines/mazda_miata_na8.cpp +++ b/firmware/config/engines/mazda_miata_na8.cpp @@ -13,8 +13,6 @@ #include "custom_engine.h" #include "mazda_miata_1_6.h" -EXTERN_CONFIG; - /** * 1994, 1995 NA * Note that ODB-II car have different wiring! diff --git a/firmware/config/engines/mazda_miata_nb.cpp b/firmware/config/engines/mazda_miata_nb.cpp index 44ddcacac4..1a10332ed3 100644 --- a/firmware/config/engines/mazda_miata_nb.cpp +++ b/firmware/config/engines/mazda_miata_nb.cpp @@ -15,8 +15,6 @@ #include "mazda_miata_nb.h" #include "thermistors.h" -EXTERN_CONFIG; - void setMazdaMiataNb1EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); diff --git a/firmware/config/engines/mazda_miata_vvt.cpp b/firmware/config/engines/mazda_miata_vvt.cpp index c7bd97e7b3..1d2adb990b 100644 --- a/firmware/config/engines/mazda_miata_vvt.cpp +++ b/firmware/config/engines/mazda_miata_vvt.cpp @@ -54,8 +54,6 @@ #include "mazda_miata_base_maps.h" #include "hip9011_logic.h" -EXTERN_CONFIG; - static const float injectorLagBins[VBAT_INJECTOR_CURVE_SIZE] = { 6.0, 8.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0 diff --git a/firmware/config/engines/me7pnp.cpp b/firmware/config/engines/me7pnp.cpp index 5b5f12e0d6..e33e764b30 100644 --- a/firmware/config/engines/me7pnp.cpp +++ b/firmware/config/engines/me7pnp.cpp @@ -14,8 +14,6 @@ #include "engine_configuration.h" #include "cj125.h" -EXTERN_ENGINE; - /** * set engine_type 102 */ diff --git a/firmware/config/engines/mitsubishi.cpp b/firmware/config/engines/mitsubishi.cpp index 3e3ce6d9f0..6e2d80fce7 100644 --- a/firmware/config/engines/mitsubishi.cpp +++ b/firmware/config/engines/mitsubishi.cpp @@ -14,8 +14,6 @@ #include "mitsubishi.h" #include "allsensors.h" -EXTERN_CONFIG; - void setMitsubishiConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); diff --git a/firmware/config/engines/nissan_primera.cpp b/firmware/config/engines/nissan_primera.cpp index a5b49d5c1f..c9a494d5b2 100644 --- a/firmware/config/engines/nissan_primera.cpp +++ b/firmware/config/engines/nissan_primera.cpp @@ -12,8 +12,6 @@ #include "nissan_primera.h" -EXTERN_CONFIG; - void setNissanPrimeraEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); diff --git a/firmware/config/engines/nissan_vq.cpp b/firmware/config/engines/nissan_vq.cpp index 2dde2b354f..e4e4886a61 100644 --- a/firmware/config/engines/nissan_vq.cpp +++ b/firmware/config/engines/nissan_vq.cpp @@ -7,8 +7,6 @@ #include "nissan_vq.h" -EXTERN_CONFIG; - void setHellen121nissan(DECLARE_CONFIG_PARAMETER_SIGNATURE) { engineConfiguration->trigger.type = TT_NISSAN_VQ; diff --git a/firmware/config/engines/sachs.cpp b/firmware/config/engines/sachs.cpp index 4228379b9d..d920eb64c1 100644 --- a/firmware/config/engines/sachs.cpp +++ b/firmware/config/engines/sachs.cpp @@ -12,8 +12,6 @@ #include "allsensors.h" #include "engine_math.h" -EXTERN_CONFIG; - void setSachs(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); diff --git a/firmware/config/engines/subaru.cpp b/firmware/config/engines/subaru.cpp index 5d628fb842..6f3f516987 100644 --- a/firmware/config/engines/subaru.cpp +++ b/firmware/config/engines/subaru.cpp @@ -12,8 +12,6 @@ #include "custom_engine.h" #include "allsensors.h" -EXTERN_CONFIG; - void setSubaru2003Wrx(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setFrankenso_01_LCD(engineConfiguration); setFrankenso0_1_joystick(engineConfiguration); diff --git a/firmware/config/engines/test_engine.cpp b/firmware/config/engines/test_engine.cpp index 4884980bde..8834560c6e 100644 --- a/firmware/config/engines/test_engine.cpp +++ b/firmware/config/engines/test_engine.cpp @@ -15,8 +15,6 @@ #include "test_engine.h" #include "engine_math.h" -EXTERN_CONFIG; - // TEST_ENGINE void setTestEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); diff --git a/firmware/config/engines/toyota_jzs147.cpp b/firmware/config/engines/toyota_jzs147.cpp index ce904f944d..28bce0bf61 100644 --- a/firmware/config/engines/toyota_jzs147.cpp +++ b/firmware/config/engines/toyota_jzs147.cpp @@ -22,8 +22,6 @@ #include "thermistors.h" #include "mazda_miata_vvt.h" -EXTERN_CONFIG; - static void common2jz(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); // default pinout diff --git a/firmware/config/engines/vw.cpp b/firmware/config/engines/vw.cpp index 7e888af25d..3dfd452c04 100644 --- a/firmware/config/engines/vw.cpp +++ b/firmware/config/engines/vw.cpp @@ -13,8 +13,6 @@ #include "ego.h" #include "engine_math.h" -EXTERN_CONFIG; - // VW_ABA // set engine_type 32 void setVwAba(DECLARE_CONFIG_PARAMETER_SIGNATURE) { diff --git a/firmware/config/engines/vw_b6.cpp b/firmware/config/engines/vw_b6.cpp index 3cf23c5a15..8ecd45ba89 100644 --- a/firmware/config/engines/vw_b6.cpp +++ b/firmware/config/engines/vw_b6.cpp @@ -11,8 +11,6 @@ #include "table_helper.h" #include "map.h" -EXTERN_CONFIG; - /** * set engine_type 62 * VW_B6 diff --git a/firmware/console/binary/bluetooth.cpp b/firmware/console/binary/bluetooth.cpp index a6ae938165..51d09014e9 100644 --- a/firmware/console/binary/bluetooth.cpp +++ b/firmware/console/binary/bluetooth.cpp @@ -44,8 +44,6 @@ static THD_WORKING_AREA(btThreadStack, UTILITY_THREAD_STACK_SIZE); static thread_t *btThread = nullptr; static thread_reference_t btThreadRef = nullptr; // used by thread suspend/resume as a flag -EXTERN_ENGINE; - // Main communication code // We assume that the user has disconnected the software before starting the code. diff --git a/firmware/console/binary/tooth_logger.cpp b/firmware/console/binary/tooth_logger.cpp index 12ffb2be97..9215d3c322 100644 --- a/firmware/console/binary/tooth_logger.cpp +++ b/firmware/console/binary/tooth_logger.cpp @@ -12,8 +12,6 @@ #if EFI_TOOTH_LOGGER -EXTERN_ENGINE; - #include #include "efitime.h" #include "efilib.h" diff --git a/firmware/console/binary/tunerstudio.cpp b/firmware/console/binary/tunerstudio.cpp index 78c1ff9bf1..bc5fa98659 100644 --- a/firmware/console/binary/tunerstudio.cpp +++ b/firmware/console/binary/tunerstudio.cpp @@ -97,8 +97,6 @@ #if EFI_TUNER_STUDIO -EXTERN_ENGINE; - /* 1S */ #define TS_COMMUNICATION_TIMEOUT TIME_MS2I(1000) diff --git a/firmware/console/binary/tunerstudio_io.cpp b/firmware/console/binary/tunerstudio_io.cpp index c8df7da382..b272940395 100644 --- a/firmware/console/binary/tunerstudio_io.cpp +++ b/firmware/console/binary/tunerstudio_io.cpp @@ -13,8 +13,6 @@ #include "rusEfiFunctionalTest.h" #endif // EFI_SIMULATOR -EXTERN_ENGINE; - #if EFI_PROD_CODE || EFI_SIMULATOR size_t TsChannelBase::read(uint8_t* buffer, size_t size) { return readTimeout(buffer, size, SR5_READ_TIMEOUT); diff --git a/firmware/console/binary/tunerstudio_io_serial_ports.cpp b/firmware/console/binary/tunerstudio_io_serial_ports.cpp index 7a9a679361..07de81988b 100644 --- a/firmware/console/binary/tunerstudio_io_serial_ports.cpp +++ b/firmware/console/binary/tunerstudio_io_serial_ports.cpp @@ -11,8 +11,6 @@ #include "tunerstudio_io.h" #include "connector_uart_dma.h" -EXTERN_ENGINE; - #if (!defined(TS_NO_PRIMARY) && (defined(TS_PRIMARY_UART) || defined(TS_PRIMARY_SERIAL))) #define HAS_PRIMARY true #else diff --git a/firmware/console/console_io.cpp b/firmware/console/console_io.cpp index e603dacc95..3433297981 100644 --- a/firmware/console/console_io.cpp +++ b/firmware/console/console_io.cpp @@ -45,8 +45,6 @@ #include "rusEfiFunctionalTest.h" #endif /*EFI_SIMULATOR */ -EXTERN_ENGINE; - bool consoleByteArrived = false; void onDataArrived(bool valid) { diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 1985e2fb75..b8352895d4 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -141,8 +141,6 @@ static uint64_t binaryLogCount = 0; #endif /* EFI_FILE_LOGGING */ -EXTERN_ENGINE; - /** * This is useful if we are changing engine mode dynamically * For example http://rusefi.com/forum/viewtopic.php?f=5&t=1085 diff --git a/firmware/controllers/actuators/ac_control.cpp b/firmware/controllers/actuators/ac_control.cpp index 97319c20e9..84a1beb87e 100644 --- a/firmware/controllers/actuators/ac_control.cpp +++ b/firmware/controllers/actuators/ac_control.cpp @@ -6,8 +6,6 @@ #include "sensor.h" #include "tunerstudio_outputs.h" -EXTERN_ENGINE; - // Deadbands to prevent rapid switching on/off of AC static Deadband<200> maxRpmDeadband; static Deadband<5> maxCltDeadband; diff --git a/firmware/controllers/actuators/alternator_controller.cpp b/firmware/controllers/actuators/alternator_controller.cpp index 98ac944dd4..bfe6d853c5 100644 --- a/firmware/controllers/actuators/alternator_controller.cpp +++ b/firmware/controllers/actuators/alternator_controller.cpp @@ -29,8 +29,6 @@ #error "Unexpected OS ACCESS HERE" #endif /* HAS_OS_ACCESS */ -EXTERN_ENGINE; - static SimplePwm alternatorControl("alt"); static PidIndustrial alternatorPid(&persistentState.persistentConfiguration.engineConfiguration.alternatorControl); diff --git a/firmware/controllers/actuators/boost_control.cpp b/firmware/controllers/actuators/boost_control.cpp index 9352cd463e..b38aca70a7 100644 --- a/firmware/controllers/actuators/boost_control.cpp +++ b/firmware/controllers/actuators/boost_control.cpp @@ -25,8 +25,6 @@ #error "Unexpected OS ACCESS HERE" #endif -EXTERN_ENGINE; - static boostOpenLoop_Map3D_t boostMapOpen; static boostOpenLoop_Map3D_t boostMapClosed; static SimplePwm boostPwmControl("boost"); diff --git a/firmware/controllers/actuators/dc_motors.cpp b/firmware/controllers/actuators/dc_motors.cpp index fd4c75f1c1..87607a74ff 100644 --- a/firmware/controllers/actuators/dc_motors.cpp +++ b/firmware/controllers/actuators/dc_motors.cpp @@ -17,8 +17,6 @@ #include "efi_gpio.h" #include "pwm_generator_logic.h" -EXTERN_ENGINE; - class DcHardware { private: OutputPin m_pinEnable; diff --git a/firmware/controllers/actuators/electronic_throttle.cpp b/firmware/controllers/actuators/electronic_throttle.cpp index 49f9711fa5..673cbaabe8 100644 --- a/firmware/controllers/actuators/electronic_throttle.cpp +++ b/firmware/controllers/actuators/electronic_throttle.cpp @@ -95,8 +95,6 @@ static pedal2tps_t pedal2tpsMap; -EXTERN_ENGINE; - constexpr float etbPeriodSeconds = 1.0f / ETB_LOOP_FREQUENCY; static bool startupPositionError = false; diff --git a/firmware/controllers/actuators/fan_control.cpp b/firmware/controllers/actuators/fan_control.cpp index 54f3972576..e07cbd8a78 100644 --- a/firmware/controllers/actuators/fan_control.cpp +++ b/firmware/controllers/actuators/fan_control.cpp @@ -5,8 +5,6 @@ #include "efi_gpio.h" #include "sensor.h" -EXTERN_ENGINE; - 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 c4ab489bae..fbae874cd9 100644 --- a/firmware/controllers/actuators/gppwm/gppwm.cpp +++ b/firmware/controllers/actuators/gppwm/gppwm.cpp @@ -6,8 +6,6 @@ #include "gppwm_channel.h" #include "pwm_generator_logic.h" -EXTERN_ENGINE; - static GppwmChannel channels[GPPWM_CHANNELS]; static OutputPin pins[GPPWM_CHANNELS]; static SimplePwm outputs[GPPWM_CHANNELS]; diff --git a/firmware/controllers/actuators/gppwm/gppwm_channel.cpp b/firmware/controllers/actuators/gppwm/gppwm_channel.cpp index fd5fe5c1f5..0b3b7bfbf1 100644 --- a/firmware/controllers/actuators/gppwm/gppwm_channel.cpp +++ b/firmware/controllers/actuators/gppwm/gppwm_channel.cpp @@ -8,8 +8,6 @@ #include "sensor.h" #include "engine_math.h" -EXTERN_ENGINE; - expected readGppwmChannel(gppwm_channel_e channel DECLARE_ENGINE_PARAMETER_SUFFIX) { switch (channel) { case GPPWM_Tps: diff --git a/firmware/controllers/actuators/idle_hardware.cpp b/firmware/controllers/actuators/idle_hardware.cpp index 7628c440e1..a413ffbd7a 100644 --- a/firmware/controllers/actuators/idle_hardware.cpp +++ b/firmware/controllers/actuators/idle_hardware.cpp @@ -26,8 +26,6 @@ static DualHBridgeStepper iacHbridgeHw; StepperMotor iacMotor; #endif /* EFI_UNIT_TEST */ -EXTERN_ENGINE; - /** * When the IAC position value change is insignificant (lower than this threshold), leave the poor valve alone * todo: why do we have this logic? is this ever useful? diff --git a/firmware/controllers/actuators/idle_thread.cpp b/firmware/controllers/actuators/idle_thread.cpp index 1a95f9ea98..548a627aba 100644 --- a/firmware/controllers/actuators/idle_thread.cpp +++ b/firmware/controllers/actuators/idle_thread.cpp @@ -47,8 +47,6 @@ #include "stepper.h" #endif -EXTERN_ENGINE; - // todo: move all static vars to engine->engineState.idle? static bool shouldResetPid = false; diff --git a/firmware/controllers/actuators/pwm_tester.cpp b/firmware/controllers/actuators/pwm_tester.cpp index f59ad05bc1..1574aec264 100644 --- a/firmware/controllers/actuators/pwm_tester.cpp +++ b/firmware/controllers/actuators/pwm_tester.cpp @@ -19,8 +19,6 @@ static SimplePwm pwmTest[5]; extern OutputPin warningLedPin; -EXTERN_ENGINE; - static void startPwmTest(int freq) { efiPrintf("running pwm test @%d", freq); diff --git a/firmware/controllers/actuators/vvt.cpp b/firmware/controllers/actuators/vvt.cpp index a8b5da682d..6e6c175672 100644 --- a/firmware/controllers/actuators/vvt.cpp +++ b/firmware/controllers/actuators/vvt.cpp @@ -20,8 +20,6 @@ #error "Unexpected OS ACCESS HERE" #endif /* HAS_OS_ACCESS */ -EXTERN_ENGINE; - static fsio8_Map3D_u8t vvtTable1; static fsio8_Map3D_u8t vvtTable2; diff --git a/firmware/controllers/algo/accel_enrichment.cpp b/firmware/controllers/algo/accel_enrichment.cpp index f0c93c7c01..bbf1c19048 100644 --- a/firmware/controllers/algo/accel_enrichment.cpp +++ b/firmware/controllers/algo/accel_enrichment.cpp @@ -32,8 +32,6 @@ #include "tunerstudio_outputs.h" #endif /* EFI_TUNER_STUDIO */ -EXTERN_ENGINE; - static tps_tps_Map3D_t tpsTpsMap; void WallFuel::resetWF() { diff --git a/firmware/controllers/algo/advance_map.cpp b/firmware/controllers/algo/advance_map.cpp index d282fcff41..586cd93456 100644 --- a/firmware/controllers/algo/advance_map.cpp +++ b/firmware/controllers/algo/advance_map.cpp @@ -31,8 +31,6 @@ #if EFI_ENGINE_CONTROL -EXTERN_ENGINE; - static ign_Map3D_t advanceMap; static ign_Map3D_t iatAdvanceCorrectionMap; diff --git a/firmware/controllers/algo/airmass/airmass.cpp b/firmware/controllers/algo/airmass/airmass.cpp index 1046eef166..a51459cbf0 100644 --- a/firmware/controllers/algo/airmass/airmass.cpp +++ b/firmware/controllers/algo/airmass/airmass.cpp @@ -2,8 +2,6 @@ #include "sensor.h" #include "idle_thread.h" -EXTERN_ENGINE; - AirmassVeModelBase::AirmassVeModelBase(const ValueProvider3D& veTable) : m_veTable(&veTable) {} float AirmassVeModelBase::getVeLoadAxis(float passedLoad) const { diff --git a/firmware/controllers/algo/airmass/maf_airmass.cpp b/firmware/controllers/algo/airmass/maf_airmass.cpp index 42a6c6a09c..a0996a10d4 100644 --- a/firmware/controllers/algo/airmass/maf_airmass.cpp +++ b/firmware/controllers/algo/airmass/maf_airmass.cpp @@ -3,8 +3,6 @@ #include "maf_airmass.h" #include "maf.h" -EXTERN_ENGINE; - AirmassResult MafAirmass::getAirmass(int rpm) { float maf = Sensor::get(SensorType::Maf).value_or(0) + engine->engineLoadAccelEnrichment.getEngineLoadEnrichment(PASS_ENGINE_PARAMETER_SIGNATURE); return getAirmassImpl(maf, rpm); diff --git a/firmware/controllers/algo/airmass/speed_density_airmass.cpp b/firmware/controllers/algo/airmass/speed_density_airmass.cpp index 786fbb06da..f8dc76058c 100644 --- a/firmware/controllers/algo/airmass/speed_density_airmass.cpp +++ b/firmware/controllers/algo/airmass/speed_density_airmass.cpp @@ -3,8 +3,6 @@ #include "speed_density_airmass.h" #include "perf_trace.h" -EXTERN_ENGINE; - AirmassResult SpeedDensityAirmass::getAirmass(int rpm) { ScopePerf perf(PE::GetSpeedDensityFuel); diff --git a/firmware/controllers/algo/airmass/speed_density_base.cpp b/firmware/controllers/algo/airmass/speed_density_base.cpp index b40e1c8a13..d54aae04de 100644 --- a/firmware/controllers/algo/airmass/speed_density_base.cpp +++ b/firmware/controllers/algo/airmass/speed_density_base.cpp @@ -10,8 +10,6 @@ #include "global.h" #include "speed_density_base.h" -EXTERN_ENGINE; - /** * Derived via: * (8.31 J K mol^-1) <- ideal gas constant R diff --git a/firmware/controllers/algo/defaults/default_base_engine.cpp b/firmware/controllers/algo/defaults/default_base_engine.cpp index 372c4d4a3f..cbd7e3aab5 100644 --- a/firmware/controllers/algo/defaults/default_base_engine.cpp +++ b/firmware/controllers/algo/defaults/default_base_engine.cpp @@ -1,8 +1,6 @@ #include "defaults.h" #include "engine_configuration.h" -EXTERN_CONFIG; - 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 6c155c78d9..610341609f 100644 --- a/firmware/controllers/algo/defaults/default_cranking.cpp +++ b/firmware/controllers/algo/defaults/default_cranking.cpp @@ -2,8 +2,6 @@ #include "engine_configuration.h" #include "table_helper.h" -EXTERN_CONFIG; - void setDefaultCranking(DECLARE_CONFIG_PARAMETER_SIGNATURE) { engineConfiguration->cranking.rpm = 550; diff --git a/firmware/controllers/algo/defaults/default_fuel.cpp b/firmware/controllers/algo/defaults/default_fuel.cpp index e70bacc2ab..83f601ece2 100644 --- a/firmware/controllers/algo/defaults/default_fuel.cpp +++ b/firmware/controllers/algo/defaults/default_fuel.cpp @@ -3,8 +3,6 @@ #include "table_helper.h" #include "mazda_miata_vvt.h" -EXTERN_CONFIG; - static void setBosch02880155868(DECLARE_CONFIG_PARAMETER_SIGNATURE) { // http://www.boschdealer.com/specsheets/0280155868cs.jpg engineConfiguration->injector.battLagCorrBins[0] = 6; diff --git a/firmware/controllers/algo/defaults/default_ignition.cpp b/firmware/controllers/algo/defaults/default_ignition.cpp index 438c7aee0e..c65019a91e 100644 --- a/firmware/controllers/algo/defaults/default_ignition.cpp +++ b/firmware/controllers/algo/defaults/default_ignition.cpp @@ -3,8 +3,6 @@ #include "engine_math.h" #include "table_helper.h" -EXTERN_CONFIG; - static void setDefaultMultisparkParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) { // 1ms spark + 2ms dwell engineConfiguration->multisparkSparkDuration = 1000; diff --git a/firmware/controllers/algo/dynoview.cpp b/firmware/controllers/algo/dynoview.cpp index 0b4a32922b..9abe5630e5 100644 --- a/firmware/controllers/algo/dynoview.cpp +++ b/firmware/controllers/algo/dynoview.cpp @@ -17,8 +17,6 @@ extern TunerStudioOutputChannels tsOutputChannels; #endif /* EFI_TUNER_STUDIO */ -EXTERN_ENGINE; - DynoView dynoInstance; void DynoView::update(vssSrc src) { diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index 85752e860c..f949a14a9f 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -55,8 +55,6 @@ #include "gpio/tle8888.h" #endif -EXTERN_ENGINE; - #if EFI_ENGINE_SNIFFER #include "engine_sniffer.h" extern int waveChartUsedSize; diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index 553a4c50ec..b1621d9624 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -404,4 +404,8 @@ void doScheduleStopEngine(DECLARE_ENGINE_PARAMETER_SIGNATURE); #define HW_CHECK_RPM 200 - +// These externs aren't needed for unit tests - everything is injected instead +#if !EFI_UNIT_TEST +extern Engine ___engine; +extern Engine *engine; +#endif // EFI_UNIT_TEST diff --git a/firmware/controllers/algo/engine2.cpp b/firmware/controllers/algo/engine2.cpp index 703b27a569..7c63e19769 100644 --- a/firmware/controllers/algo/engine2.cpp +++ b/firmware/controllers/algo/engine2.cpp @@ -30,8 +30,6 @@ #include "status_loop.h" #endif -EXTERN_ENGINE; - WarningCodeState::WarningCodeState() { clear(); } diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index ba5d0c81ea..fd20b9a489 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -107,8 +107,6 @@ #include "tunerstudio.h" #endif -EXTERN_ENGINE; - //#define TS_DEFAULT_SPEED 115200 #define TS_DEFAULT_SPEED 38400 diff --git a/firmware/controllers/algo/engine_configuration.h b/firmware/controllers/algo/engine_configuration.h index cf80204a8a..3ceff4c9bc 100644 --- a/firmware/controllers/algo/engine_configuration.h +++ b/firmware/controllers/algo/engine_configuration.h @@ -59,3 +59,31 @@ void rememberCurrentConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE); void setBoardDefaultConfiguration(void); void setBoardConfigOverrides(void); + +#if !EFI_UNIT_TEST +extern engine_configuration_s *engineConfiguration; +extern persistent_config_container_s persistentState; +extern persistent_config_s *config; +#endif // EFI_UNIT_TEST + +/** + * & is reference in C++ (not C) + * Ref is a pointer that: + * you access with dot instead of arrow + * Cannot be null + * This is about EFI_ACTIVE_CONFIGURATION_IN_FLASH + */ +extern engine_configuration_s & activeConfiguration; + +#if ! EFI_ACTIVE_CONFIGURATION_IN_FLASH +// We store a special changeable copy of configuration is RAM, so we can just compare them +#define isConfigurationChanged(x) (engineConfiguration->x != activeConfiguration.x) +#else +// We cannot call prepareVoidConfiguration() for activeConfiguration if it's stored in flash, +// so we need to tell the firmware that it's "void" (i.e. zeroed, invalid) by setting a special flag variable, +// and then we consider 'x' as changed if it's just non-zero. +extern bool isActiveConfigurationVoid; +#define isConfigurationChanged(x) ((engineConfiguration->x != activeConfiguration.x) || (isActiveConfigurationVoid && engineConfiguration->x != 0)) +#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */ + +#define isPinOrModeChanged(pin, mode) (isConfigurationChanged(pin) || isConfigurationChanged(mode)) diff --git a/firmware/controllers/algo/fuel/fuel_computer.cpp b/firmware/controllers/algo/fuel/fuel_computer.cpp index 22da95cd39..95a5f32db1 100644 --- a/firmware/controllers/algo/fuel/fuel_computer.cpp +++ b/firmware/controllers/algo/fuel/fuel_computer.cpp @@ -1,8 +1,6 @@ #include "fuel_computer.h" #include "map.h" -EXTERN_ENGINE; - mass_t FuelComputerBase::getCycleFuel(mass_t airmass, int rpm, float load) const { load = getTargetLambdaLoadAxis(load); diff --git a/firmware/controllers/algo/fuel/injector_model.cpp b/firmware/controllers/algo/fuel/injector_model.cpp index 4d4cff09ca..412c4abe56 100644 --- a/firmware/controllers/algo/fuel/injector_model.cpp +++ b/firmware/controllers/algo/fuel/injector_model.cpp @@ -2,8 +2,6 @@ #include "tunerstudio_outputs.h" #include "map.h" -EXTERN_ENGINE; - void InjectorModelBase::prepare() { m_massFlowRate = getInjectorMassFlowRate(); float deadtime = getDeadtime(); diff --git a/firmware/controllers/algo/fuel_math.cpp b/firmware/controllers/algo/fuel_math.cpp index 0b85bd0482..92f629e650 100644 --- a/firmware/controllers/algo/fuel_math.cpp +++ b/firmware/controllers/algo/fuel_math.cpp @@ -40,8 +40,6 @@ #include "speed_density_base.h" #include "lua_hooks.h" -EXTERN_ENGINE; - static fuel_Map3D_t fuelPhaseMap; extern fuel_Map3D_t veMap; extern lambda_Map3D_t lambdaMap; diff --git a/firmware/controllers/algo/launch_control.cpp b/firmware/controllers/algo/launch_control.cpp index 5dabe6082b..5005c1f2a3 100644 --- a/firmware/controllers/algo/launch_control.cpp +++ b/firmware/controllers/algo/launch_control.cpp @@ -33,8 +33,6 @@ LaunchControlBase launchInstance; extern TunerStudioOutputChannels tsOutputChannels; #endif /* EFI_TUNER_STUDIO */ -EXTERN_ENGINE; - static int retardThresholdRpm; /** diff --git a/firmware/controllers/bench_test.cpp b/firmware/controllers/bench_test.cpp index cf791e9c6d..510e91e5fb 100644 --- a/firmware/controllers/bench_test.cpp +++ b/firmware/controllers/bench_test.cpp @@ -58,8 +58,6 @@ #include "gpio/tle8888.h" #endif // BOARD_TLE8888_COUNT -EXTERN_ENGINE; - static bool isRunningBench = false; bool isRunningBenchTest(void) { diff --git a/firmware/controllers/buttonshift.cpp b/firmware/controllers/buttonshift.cpp index f1dc8414d8..56b3a498d5 100644 --- a/firmware/controllers/buttonshift.cpp +++ b/firmware/controllers/buttonshift.cpp @@ -8,8 +8,6 @@ #include "buttonshift.h" #include "engine.h" -EXTERN_ENGINE; - ButtonShiftController buttonShiftController; diff --git a/firmware/controllers/can/can_dash.cpp b/firmware/controllers/can/can_dash.cpp index 5628cd9edd..4502b20b84 100644 --- a/firmware/controllers/can/can_dash.cpp +++ b/firmware/controllers/can/can_dash.cpp @@ -19,8 +19,6 @@ #include "vehicle_speed.h" #include "rtc_helper.h" #include "fuel_math.h" -EXTERN_ENGINE; - // CAN Bus ID for broadcast /** * e46 data is from http://forums.bimmerforums.com/forum/showthread.php?1887229 diff --git a/firmware/controllers/can/can_rx.cpp b/firmware/controllers/can/can_rx.cpp index ba3514be10..383486bb46 100644 --- a/firmware/controllers/can/can_rx.cpp +++ b/firmware/controllers/can/can_rx.cpp @@ -11,9 +11,6 @@ #include "global.h" #include "engine.h" -EXTERN_ENGINE -; - typedef float fsio_table_8x8_f32t_linear[FSIO_TABLE_8 * FSIO_TABLE_8]; bool acceptCanRx(int sid DECLARE_ENGINE_PARAMETER_SUFFIX) { diff --git a/firmware/controllers/can/can_tx.cpp b/firmware/controllers/can/can_tx.cpp index 341e1a4c34..ce511de5f8 100644 --- a/firmware/controllers/can/can_tx.cpp +++ b/firmware/controllers/can/can_tx.cpp @@ -19,8 +19,6 @@ #include "thread_priority.h" #include "rusefi_wideband.h" -EXTERN_ENGINE; - extern CanListener* canListeners_head; diff --git a/firmware/controllers/can/can_verbose.cpp b/firmware/controllers/can/can_verbose.cpp index 7754439756..ed38d7c54c 100644 --- a/firmware/controllers/can/can_verbose.cpp +++ b/firmware/controllers/can/can_verbose.cpp @@ -20,8 +20,6 @@ #include "spark_logic.h" #include "vehicle_speed.h" -EXTERN_ENGINE; - struct Status { uint16_t warningCounter; uint16_t lastErrorCode; diff --git a/firmware/controllers/can/can_vss.cpp b/firmware/controllers/can/can_vss.cpp index e3f9ba0a29..63b0f12849 100644 --- a/firmware/controllers/can/can_vss.cpp +++ b/firmware/controllers/can/can_vss.cpp @@ -15,8 +15,6 @@ #include "vehicle_speed.h" #include "dynoview.h" -EXTERN_ENGINE; - static bool isInit = false; static uint16_t filterCanID = 0; static efitick_t frameTime; diff --git a/firmware/controllers/can/obd2.cpp b/firmware/controllers/can/obd2.cpp index ae7a411f56..416c104ddb 100644 --- a/firmware/controllers/can/obd2.cpp +++ b/firmware/controllers/can/obd2.cpp @@ -37,8 +37,6 @@ #include "fuel_math.h" #include "thermistors.h" -EXTERN_ENGINE; - static const int16_t supportedPids0120[] = { PID_MONITOR_STATUS, PID_FUEL_SYSTEM_STATUS, diff --git a/firmware/controllers/can/rusefi_wideband.cpp b/firmware/controllers/can/rusefi_wideband.cpp index 3a45e22483..df72021a41 100644 --- a/firmware/controllers/can/rusefi_wideband.cpp +++ b/firmware/controllers/can/rusefi_wideband.cpp @@ -12,8 +12,6 @@ // This array contains the firmware image for the wideband contoller #include "wideband_firmware/for_rusefi/wideband_image.h" -EXTERN_ENGINE; - #define EVT_BOOTLOADER_ACK EVENT_MASK(0) static thread_t* waitingBootloaderThread = nullptr; diff --git a/firmware/controllers/core/common_headers.h b/firmware/controllers/core/common_headers.h index 414f943b08..f814abb824 100644 --- a/firmware/controllers/core/common_headers.h +++ b/firmware/controllers/core/common_headers.h @@ -75,20 +75,6 @@ #define DISPLAY_SENSOR(x) {} #define DISPLAY_IF(x) x -#if ! EFI_ACTIVE_CONFIGURATION_IN_FLASH -// We store a special changeable copy of configuration is RAM, so we can just compare them -#define isConfigurationChanged(x) (engineConfiguration->x != activeConfiguration.x) -#else -// We cannot call prepareVoidConfiguration() for activeConfiguration if it's stored in flash, -// so we need to tell the firmware that it's "void" (i.e. zeroed, invalid) by setting a special flag variable, -// and then we consider 'x' as changed if it's just non-zero. -extern bool isActiveConfigurationVoid; -#define isConfigurationChanged(x) ((engineConfiguration->x != activeConfiguration.x) || (isActiveConfigurationVoid && engineConfiguration->x != 0)) -#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */ - -#define isPinOrModeChanged(pin, mode) (isConfigurationChanged(pin) || isConfigurationChanged(mode)) - - #ifndef FIRMWARE_ID #define FIRMWARE_ID "source" #endif diff --git a/firmware/controllers/core/engine_ptr.h b/firmware/controllers/core/engine_ptr.h index 2062790314..28133c4e3b 100644 --- a/firmware/controllers/core/engine_ptr.h +++ b/firmware/controllers/core/engine_ptr.h @@ -19,7 +19,6 @@ class Engine; #endif // def __cplusplus - struct engine_configuration_s; struct persistent_config_s; @@ -49,12 +48,9 @@ struct persistent_config_s; #define PASS_ENGINE_PARAMETER_SIGNATURE engine, PASS_CONFIG_PARAMETER_SIGNATURE #define PASS_ENGINE_PARAMETER_SUFFIX , PASS_ENGINE_PARAMETER_SIGNATURE - #define EXTERN_ENGINE extern EnginePins enginePins; \ - extern engine_configuration_s & activeConfiguration + #define EXTERN_ENGINE extern engine_configuration_s & activeConfiguration #endif // def __cplusplus - #define EXTERN_CONFIG - #define DEFINE_CONFIG_PARAM(x, y) , x y #define PASS_CONFIG_PARAM(x) , x @@ -88,12 +84,6 @@ struct persistent_config_s; // Pass this after some other parameters are passed #define PASS_ENGINE_PARAMETER_SUFFIX - #define EXTERN_ENGINE \ - extern Engine ___engine; \ - extern Engine *engine; \ - EXTERN_CONFIG \ - extern EnginePins enginePins \ - #define ENGINE(x) ___engine.x #endif // def __cplusplus @@ -107,23 +97,6 @@ struct persistent_config_s; */ #define CONFIG(x) persistentState.persistentConfiguration.engineConfiguration.x - /** - * & is reference in C++ (not C) - * Ref is a pointer that: - * you access with dot instead of arrow - * Cannot be null - * This is about EFI_ACTIVE_CONFIGURATION_IN_FLASH - */ - #define EXTERN_CONFIG \ - EXTERN_ENGINE_CONFIGURATION \ - extern engine_configuration_s & activeConfiguration; \ - - #define EXTERN_ENGINE_CONFIGURATION \ - extern engine_configuration_s *engineConfiguration; \ - extern persistent_config_container_s persistentState; \ - extern persistent_config_s *config; - - #define DEFINE_CONFIG_PARAM(x, y) #define CONFIG_PARAM(x) CONFIG(x) #define PASS_CONFIG_PARAM(x) diff --git a/firmware/controllers/core/error_handling.cpp b/firmware/controllers/core/error_handling.cpp index 0bf52f25e4..f76675b84d 100644 --- a/firmware/controllers/core/error_handling.cpp +++ b/firmware/controllers/core/error_handling.cpp @@ -16,8 +16,6 @@ static critical_msg_t criticalErrorMessageBuffer; #include "HD44780.h" #endif /* EFI_HD44780_LCD */ -EXTERN_ENGINE; - extern int warningEnabled; bool hasFirmwareErrorFlag = false; diff --git a/firmware/controllers/core/fsio_core.cpp b/firmware/controllers/core/fsio_core.cpp index c70687e718..195f8c6275 100644 --- a/firmware/controllers/core/fsio_core.cpp +++ b/firmware/controllers/core/fsio_core.cpp @@ -21,8 +21,6 @@ #include "fsio_core.h" #include "fsio_impl.h" -EXTERN_ENGINE; - LENameOrdinalPair * LE_FIRST = nullptr; /** diff --git a/firmware/controllers/core/fsio_impl.cpp b/firmware/controllers/core/fsio_impl.cpp index bffb332f88..30b9ef4e88 100644 --- a/firmware/controllers/core/fsio_impl.cpp +++ b/firmware/controllers/core/fsio_impl.cpp @@ -16,8 +16,6 @@ #include "allsensors.h" #include "sensor.h" -EXTERN_ENGINE; - #if EFI_PROD_CODE // todo: that's about bench test mode, wrong header for sure! diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index d480b79c2d..db83a87009 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -101,8 +101,6 @@ #include "cj125.h" #endif /* EFI_CJ125 */ -EXTERN_ENGINE; - #if !EFI_UNIT_TEST /** diff --git a/firmware/controllers/engine_controller_misc.cpp b/firmware/controllers/engine_controller_misc.cpp index 805f05b03d..4e6e690405 100644 --- a/firmware/controllers/engine_controller_misc.cpp +++ b/firmware/controllers/engine_controller_misc.cpp @@ -10,8 +10,6 @@ #include "os_access.h" #include "settings.h" -EXTERN_ENGINE; - extern ButtonDebounce startStopButtonDebounce; static uint8_t nextThreadId = 0; diff --git a/firmware/controllers/engine_cycle/aux_valves.cpp b/firmware/controllers/engine_cycle/aux_valves.cpp index d0c2486ccb..1cf3c01bef 100644 --- a/firmware/controllers/engine_cycle/aux_valves.cpp +++ b/firmware/controllers/engine_cycle/aux_valves.cpp @@ -21,8 +21,6 @@ #include "trigger_central.h" #include "spark_logic.h" -EXTERN_ENGINE; - static void plainPinTurnOff(NamedOutputPin *output) { output->setLow(); } diff --git a/firmware/controllers/engine_cycle/fuel_schedule.cpp b/firmware/controllers/engine_cycle/fuel_schedule.cpp index d155d55b47..4a72c25047 100644 --- a/firmware/controllers/engine_cycle/fuel_schedule.cpp +++ b/firmware/controllers/engine_cycle/fuel_schedule.cpp @@ -9,8 +9,6 @@ #include "engine_math.h" #include "event_registry.h" -EXTERN_ENGINE; - #if EFI_ENGINE_CONTROL FuelSchedule::FuelSchedule() { diff --git a/firmware/controllers/engine_cycle/high_pressure_fuel_pump.cpp b/firmware/controllers/engine_cycle/high_pressure_fuel_pump.cpp index 6743ee9382..9c52c0dcf2 100644 --- a/firmware/controllers/engine_cycle/high_pressure_fuel_pump.cpp +++ b/firmware/controllers/engine_cycle/high_pressure_fuel_pump.cpp @@ -15,9 +15,6 @@ #if EFI_HPFP -EXTERN_ENGINE -; - #define LOBE_COUNT 3 class HpfpActor { diff --git a/firmware/controllers/engine_cycle/knock_logic.cpp b/firmware/controllers/engine_cycle/knock_logic.cpp index 94bab6814e..4597bfcc60 100644 --- a/firmware/controllers/engine_cycle/knock_logic.cpp +++ b/firmware/controllers/engine_cycle/knock_logic.cpp @@ -9,8 +9,6 @@ #include "knock_logic.h" #include "os_access.h" -EXTERN_ENGINE; - int getCylinderKnockBank(uint8_t cylinderIndex) { // C/C++ can't index in to bit fields, we have to provide lookup ourselves switch (cylinderIndex) { diff --git a/firmware/controllers/engine_cycle/main_trigger_callback.cpp b/firmware/controllers/engine_cycle/main_trigger_callback.cpp index 595d08f661..4a180d0ea2 100644 --- a/firmware/controllers/engine_cycle/main_trigger_callback.cpp +++ b/firmware/controllers/engine_cycle/main_trigger_callback.cpp @@ -59,8 +59,6 @@ #include "backup_ram.h" -EXTERN_ENGINE; - // todo: figure out if this even helps? //#if defined __GNUC__ //#define RAM_METHOD_PREFIX __attribute__((section(".ram"))) diff --git a/firmware/controllers/engine_cycle/map_averaging.cpp b/firmware/controllers/engine_cycle/map_averaging.cpp index 17cef4a64e..47b1f3a990 100644 --- a/firmware/controllers/engine_cycle/map_averaging.cpp +++ b/firmware/controllers/engine_cycle/map_averaging.cpp @@ -92,8 +92,6 @@ static int averagedMapBufIdx = 0; // this is 'minimal averaged' MAP within avegaging window static float currentPressure = NO_VALUE_YET; -EXTERN_ENGINE; - /** * here we have averaging start and averaging end points for each cylinder */ diff --git a/firmware/controllers/engine_cycle/rpm_calculator.cpp b/firmware/controllers/engine_cycle/rpm_calculator.cpp index 7188c8c3e4..778dc539bd 100644 --- a/firmware/controllers/engine_cycle/rpm_calculator.cpp +++ b/firmware/controllers/engine_cycle/rpm_calculator.cpp @@ -82,8 +82,6 @@ int RpmCalculator::getRpm() const { #if EFI_SHAFT_POSITION_INPUT -EXTERN_ENGINE; - RpmCalculator::RpmCalculator() : StoredValueSensor(SensorType::Rpm, 0) { diff --git a/firmware/controllers/engine_cycle/spark_logic.cpp b/firmware/controllers/engine_cycle/spark_logic.cpp index 16dd63a07a..4495f224b9 100644 --- a/firmware/controllers/engine_cycle/spark_logic.cpp +++ b/firmware/controllers/engine_cycle/spark_logic.cpp @@ -24,7 +24,6 @@ #include "tunerstudio_outputs.h" #endif /* EFI_TUNER_STUDIO */ -EXTERN_ENGINE; #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 652545ee2a..0825725369 100644 --- a/firmware/controllers/flash_main.cpp +++ b/firmware/controllers/flash_main.cpp @@ -26,8 +26,6 @@ static bool needToWriteConfiguration = false; -EXTERN_ENGINE; - extern persistent_config_container_s persistentState; extern engine_configuration_s *engineConfiguration; diff --git a/firmware/controllers/gauges/lcd_controller.cpp b/firmware/controllers/gauges/lcd_controller.cpp index ddd4534fec..7fe09ac6eb 100644 --- a/firmware/controllers/gauges/lcd_controller.cpp +++ b/firmware/controllers/gauges/lcd_controller.cpp @@ -43,8 +43,6 @@ #include "sensor.h" -EXTERN_ENGINE; - static MenuItem ROOT(NULL, NULL); static MenuTree tree(&ROOT); diff --git a/firmware/controllers/gauges/malfunction_indicator.cpp b/firmware/controllers/gauges/malfunction_indicator.cpp index 125090a2cc..65dfc05cee 100644 --- a/firmware/controllers/gauges/malfunction_indicator.cpp +++ b/firmware/controllers/gauges/malfunction_indicator.cpp @@ -37,8 +37,6 @@ #define TEST_MIL_CODE FALSE -EXTERN_ENGINE; - #define MFI_LONG_BLINK 1500 #define MFI_SHORT_BLINK 400 #define MFI_BLINK_SEPARATOR 400 diff --git a/firmware/controllers/gauges/tachometer.cpp b/firmware/controllers/gauges/tachometer.cpp index e8d59ccb79..f6f3c49359 100644 --- a/firmware/controllers/gauges/tachometer.cpp +++ b/firmware/controllers/gauges/tachometer.cpp @@ -12,8 +12,6 @@ #include "tachometer.h" #include "pwm_generator_logic.h" -EXTERN_ENGINE; - static SimplePwm tachControl("tach"); static float tachFreq; static float duty; diff --git a/firmware/controllers/limp_manager.cpp b/firmware/controllers/limp_manager.cpp index 693d2a16bc..1a824e969c 100644 --- a/firmware/controllers/limp_manager.cpp +++ b/firmware/controllers/limp_manager.cpp @@ -2,8 +2,6 @@ #include "engine.h" #include "efilib.h" -EXTERN_ENGINE; - void LimpManager::updateState(int rpm, efitick_t nowNt) { Clearable allowFuel = CONFIG(isInjectionEnabled); Clearable allowSpark = CONFIG(isIgnitionEnabled); diff --git a/firmware/controllers/lua/lua.cpp b/firmware/controllers/lua/lua.cpp index c584c646cf..95deec1bf2 100644 --- a/firmware/controllers/lua/lua.cpp +++ b/firmware/controllers/lua/lua.cpp @@ -16,8 +16,6 @@ #include "engine.h" #include "tunerstudio_outputs.h" -EXTERN_ENGINE; - #define LUA_HEAP_SIZE 20000 static memory_heap_t heap; diff --git a/firmware/controllers/lua/lua_hooks.cpp b/firmware/controllers/lua/lua_hooks.cpp index 4dbadea1ab..4d8d221f17 100644 --- a/firmware/controllers/lua/lua_hooks.cpp +++ b/firmware/controllers/lua/lua_hooks.cpp @@ -16,8 +16,6 @@ // Some functions lean on existing FSIO implementation #include "fsio_impl.h" -EXTERN_ENGINE; - static int lua_efi_print(lua_State* l) { auto msg = luaL_checkstring(l, 1); diff --git a/firmware/controllers/math/closed_loop_fuel.cpp b/firmware/controllers/math/closed_loop_fuel.cpp index 2aa9a0aa6b..691144daa6 100644 --- a/firmware/controllers/math/closed_loop_fuel.cpp +++ b/firmware/controllers/math/closed_loop_fuel.cpp @@ -7,8 +7,6 @@ #include "engine_math.h" #include "deadband.h" -EXTERN_ENGINE; - struct FuelingBank { ClosedLoopFuelCellImpl cells[STFT_CELL_COUNT]; }; diff --git a/firmware/controllers/math/closed_loop_fuel_cell.cpp b/firmware/controllers/math/closed_loop_fuel_cell.cpp index 68a642f3bd..43aba9197d 100644 --- a/firmware/controllers/math/closed_loop_fuel_cell.cpp +++ b/firmware/controllers/math/closed_loop_fuel_cell.cpp @@ -3,8 +3,6 @@ #include "engine_configuration_generated_structures.h" #include "sensor.h" -EXTERN_ENGINE; - constexpr float integrator_dt = FAST_CALLBACK_PERIOD_MS * 0.001f; void ClosedLoopFuelCellBase::update(float lambdaDeadband, bool ignoreErrorMagnitude DECLARE_ENGINE_PARAMETER_SUFFIX) diff --git a/firmware/controllers/math/engine_math.cpp b/firmware/controllers/math/engine_math.cpp index 0afda0c356..1a285b4334 100644 --- a/firmware/controllers/math/engine_math.cpp +++ b/firmware/controllers/math/engine_math.cpp @@ -30,7 +30,6 @@ #include "fuel_math.h" #include "advance_map.h" -EXTERN_ENGINE; #if EFI_UNIT_TEST extern bool verboseMode; #endif /* EFI_UNIT_TEST */ diff --git a/firmware/controllers/math/speed_density.cpp b/firmware/controllers/math/speed_density.cpp index 6da0b5370a..2033f3b4e1 100644 --- a/firmware/controllers/math/speed_density.cpp +++ b/firmware/controllers/math/speed_density.cpp @@ -24,8 +24,6 @@ #define rpmMin 500 #define rpmMax 8000 -EXTERN_ENGINE; - fuel_Map3D_t veMap; lambda_Map3D_t lambdaMap; baroCorr_Map3D_t baroCorrMap; diff --git a/firmware/controllers/sensors/AemXSeriesLambda.cpp b/firmware/controllers/sensors/AemXSeriesLambda.cpp index ffe054ece8..87245ff8ae 100644 --- a/firmware/controllers/sensors/AemXSeriesLambda.cpp +++ b/firmware/controllers/sensors/AemXSeriesLambda.cpp @@ -7,8 +7,6 @@ #if EFI_TUNER_STUDIO #include "tunerstudio_outputs.h" #include "engine.h" - -EXTERN_ENGINE; #endif AemXSeriesWideband::AemXSeriesWideband(uint8_t sensorIndex, SensorType type) diff --git a/firmware/controllers/sensors/allsensors.cpp b/firmware/controllers/sensors/allsensors.cpp index d5b1f6d353..6bacf683ff 100644 --- a/firmware/controllers/sensors/allsensors.cpp +++ b/firmware/controllers/sensors/allsensors.cpp @@ -11,8 +11,6 @@ #include "pin_repository.h" #include "allsensors.h" -EXTERN_ENGINE; - ButtonDebounce acDebounce("ac_switch"); void initSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) { diff --git a/firmware/controllers/sensors/ego.cpp b/firmware/controllers/sensors/ego.cpp index fc9cbbc8e7..d88ef3dcee 100644 --- a/firmware/controllers/sensors/ego.cpp +++ b/firmware/controllers/sensors/ego.cpp @@ -21,8 +21,6 @@ #include "cj125.h" #endif /* EFI_CJ125 */ -EXTERN_ENGINE; - #ifdef EFI_NARROW_EGO_AVERAGING // Needed by narrow EGOs (see updateEgoAverage()). // getAfr() is called at ~50Hz, so we store at most (1<<3)*32 EGO values for ~5 secs. diff --git a/firmware/controllers/sensors/flex_sensor.cpp b/firmware/controllers/sensors/flex_sensor.cpp index ece994ea49..a63dca5b14 100644 --- a/firmware/controllers/sensors/flex_sensor.cpp +++ b/firmware/controllers/sensors/flex_sensor.cpp @@ -2,8 +2,6 @@ #include "digital_input_exti.h" #include "flex_sensor.h" -EXTERN_ENGINE; - static void flexExtiCallback(void* arg) { auto inst = reinterpret_cast(arg); inst->onEdge(getTimeNowNt()); diff --git a/firmware/controllers/sensors/maf.cpp b/firmware/controllers/sensors/maf.cpp index ce9be0c7a5..d0ea2643aa 100644 --- a/firmware/controllers/sensors/maf.cpp +++ b/firmware/controllers/sensors/maf.cpp @@ -2,8 +2,6 @@ #include "engine.h" #include "maf.h" -EXTERN_ENGINE; - static void fillTheRest(persistent_config_s *e, int i) { /** * unrealistic values just to make binary search happy diff --git a/firmware/controllers/sensors/map.cpp b/firmware/controllers/sensors/map.cpp index 2cff89e937..36a20fa52a 100644 --- a/firmware/controllers/sensors/map.cpp +++ b/firmware/controllers/sensors/map.cpp @@ -22,8 +22,6 @@ #if EFI_ANALOG_SENSORS -EXTERN_ENGINE; - static FastInterpolation customMap; static efitick_t prevWidthTimeNt = 0; diff --git a/firmware/controllers/sensors/software_knock.cpp b/firmware/controllers/sensors/software_knock.cpp index a604451821..1d814fc62d 100644 --- a/firmware/controllers/sensors/software_knock.cpp +++ b/firmware/controllers/sensors/software_knock.cpp @@ -10,8 +10,6 @@ #if EFI_SOFTWARE_KNOCK -EXTERN_ENGINE; - #include "knock_config.h" #include "ch.hpp" diff --git a/firmware/controllers/sensors/tps.cpp b/firmware/controllers/sensors/tps.cpp index 877fb872c0..6b5433da63 100644 --- a/firmware/controllers/sensors/tps.cpp +++ b/firmware/controllers/sensors/tps.cpp @@ -8,8 +8,6 @@ #include "settings.h" #endif /* EFI_PROD_CODE */ -EXTERN_ENGINE; - void grabTPSIsClosed() { #if EFI_PROD_CODE printTPSInfo(); diff --git a/firmware/controllers/serial/serial_rx.cpp b/firmware/controllers/serial/serial_rx.cpp index 4cfced0ffc..6e13362366 100644 --- a/firmware/controllers/serial/serial_rx.cpp +++ b/firmware/controllers/serial/serial_rx.cpp @@ -19,8 +19,6 @@ #include "vehicle_speed.h" #include "thread_priority.h" -EXTERN_ENGINE; - uint8_t ser_buffer[SERBUFFLEN] = {}; size_t innovate_msg_len = 1; innovate_serial_id_state_t innovate_serial_id_state = UNKNOWN; diff --git a/firmware/controllers/serial/serial_sensor.cpp b/firmware/controllers/serial/serial_sensor.cpp index 53ccd6ba83..f3c51ee231 100644 --- a/firmware/controllers/serial/serial_sensor.cpp +++ b/firmware/controllers/serial/serial_sensor.cpp @@ -15,8 +15,6 @@ #define NUM_INNOVATE_O2_SENSORS 1 #define AFR_MULTIPLIER 147 -EXTERN_ENGINE; - volatile float InnovateLC2AFR = AFR_ERROR; typedef enum diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index 201ab80fb9..56ea1c98ac 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -57,8 +57,6 @@ extern WaveChart waveChart; #define SETTINGS_LOGGING_BUFFER_SIZE 1000 #endif /* SETTINGS_LOGGING_BUFFER_SIZE */ -EXTERN_ENGINE; - void printSpiState(const engine_configuration_s *engineConfiguration) { efiPrintf("spi 1=%s/2=%s/3=%s/4=%s", boolToString(engineConfiguration->is_enabled_spi_1), diff --git a/firmware/controllers/simple_tcu.cpp b/firmware/controllers/simple_tcu.cpp index cb86d648e6..813604110b 100644 --- a/firmware/controllers/simple_tcu.cpp +++ b/firmware/controllers/simple_tcu.cpp @@ -3,8 +3,6 @@ #include "tunerstudio_outputs.h" #include "engine_configuration.h" -EXTERN_ENGINE; - void SimpleTransmissionController::init() { for (size_t i = 0; i < efi::size(CONFIG(tcu_solenoid)); i++) { enginePins.tcuSolenoids[i].initPin("Transmission Solenoid", CONFIG(tcu_solenoid)[i], &CONFIG(tcu_solenoid_mode)[i]); diff --git a/firmware/controllers/start_stop.cpp b/firmware/controllers/start_stop.cpp index f6d5ed0e2f..1b9fdba554 100644 --- a/firmware/controllers/start_stop.cpp +++ b/firmware/controllers/start_stop.cpp @@ -1,8 +1,6 @@ #include "start_stop.h" #include "engine.h" -EXTERN_ENGINE; - ButtonDebounce startStopButtonDebounce("start_button"); void initStartStopButton(DECLARE_ENGINE_PARAMETER_SIGNATURE) { diff --git a/firmware/controllers/system/efi_gpio.cpp b/firmware/controllers/system/efi_gpio.cpp index 7535702c98..c84f4af455 100644 --- a/firmware/controllers/system/efi_gpio.cpp +++ b/firmware/controllers/system/efi_gpio.cpp @@ -23,8 +23,6 @@ #include "electronic_throttle.h" #endif /* EFI_ELECTRONIC_THROTTLE_BODY */ -EXTERN_ENGINE; - #if EFI_ENGINE_SNIFFER #include "engine_sniffer.h" extern WaveChart waveChart; diff --git a/firmware/controllers/system/efi_gpio.h b/firmware/controllers/system/efi_gpio.h index 0f20768af6..868b606dc1 100644 --- a/firmware/controllers/system/efi_gpio.h +++ b/firmware/controllers/system/efi_gpio.h @@ -254,3 +254,5 @@ const char *portname(ioportid_t GPIOx); void printSpiConfig(const char *msg, spi_device_e device); brain_pin_e parseBrainPin(const char *str); const char *hwPortname(brain_pin_e brainPin); + +extern EnginePins enginePins; diff --git a/firmware/controllers/system/timer/pwm_generator_logic.cpp b/firmware/controllers/system/timer/pwm_generator_logic.cpp index 18671e5233..f622c943cd 100644 --- a/firmware/controllers/system/timer/pwm_generator_logic.cpp +++ b/firmware/controllers/system/timer/pwm_generator_logic.cpp @@ -13,8 +13,6 @@ #include "pwm_generator_logic.h" #include "perf_trace.h" -EXTERN_ENGINE; - #if EFI_PROD_CODE #include "mpu_util.h" #include "engine.h" diff --git a/firmware/controllers/system/timer/single_timer_executor.cpp b/firmware/controllers/system/timer/single_timer_executor.cpp index 8503259286..69a43b5651 100644 --- a/firmware/controllers/system/timer/single_timer_executor.cpp +++ b/firmware/controllers/system/timer/single_timer_executor.cpp @@ -33,8 +33,6 @@ #include "os_util.h" #include "engine.h" -EXTERN_ENGINE; - uint32_t hwSetTimerDuration; void globalTimerCallback() { diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index 40cd1c662c..a7e882332a 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -44,8 +44,6 @@ #include "engine_configuration.h" extern persistent_config_container_s persistentState; -EXTERN_ENGINE; - 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/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index 6e147e77a9..a76e992faf 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -79,8 +79,6 @@ int TriggerCentral::getHwEventCounter(int index) const { #if EFI_SHAFT_POSITION_INPUT -EXTERN_ENGINE; - angle_t TriggerCentral::getVVTPosition(uint8_t bankIndex, uint8_t camIndex) { if (bankIndex >= BANKS_COUNT || camIndex >= CAMS_PER_BANK) { return NAN; @@ -621,8 +619,6 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta } } -EXTERN_ENGINE; - static void triggerShapeInfo(void) { #if EFI_PROD_CODE || EFI_SIMULATOR TriggerWaveform *shape = &engine->triggerCentral.triggerShape; diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index 1dfce28b89..1866d9b9cd 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -109,8 +109,6 @@ TriggerStateWithRunningStatistics::TriggerStateWithRunningStatistics() : #if EFI_SHAFT_POSITION_INPUT -EXTERN_ENGINE; - #if ! EFI_PROD_CODE bool printTriggerDebug = false; bool printTriggerTrace = false; diff --git a/firmware/controllers/trigger/trigger_emulator_algo.cpp b/firmware/controllers/trigger/trigger_emulator_algo.cpp index 64e6d7227f..4dfe57c72e 100644 --- a/firmware/controllers/trigger/trigger_emulator_algo.cpp +++ b/firmware/controllers/trigger/trigger_emulator_algo.cpp @@ -43,8 +43,6 @@ bool needEvent(const int currentIndex, const int size, const MultiChannelStateSe TriggerEmulatorHelper::TriggerEmulatorHelper() { } -EXTERN_ENGINE; - static OutputPin emulatorOutputs[PWM_PHASE_MAX_WAVE_PER_PWM]; void TriggerEmulatorHelper::handleEmulatorCallback(const int size, const MultiChannelStateSequence& multiChannelStateSequence, int stateIndex DECLARE_ENGINE_PARAMETER_SUFFIX) { diff --git a/firmware/controllers/trigger/trigger_simulator.cpp b/firmware/controllers/trigger/trigger_simulator.cpp index 08b72821f3..903b8cbae1 100644 --- a/firmware/controllers/trigger/trigger_simulator.cpp +++ b/firmware/controllers/trigger/trigger_simulator.cpp @@ -10,8 +10,6 @@ #include "trigger_simulator.h" #include "trigger_emulator_algo.h" -EXTERN_ENGINE; - #if EFI_UNIT_TEST extern bool printTriggerTrace; #endif diff --git a/firmware/development/engine_emulator.cpp b/firmware/development/engine_emulator.cpp index 9b3aba988c..d892fb3609 100644 --- a/firmware/development/engine_emulator.cpp +++ b/firmware/development/engine_emulator.cpp @@ -14,8 +14,6 @@ #include "poten.h" #include "trigger_emulator_algo.h" -EXTERN_ENGINE; - void initEngineEmulator(DECLARE_ENGINE_PARAMETER_SIGNATURE) { if (hasFirmwareError()) return; diff --git a/firmware/development/engine_sniffer.cpp b/firmware/development/engine_sniffer.cpp index d61a3b3a8b..7ca6b7f8de 100644 --- a/firmware/development/engine_sniffer.cpp +++ b/firmware/development/engine_sniffer.cpp @@ -39,7 +39,6 @@ #define CHART_DELIMETER '!' -EXTERN_ENGINE; extern uint32_t maxLockedDuration; /** diff --git a/firmware/development/hw_layer/poten.cpp b/firmware/development/hw_layer/poten.cpp index 3110ab299c..5e1e250e28 100644 --- a/firmware/development/hw_layer/poten.cpp +++ b/firmware/development/hw_layer/poten.cpp @@ -18,8 +18,6 @@ #if HAL_USE_SPI -EXTERN_ENGINE; - /** * MCP42010 digital potentiometer driver * diff --git a/firmware/development/logic_analyzer.cpp b/firmware/development/logic_analyzer.cpp index de3ebd4bc6..fcace8be9d 100644 --- a/firmware/development/logic_analyzer.cpp +++ b/firmware/development/logic_analyzer.cpp @@ -27,8 +27,6 @@ #if EFI_LOGIC_ANALYZER -EXTERN_ENGINE; - #define CHART_RESET_DELAY 1 #define MAX_ICU_COUNT 5 diff --git a/firmware/development/sensor_chart.cpp b/firmware/development/sensor_chart.cpp index 4bab6f2ef2..aeef843eab 100644 --- a/firmware/development/sensor_chart.cpp +++ b/firmware/development/sensor_chart.cpp @@ -21,8 +21,6 @@ static Logging scLogging("analog chart", LOGGING_BUFFER, sizeof(LOGGING_BUFFER)) static int initialized = false; -EXTERN_ENGINE; - enum class ScState { PreArm, Armed, diff --git a/firmware/hw_layer/adc/adc_inputs.cpp b/firmware/hw_layer/adc/adc_inputs.cpp index a74e380ce3..528e197852 100644 --- a/firmware/hw_layer/adc/adc_inputs.cpp +++ b/firmware/hw_layer/adc/adc_inputs.cpp @@ -48,8 +48,6 @@ static NO_CACHE adcsample_t fastAdcSampleBuf[ADC_BUF_DEPTH_FAST * ADC_MAX_CHANNE static adc_channel_mode_e adcHwChannelEnabled[HW_MAX_ADC_INDEX]; -EXTERN_ENGINE; - // Board voltage, with divider coefficient accounted for float getVoltageDivided(const char *msg, adc_channel_e hwChannel DECLARE_ENGINE_PARAMETER_SUFFIX) { return getVoltage(msg, hwChannel PASS_ENGINE_PARAMETER_SUFFIX) * engineConfiguration->analogInputDividerCoefficient; @@ -100,8 +98,6 @@ static uint32_t slowAdcCounter = 0; // todo: move this flag to Engine god object static int adcDebugReporting = false; -EXTERN_ENGINE; - static adcsample_t getAvgAdcValue(int index, adcsample_t *samples, int bufDepth, int numChannels) { uint32_t result = 0; for (int i = 0; i < bufDepth; i++) { diff --git a/firmware/hw_layer/adc/adc_subscription.cpp b/firmware/hw_layer/adc/adc_subscription.cpp index 2940981951..04dfe1ec23 100644 --- a/firmware/hw_layer/adc/adc_subscription.cpp +++ b/firmware/hw_layer/adc/adc_subscription.cpp @@ -5,8 +5,6 @@ #include "perf_trace.h" #include "biquad.h" -EXTERN_ENGINE; - #if EFI_UNIT_TEST void AdcSubscription::SubscribeSensor(FunctionalSensor &sensor, diff --git a/firmware/hw_layer/cdm_ion_sense.cpp b/firmware/hw_layer/cdm_ion_sense.cpp index fd4e3185b6..62c10525d3 100644 --- a/firmware/hw_layer/cdm_ion_sense.cpp +++ b/firmware/hw_layer/cdm_ion_sense.cpp @@ -51,8 +51,6 @@ void CdmState::onNewSignal(int currentRevolution) { #include "digital_input_exti.h" -EXTERN_ENGINE; - static CdmState instance; int getCurrentCdmValue(int currentRevolution) { diff --git a/firmware/hw_layer/digital_input/trigger/trigger_input.cpp b/firmware/hw_layer/digital_input/trigger/trigger_input.cpp index 6486e75efa..6ffd6e98a7 100644 --- a/firmware/hw_layer/digital_input/trigger/trigger_input.cpp +++ b/firmware/hw_layer/digital_input/trigger/trigger_input.cpp @@ -14,8 +14,6 @@ #if (EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__) -EXTERN_ENGINE; - #if (HAL_USE_ICU == TRUE) || (HAL_TRIGGER_USE_PAL == TRUE) #if (HAL_USE_ICU == TRUE) diff --git a/firmware/hw_layer/digital_input/trigger/trigger_input_comp.cpp b/firmware/hw_layer/digital_input/trigger/trigger_input_comp.cpp index 239b6f86b9..d49d94ec92 100644 --- a/firmware/hw_layer/digital_input/trigger/trigger_input_comp.cpp +++ b/firmware/hw_layer/digital_input/trigger/trigger_input_comp.cpp @@ -16,8 +16,6 @@ #include "trigger_input.h" #include "digital_input_icu.h" -EXTERN_ENGINE; - static volatile int centeredDacValue = 127; static volatile int toothCnt = 0; static volatile int dacHysteresisMin = 1; // = 5V * 1/256 (8-bit DAC) = ~20mV diff --git a/firmware/hw_layer/digital_input/trigger/trigger_input_exti.cpp b/firmware/hw_layer/digital_input/trigger/trigger_input_exti.cpp index 2fbb09446f..034b331e06 100644 --- a/firmware/hw_layer/digital_input/trigger/trigger_input_exti.cpp +++ b/firmware/hw_layer/digital_input/trigger/trigger_input_exti.cpp @@ -21,8 +21,6 @@ #error "PAL_USE_CALLBACKS should be enabled to use HAL_TRIGGER_USE_PAL" #endif -EXTERN_ENGINE; - static ioline_t shaftLines[TRIGGER_SUPPORTED_CHANNELS]; static ioline_t camLines[CAM_INPUTS_COUNT]; diff --git a/firmware/hw_layer/digital_input/trigger/trigger_input_icu.cpp b/firmware/hw_layer/digital_input/trigger/trigger_input_icu.cpp index 981cf012bf..19a6f9ae44 100644 --- a/firmware/hw_layer/digital_input/trigger/trigger_input_icu.cpp +++ b/firmware/hw_layer/digital_input/trigger/trigger_input_icu.cpp @@ -23,8 +23,6 @@ int icuFallingCallbackCounter = 0; #include "digital_input_icu.h" #include "tooth_logger.h" -EXTERN_ENGINE; - static void vvtRisingCallback(void *arg) { efitick_t now = getTimeNowNt(); TRIGGER_BAIL_IF_DISABLED diff --git a/firmware/hw_layer/drivers/can/can_hw.cpp b/firmware/hw_layer/drivers/can/can_hw.cpp index 6119c2da5f..b6e553499f 100644 --- a/firmware/hw_layer/drivers/can/can_hw.cpp +++ b/firmware/hw_layer/drivers/can/can_hw.cpp @@ -26,8 +26,6 @@ #include "engine.h" #include "thread_priority.h" -EXTERN_ENGINE; - static int canReadCounter = 0; int canWriteOk = 0; int canWriteNotOk = 0; diff --git a/firmware/hw_layer/drivers/can/can_msg_tx.cpp b/firmware/hw_layer/drivers/can/can_msg_tx.cpp index 36633fa4f1..2fd979f424 100644 --- a/firmware/hw_layer/drivers/can/can_msg_tx.cpp +++ b/firmware/hw_layer/drivers/can/can_msg_tx.cpp @@ -15,8 +15,6 @@ #include "can.h" #include "engine_configuration.h" -EXTERN_CONFIG - extern int canWriteOk; extern int canWriteNotOk; diff --git a/firmware/hw_layer/drivers/gpio/tle8888.cpp b/firmware/hw_layer/drivers/gpio/tle8888.cpp index 96d5043820..eeff42ea4f 100644 --- a/firmware/hw_layer/drivers/gpio/tle8888.cpp +++ b/firmware/hw_layer/drivers/gpio/tle8888.cpp @@ -42,8 +42,6 @@ #include "os_util.h" #include "thread_priority.h" -EXTERN_ENGINE_CONFIGURATION; - /* * TODO list: */ diff --git a/firmware/hw_layer/drivers/lcd/HD44780.cpp b/firmware/hw_layer/drivers/lcd/HD44780.cpp index 21bf916c6d..09c03b3b40 100644 --- a/firmware/hw_layer/drivers/lcd/HD44780.cpp +++ b/firmware/hw_layer/drivers/lcd/HD44780.cpp @@ -17,8 +17,6 @@ #include "engine.h" -EXTERN_ENGINE; - enum { LCD_HD44780_DISPLAY_CLEAR = 0x01, LCD_HD44780_SHIFT_CURSOR_RIGHT = 0x06, diff --git a/firmware/hw_layer/drivers/serial/serial_hw.cpp b/firmware/hw_layer/drivers/serial/serial_hw.cpp index 1f6f0224a7..d5dc28282c 100644 --- a/firmware/hw_layer/drivers/serial/serial_hw.cpp +++ b/firmware/hw_layer/drivers/serial/serial_hw.cpp @@ -18,8 +18,6 @@ #include "mpu_util.h" #include "engine.h" -EXTERN_ENGINE; - static bool isSerialEnabled = false; static bool isSerialTXEnabled = false; static bool isSerialRXEnabled = false; diff --git a/firmware/hw_layer/hardware.cpp b/firmware/hw_layer/hardware.cpp index 75de2a1dee..4ed5eaddac 100644 --- a/firmware/hw_layer/hardware.cpp +++ b/firmware/hw_layer/hardware.cpp @@ -70,8 +70,6 @@ #include "can_vss.h" #endif -EXTERN_ENGINE; - /** * #311 we want to test RTC before engine start so that we do not test it while engine is running */ diff --git a/firmware/hw_layer/io_pins.cpp b/firmware/hw_layer/io_pins.cpp index ea69e0845f..809c0c22ac 100644 --- a/firmware/hw_layer/io_pins.cpp +++ b/firmware/hw_layer/io_pins.cpp @@ -21,8 +21,6 @@ #include "console_io.h" #endif /* EFI_PROD_CODE */ -EXTERN_ENGINE; - void efiSetPadUnused(brain_pin_e brainPin DECLARE_ENGINE_PARAMETER_SUFFIX) { #if EFI_PROD_CODE /* input with pull up, is it safe? */ diff --git a/firmware/hw_layer/mc33816.cpp b/firmware/hw_layer/mc33816.cpp index e24618a040..c3f5356ce5 100644 --- a/firmware/hw_layer/mc33816.cpp +++ b/firmware/hw_layer/mc33816.cpp @@ -28,8 +28,6 @@ #include "mpu_util.h" #include "allsensors.h" -EXTERN_ENGINE; - static bool isInitializaed = false; static OutputPin chipSelect; diff --git a/firmware/hw_layer/microsecond_timer/microsecond_timer.cpp b/firmware/hw_layer/microsecond_timer/microsecond_timer.cpp index baa12840a2..95d6e3d2bc 100644 --- a/firmware/hw_layer/microsecond_timer/microsecond_timer.cpp +++ b/firmware/hw_layer/microsecond_timer/microsecond_timer.cpp @@ -19,8 +19,6 @@ #include "periodic_task.h" #include "engine.h" -EXTERN_ENGINE; - // Just in case we have a mechanism to validate that hardware timer is clocked right and all the // conversions between wall clock and hardware frequencies are done right // delay in milliseconds diff --git a/firmware/hw_layer/mmc_card.cpp b/firmware/hw_layer/mmc_card.cpp index 4c66ca7fc4..aaa530d74b 100644 --- a/firmware/hw_layer/mmc_card.cpp +++ b/firmware/hw_layer/mmc_card.cpp @@ -45,8 +45,6 @@ static const char *sdStatus = SD_STATE_INIT; static bool fs_ready = false; -EXTERN_ENGINE; - // at about 20Hz we write about 2Kb per second, looks like we flush once every ~2 seconds #define F_SYNC_FREQUENCY 10 diff --git a/firmware/hw_layer/mmc_card_access.cpp b/firmware/hw_layer/mmc_card_access.cpp index 04e35aa44a..0c2b6d6c1f 100644 --- a/firmware/hw_layer/mmc_card_access.cpp +++ b/firmware/hw_layer/mmc_card_access.cpp @@ -36,9 +36,6 @@ #include "efilib.h" #include "hardware.h" -EXTERN_ENGINE -; - /** * for funny reasons file name has to be at least 4 symbols before the dot */ diff --git a/firmware/hw_layer/pin_repository.cpp b/firmware/hw_layer/pin_repository.cpp index 3b15f93741..1465721d47 100644 --- a/firmware/hw_layer/pin_repository.cpp +++ b/firmware/hw_layer/pin_repository.cpp @@ -11,8 +11,6 @@ #include "engine.h" -EXTERN_ENGINE; - unsigned int getBrainPinTotalNum(void) { return BRAIN_PIN_TOTAL_PINS; } @@ -114,8 +112,6 @@ PinRepository::PinRepository() { #include "smart_gpio.h" #include "hardware.h" -EXTERN_CONFIG; - static brain_pin_e index_to_brainPin(unsigned int i) { if (i < getBrainPinTotalNum()) diff --git a/firmware/hw_layer/ports/cypress/mpu_util.cpp b/firmware/hw_layer/ports/cypress/mpu_util.cpp index 281a765a20..c7d9b98f2b 100644 --- a/firmware/hw_layer/ports/cypress/mpu_util.cpp +++ b/firmware/hw_layer/ports/cypress/mpu_util.cpp @@ -16,8 +16,6 @@ #include "pin_repository.h" #include "os_util.h" -EXTERN_ENGINE; - extern "C" { void _unhandled_exception(void); void DebugMonitorVector(void); diff --git a/firmware/hw_layer/ports/kinetis/mpu_util.cpp b/firmware/hw_layer/ports/kinetis/mpu_util.cpp index d82d052b9f..1e97c28432 100644 --- a/firmware/hw_layer/ports/kinetis/mpu_util.cpp +++ b/firmware/hw_layer/ports/kinetis/mpu_util.cpp @@ -16,8 +16,6 @@ #include "pin_repository.h" #include "os_util.h" -EXTERN_ENGINE; - void baseMCUInit(void) { } diff --git a/firmware/hw_layer/ports/stm32/stm32_adc_v2.cpp b/firmware/hw_layer/ports/stm32/stm32_adc_v2.cpp index 938da35d0d..5f9a567db7 100644 --- a/firmware/hw_layer/ports/stm32/stm32_adc_v2.cpp +++ b/firmware/hw_layer/ports/stm32/stm32_adc_v2.cpp @@ -7,12 +7,10 @@ */ #include "engine_ptr.h" -#include "persistent_configuration.h" +#include "engine_configuration.h" #if HAL_USE_ADC -EXTERN_CONFIG; - /* Depth of the conversion buffer, channels are sampled X times each.*/ #define SLOW_ADC_OVERSAMPLE 8 diff --git a/firmware/hw_layer/ports/stm32/stm32_common.cpp b/firmware/hw_layer/ports/stm32/stm32_common.cpp index 22132a3b9d..83583d55ed 100644 --- a/firmware/hw_layer/ports/stm32/stm32_common.cpp +++ b/firmware/hw_layer/ports/stm32/stm32_common.cpp @@ -30,8 +30,6 @@ #include "backup_ram.h" #endif /* EFI_PROD_CODE */ -EXTERN_ENGINE; - #if HAL_USE_ADC // ADC_CHANNEL_IN0 // PA0 diff --git a/firmware/hw_layer/sensors/accelerometer.cpp b/firmware/hw_layer/sensors/accelerometer.cpp index 426d097034..79d172a1b0 100644 --- a/firmware/hw_layer/sensors/accelerometer.cpp +++ b/firmware/hw_layer/sensors/accelerometer.cpp @@ -19,8 +19,6 @@ #include "accelerometer.h" #include "hardware.h" -EXTERN_ENGINE; - #if EFI_MEMS #include "mpu_util.h" #include "lis302dl.h" diff --git a/firmware/hw_layer/sensors/cj125.cpp b/firmware/hw_layer/sensors/cj125.cpp index f729a5c0c3..addeea621f 100644 --- a/firmware/hw_layer/sensors/cj125.cpp +++ b/firmware/hw_layer/sensors/cj125.cpp @@ -20,8 +20,6 @@ #include "rpm_calculator.h" #include "thread_priority.h" -EXTERN_ENGINE; - #if EFI_CJ125 #include "adc_inputs.h" diff --git a/firmware/hw_layer/sensors/cj125_logic.cpp b/firmware/hw_layer/sensors/cj125_logic.cpp index 1b0d59ffc6..59c1aa53d4 100644 --- a/firmware/hw_layer/sensors/cj125_logic.cpp +++ b/firmware/hw_layer/sensors/cj125_logic.cpp @@ -9,8 +9,6 @@ #include "engine.h" #include "error_handling.h" -EXTERN_ENGINE; - #define LOW_VOLTAGE "Low Voltage" CJ125::CJ125() : wboHeaterControl("wbo"), diff --git a/firmware/hw_layer/sensors/gps_uart.cpp b/firmware/hw_layer/sensors/gps_uart.cpp index 26f7e23420..ba94637be2 100644 --- a/firmware/hw_layer/sensors/gps_uart.cpp +++ b/firmware/hw_layer/sensors/gps_uart.cpp @@ -41,8 +41,6 @@ float getCurrentSpeed(void) { return GPSdata.speed; } -EXTERN_ENGINE; - static void printGpsInfo(DECLARE_ENGINE_PARAMETER_SIGNATURE) { efiPrintf("GPS RX %s", hwPortname(CONFIG(gps_rx_pin))); efiPrintf("GPS TX %s", hwPortname(CONFIG(gps_tx_pin))); diff --git a/firmware/hw_layer/sensors/hip9011.cpp b/firmware/hw_layer/sensors/hip9011.cpp index bb4b432a07..57a4e6a86a 100644 --- a/firmware/hw_layer/sensors/hip9011.cpp +++ b/firmware/hw_layer/sensors/hip9011.cpp @@ -210,8 +210,6 @@ int Hip9011Hardware::sendSyncCommand(uint8_t tx, uint8_t *rx_ptr) { return ret; } -EXTERN_ENGINE; - static int hip_wake_driver(void) { /* Entering a reentrant critical zone.*/ diff --git a/firmware/hw_layer/sensors/hip9011_logic.cpp b/firmware/hw_layer/sensors/hip9011_logic.cpp index a3ba405139..31d403592a 100644 --- a/firmware/hw_layer/sensors/hip9011_logic.cpp +++ b/firmware/hw_layer/sensors/hip9011_logic.cpp @@ -57,8 +57,6 @@ const float bandFreqLookup[BAND_LOOKUP_SIZE] = { /* Forward declarations */ /*==========================================================================*/ -EXTERN_ENGINE; - /*==========================================================================*/ /* Exported. */ /*==========================================================================*/ diff --git a/firmware/hw_layer/sensors/joystick.cpp b/firmware/hw_layer/sensors/joystick.cpp index 73c78c79b5..c6ed3ff381 100644 --- a/firmware/hw_layer/sensors/joystick.cpp +++ b/firmware/hw_layer/sensors/joystick.cpp @@ -20,8 +20,6 @@ #include "pin_repository.h" #include "digital_input_exti.h" -EXTERN_ENGINE; - static int joyTotal = 0; static int joyCenter; static int joyA = 0; diff --git a/firmware/hw_layer/sensors/max31855.cpp b/firmware/hw_layer/sensors/max31855.cpp index c7deff1299..419903884a 100644 --- a/firmware/hw_layer/sensors/max31855.cpp +++ b/firmware/hw_layer/sensors/max31855.cpp @@ -31,8 +31,6 @@ static SPIDriver *driver; static SPIConfig spiConfig[EGT_CHANNEL_COUNT]; -EXTERN_ENGINE; - static void showEgtInfo(void) { #if EFI_PROD_CODE printSpiState(engineConfiguration); diff --git a/firmware/hw_layer/sensors/yaw_rate_sensor.cpp b/firmware/hw_layer/sensors/yaw_rate_sensor.cpp index 4e8af7ba0c..6039475d38 100644 --- a/firmware/hw_layer/sensors/yaw_rate_sensor.cpp +++ b/firmware/hw_layer/sensors/yaw_rate_sensor.cpp @@ -21,8 +21,6 @@ #if EFI_BOSCH_YAW -EXTERN_ENGINE; - void initBoschYawRateSensor() { } diff --git a/firmware/hw_layer/servo.cpp b/firmware/hw_layer/servo.cpp index ebed57740e..05a46eb1a8 100644 --- a/firmware/hw_layer/servo.cpp +++ b/firmware/hw_layer/servo.cpp @@ -19,8 +19,6 @@ #include "pin_repository.h" #include "thread_priority.h" -EXTERN_ENGINE; - // This thread calls scheduleForLater which eventually could trip the main trigger callback // if self stimulation (heh) is enabled, which uses a TON of stack space. // So this stack has to be pretty big, unfortunately. diff --git a/firmware/hw_layer/smart_gpio.cpp b/firmware/hw_layer/smart_gpio.cpp index 452c634f0e..5537daee55 100644 --- a/firmware/hw_layer/smart_gpio.cpp +++ b/firmware/hw_layer/smart_gpio.cpp @@ -22,8 +22,6 @@ #include "drivers/gpio/drv8860.h" #include "engine.h" -EXTERN_ENGINE; - #if (BOARD_TLE6240_COUNT > 0) // todo: migrate to TS or board config #ifndef TLE6240_RESET_PORT diff --git a/firmware/hw_layer/stepper.cpp b/firmware/hw_layer/stepper.cpp index 7c3b4c3186..6438d51eb5 100644 --- a/firmware/hw_layer/stepper.cpp +++ b/firmware/hw_layer/stepper.cpp @@ -18,8 +18,6 @@ #include "sensor.h" #include "thread_priority.h" -EXTERN_ENGINE; - void StepperMotor::saveStepperPos(int pos) { // use backup-power RTC registers to store the data #if EFI_PROD_CODE diff --git a/firmware/hw_layer/trigger_input_adc.cpp b/firmware/hw_layer/trigger_input_adc.cpp index df743e2587..e14c04515b 100644 --- a/firmware/hw_layer/trigger_input_adc.cpp +++ b/firmware/hw_layer/trigger_input_adc.cpp @@ -20,8 +20,6 @@ extern "C" void toggleLed(int led, int mode); #define BOARD_MOD1_PORT GPIOD #define BOARD_MOD1_PIN 5 -EXTERN_ENGINE; - #if 0 static volatile int centeredDacValue = 127; static volatile int toothCnt = 0; diff --git a/firmware/hw_layer/vehicle_speed.cpp b/firmware/hw_layer/vehicle_speed.cpp index 72bf4f6749..aca26c082f 100644 --- a/firmware/hw_layer/vehicle_speed.cpp +++ b/firmware/hw_layer/vehicle_speed.cpp @@ -15,8 +15,6 @@ #include "pin_repository.h" #include "can_vss.h" -EXTERN_ENGINE; - static efitick_t lastSignalTimeNt = 0; static efitick_t vssDiff = 0; diff --git a/firmware/init/sensor/init_aux.cpp b/firmware/init/sensor/init_aux.cpp index 5c6ebd7c29..1b3dca6ddf 100644 --- a/firmware/init/sensor/init_aux.cpp +++ b/firmware/init/sensor/init_aux.cpp @@ -5,8 +5,6 @@ #include "global.h" #include "functional_sensor.h" -EXTERN_ENGINE; - // These aux sensors just read voltage - so the converter function has nothing to do struct IdentityFunction : public SensorConverter { SensorResult convert(float raw) const { diff --git a/firmware/init/sensor/init_baro.cpp b/firmware/init/sensor/init_baro.cpp index bc5672892b..ee8da45c6d 100644 --- a/firmware/init/sensor/init_baro.cpp +++ b/firmware/init/sensor/init_baro.cpp @@ -3,8 +3,6 @@ #include "rusefi_hw_enums.h" -EXTERN_ENGINE; - static Lps25 device; static Lps25Sensor sensor(device); diff --git a/firmware/init/sensor/init_can_sensors.cpp b/firmware/init/sensor/init_can_sensors.cpp index 4e23bc7e47..06d95005dc 100644 --- a/firmware/init/sensor/init_can_sensors.cpp +++ b/firmware/init/sensor/init_can_sensors.cpp @@ -12,9 +12,6 @@ #include "can_sensor.h" #include "can.h" -EXTERN_CONFIG -; - CanSensor canPedalSensor( CAN_DEFAULT_BASE + CAN_PEDAL_TPS_OFFSET, /*offset =*/ 0, SensorType::AcceleratorPedal, CAN_TIMEOUT diff --git a/firmware/init/sensor/init_flex.cpp b/firmware/init/sensor/init_flex.cpp index fc56a939ea..d5362cf8d6 100644 --- a/firmware/init/sensor/init_flex.cpp +++ b/firmware/init/sensor/init_flex.cpp @@ -3,8 +3,6 @@ #include "engine.h" #include "flex_sensor.h" -EXTERN_ENGINE; - static FlexFuelSensor flexSensor; // https://rusefi.com/forum/viewtopic.php?p=37452&sid=829804c90d5b2e1fecd1b900cf1b1811#p37452 diff --git a/firmware/init/sensor/init_fluid_pressure.cpp b/firmware/init/sensor/init_fluid_pressure.cpp index f28cee5944..55a2855938 100644 --- a/firmware/init/sensor/init_fluid_pressure.cpp +++ b/firmware/init/sensor/init_fluid_pressure.cpp @@ -8,8 +8,6 @@ #include "proxy_sensor.h" #include "linear_func.h" -EXTERN_ENGINE; - static LinearFunc oilpSensorFunc; static FunctionalSensor oilpSensor(SensorType::OilPressure, /* timeout = */ MS2NT(50)); diff --git a/firmware/init/sensor/init_fuel_level.cpp b/firmware/init/sensor/init_fuel_level.cpp index b11ef7a2ce..6f4c35d5b6 100644 --- a/firmware/init/sensor/init_fuel_level.cpp +++ b/firmware/init/sensor/init_fuel_level.cpp @@ -5,8 +5,6 @@ #include "functional_sensor.h" #include "table_func.h" -EXTERN_CONFIG; - static FunctionalSensor fuelSensor(SensorType::FuelLevel, /* timeout = */ MS2NT(500)); #if !EFI_UNIT_TEST diff --git a/firmware/init/sensor/init_lambda.cpp b/firmware/init/sensor/init_lambda.cpp index 723a4cee54..3c104ef4e2 100644 --- a/firmware/init/sensor/init_lambda.cpp +++ b/firmware/init/sensor/init_lambda.cpp @@ -6,8 +6,6 @@ #include "function_pointer_sensor.h" #include "ego.h" -EXTERN_ENGINE; - struct GetAfrWrapper { DECLARE_ENGINE_PTR; diff --git a/firmware/init/sensor/init_maf.cpp b/firmware/init/sensor/init_maf.cpp index d49a04d477..a90d330209 100644 --- a/firmware/init/sensor/init_maf.cpp +++ b/firmware/init/sensor/init_maf.cpp @@ -5,8 +5,6 @@ #include "functional_sensor.h" #include "table_func.h" -EXTERN_CONFIG; - static FunctionalSensor maf(SensorType::Maf, /* timeout = */ MS2NT(50)); #if !EFI_UNIT_TEST diff --git a/firmware/init/sensor/init_map.cpp b/firmware/init/sensor/init_map.cpp index 6edecc7551..691ed2fbdb 100644 --- a/firmware/init/sensor/init_map.cpp +++ b/firmware/init/sensor/init_map.cpp @@ -3,8 +3,6 @@ #include "function_pointer_sensor.h" #include "engine.h" -EXTERN_ENGINE; - struct GetMapWrapper { DECLARE_ENGINE_PTR; diff --git a/firmware/init/sensor/init_thermistors.cpp b/firmware/init/sensor/init_thermistors.cpp index 771a377f75..80b4d87977 100644 --- a/firmware/init/sensor/init_thermistors.cpp +++ b/firmware/init/sensor/init_thermistors.cpp @@ -9,8 +9,6 @@ #include "resistance_func.h" #include "thermistor_func.h" -EXTERN_ENGINE; - using resist = ResistanceFunc; using therm = ThermistorFunc; diff --git a/firmware/init/sensor/init_tps.cpp b/firmware/init/sensor/init_tps.cpp index bac07dd870..6162c154fa 100644 --- a/firmware/init/sensor/init_tps.cpp +++ b/firmware/init/sensor/init_tps.cpp @@ -10,8 +10,6 @@ #include "linear_func.h" #include "tps.h" -EXTERN_ENGINE; - LinearFunc tpsFunc1p(TPS_TS_CONVERSION); LinearFunc tpsFunc1s(TPS_TS_CONVERSION); LinearFunc tpsFunc2p(TPS_TS_CONVERSION); diff --git a/firmware/init/sensor/init_vbatt.cpp b/firmware/init/sensor/init_vbatt.cpp index f905d1ed00..448dd16fb2 100644 --- a/firmware/init/sensor/init_vbatt.cpp +++ b/firmware/init/sensor/init_vbatt.cpp @@ -5,8 +5,6 @@ #include "functional_sensor.h" #include "linear_func.h" -EXTERN_ENGINE; - static LinearFunc vbattFunc; static FunctionalSensor vbattSensor(SensorType::BatteryVoltage, /* timeout = */ MS2NT(100)); diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index fe92448b7f..33b8c37437 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -141,8 +141,6 @@ static char panicMessage[200]; static virtual_timer_t resetTimer; -EXTERN_ENGINE; - // todo: move this into a hw-specific file void rebootNow(void) { NVIC_SystemReset(); diff --git a/simulator/simulator/boards.cpp b/simulator/simulator/boards.cpp index cd50f52355..eaed60b7af 100644 --- a/simulator/simulator/boards.cpp +++ b/simulator/simulator/boards.cpp @@ -11,8 +11,6 @@ #include "engine_sniffer.h" #include "adc_math.h" -EXTERN_ENGINE; - int getAdcValue(const char *msg, int hwChannel) { return engine->engineState.mockAdcState.getMockAdcValue(hwChannel); } diff --git a/simulator/simulator/rusEfiFunctionalTest.cpp b/simulator/simulator/rusEfiFunctionalTest.cpp index 968380dfe5..1eb62c2c11 100644 --- a/simulator/simulator/rusEfiFunctionalTest.cpp +++ b/simulator/simulator/rusEfiFunctionalTest.cpp @@ -34,8 +34,6 @@ #define DEFAULT_SIM_RPM 1200 #define DEFAULT_SNIFFER_THR 2500 -EXTERN_ENGINE; - extern WaveChart waveChart; int getRemainingStack(thread_t *otp) {