From 24e3aa5cc7e518bef95d6522da2715a6a70bc888 Mon Sep 17 00:00:00 2001 From: Andrey Date: Sun, 5 Mar 2023 01:20:03 -0500 Subject: [PATCH] progress: bringing simulator closer to real code only:hellen-honda-k --- firmware/controllers/engine_controller.cpp | 5 +++++ firmware/rusefi.cpp | 15 ++++++--------- simulator/simulator/rusEfiFunctionalTest.cpp | 12 ++++++------ 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index d71bb7a870..622ed287b1 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -32,6 +32,7 @@ #include "main_trigger_callback.h" #include "flash_main.h" #include "bench_test.h" +#include "mmc_card.h" #include "electronic_throttle.h" #include "map_averaging.h" #include "high_pressure_fuel_pump.h" @@ -618,6 +619,10 @@ void commonEarlyInit() { * Initialize hardware drivers */ initHardware(); + +#if EFI_FILE_LOGGING + initMmcCard(); +#endif /* EFI_FILE_LOGGING */ } void initEngineController() { diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index b292337169..d4cb051e9a 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -253,10 +253,13 @@ void runRusEfiWithConfig() { commonEarlyInit(); +#if EFI_ENGINE_EMULATOR + initEngineEmulator(); +#endif -#if EFI_FILE_LOGGING - initMmcCard(); -#endif /* EFI_FILE_LOGGING */ +#if EFI_LUA + startLua(); +#endif // EFI_LUA #if EFI_CAN_SERIAL // needs to be called after initCan() inside initHardware() @@ -269,9 +272,6 @@ void runRusEfiWithConfig() { enableTriggerStimulator(); #endif // HW_CHECK_ALWAYS_STIMULATE -#if EFI_LUA - startLua(); -#endif // EFI_LUA // Config could be completely bogus - don't start anything else! if (validateConfig()) { @@ -282,9 +282,6 @@ void runRusEfiWithConfig() { */ initEngineController(); - #if EFI_ENGINE_EMULATOR - initEngineEmulator(); - #endif // This has to happen after RegisteredOutputPins are init'd: otherwise no change will be detected, and no init will happen rememberCurrentConfiguration(); diff --git a/simulator/simulator/rusEfiFunctionalTest.cpp b/simulator/simulator/rusEfiFunctionalTest.cpp index 1f5cf22a99..2059eba803 100644 --- a/simulator/simulator/rusEfiFunctionalTest.cpp +++ b/simulator/simulator/rusEfiFunctionalTest.cpp @@ -21,7 +21,6 @@ #include "bench_test.h" #include "tunerstudio.h" #include "map_averaging.h" -#include "mmc_card.h" #include "memstreams.h" #include #include "rusefi_lua.h" @@ -95,6 +94,9 @@ void rusEfiFunctionalTest(void) { engine->setConfig(); + startLoggingProcessor(); + + initializeConsole(); initStatusLoop(); @@ -115,9 +117,8 @@ void rusEfiFunctionalTest(void) { commonEarlyInit(); - startLoggingProcessor(); + startLua(); - initMmcCard(); /** * !!!! TESTS ! @@ -128,8 +129,6 @@ void rusEfiFunctionalTest(void) { * end of TESTS ! */ - initPeriodicEvents(); - setTriggerEmulatorRPM(DEFAULT_SIM_RPM); engineConfiguration->engineSnifferRpmThreshold = DEFAULT_SNIFFER_THR; @@ -144,7 +143,8 @@ void rusEfiFunctionalTest(void) { initCan(); #endif // HAL_USE_CAN - startLua(); + + initPeriodicEvents(); extern bool main_loop_started; main_loop_started = true;