From 92292aedddb99b4c9189b611fa1152ff44a3e1e6 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Mon, 25 Sep 2023 12:49:44 -0400 Subject: [PATCH] only:docs/renaming method to reduce confusion --- .../controllers/algo/engine_configuration.cpp | 2 +- firmware/controllers/engine_controller.cpp | 15 ++++++++------- firmware/controllers/engine_controller.h | 3 ++- firmware/hw_layer/hardware.h | 1 + firmware/rusefi.cpp | 2 +- simulator/simulator/rusEfiFunctionalTest.cpp | 2 +- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 7525b116f6..a27946fa18 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -169,7 +169,7 @@ __attribute__((weak)) void boardOnConfigurationChange(engine_configuration_s* /* * online tuning of most values in the maps does not count as configuration change, but 'Burn' command does * * this method is NOT currently invoked on ECU start - actual user input has to happen! - * See preCalculate which is invoked BOTH on start and configuration change + * See 'preCalculate' or 'startHardware' which are invoked BOTH on start and configuration change */ void incrementGlobalConfigurationVersion(const char * msg) { assertStackVoid("increment", ObdCode::STACK_USAGE_MISC, EXPECTED_REMAINING_STACK); diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index 8890338c2b..41e27a8780 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -403,8 +403,14 @@ static void initConfigActions() { } #endif /* EFI_UNIT_TEST */ +// one-time start-up // this method is used by real firmware and simulator and unit test void commonInitEngineController() { +#if EFI_PROD_CODE + addConsoleAction("sensorinfo", printSensorInfo); + addConsoleAction("reset_accel", resetAccel); +#endif /* EFI_PROD_CODE */ + initInterpolation(); #if EFI_SIMULATOR || EFI_UNIT_TEST @@ -653,8 +659,8 @@ void commonEarlyInit() { #endif // HW_CHECK_ALWAYS_STIMULATE } -void initEngineController() { - addConsoleAction("sensorinfo", printSensorInfo); +// one-time start-up +void initRealHardwareEngineController() { #if EFI_PROD_CODE && EFI_ENGINE_CONTROL initBenchTest(); @@ -693,11 +699,6 @@ void initEngineController() { #endif /* EFI_MALFUNCTION_INDICATOR */ initEgoAveraging(); - -#if EFI_PROD_CODE - addConsoleAction("reset_accel", resetAccel); -#endif /* EFI_PROD_CODE */ - } /** diff --git a/firmware/controllers/engine_controller.h b/firmware/controllers/engine_controller.h index 8ff6bc06c2..efc35585bf 100644 --- a/firmware/controllers/engine_controller.h +++ b/firmware/controllers/engine_controller.h @@ -12,7 +12,8 @@ bool validateConfig(); char * getPinNameByAdcChannel(const char *msg, adc_channel_e hwChannel, char *buffer); void initPeriodicEvents(); -void initEngineController(); +// see also applyNewHardwareSettings +void initRealHardwareEngineController(); void commonEarlyInit(); void commonInitEngineController(); void initStartStopButton(); diff --git a/firmware/hw_layer/hardware.h b/firmware/hw_layer/hardware.h index 40d2cd6b3e..df39eb1c4c 100644 --- a/firmware/hw_layer/hardware.h +++ b/firmware/hw_layer/hardware.h @@ -7,6 +7,7 @@ #pragma once +// 'startHardware' is invoked both on boot and configuration change void startHardware(); void stopHardware(); diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 096093466b..34e20e404e 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -259,7 +259,7 @@ void runRusEfiWithConfig() { * Now let's initialize actual engine control logic * todo: should we initialize some? most? controllers before hardware? */ - initEngineController(); + initRealHardwareEngineController(); // This has to happen after RegisteredOutputPins are init'd: otherwise no change will be detected, and no init will happen diff --git a/simulator/simulator/rusEfiFunctionalTest.cpp b/simulator/simulator/rusEfiFunctionalTest.cpp index 7e5f116c5e..edc4a9ee77 100644 --- a/simulator/simulator/rusEfiFunctionalTest.cpp +++ b/simulator/simulator/rusEfiFunctionalTest.cpp @@ -144,7 +144,7 @@ void rusEfiFunctionalTest(void) { initDataStructures(); initializeConsole(); - // todo: reduce code duplication with initEngineController + // todo: reduce code duplication with initRealHardwareEngineController initFlash(); loadConfiguration();