From 25d072ce17199c57072058590be5681cc315bf2a Mon Sep 17 00:00:00 2001 From: rusEfi Date: Thu, 1 Jan 2015 16:03:28 -0600 Subject: [PATCH] auto-sync --- firmware/controllers/algo/ec2.h | 11 ----------- firmware/controllers/algo/engine.cpp | 6 ++++++ firmware/controllers/algo/engine.h | 6 ++++++ firmware/controllers/algo/engine_configuration.cpp | 7 ------- firmware/controllers/settings.cpp | 2 +- .../{algo => trigger}/main_trigger_callback.h | 0 firmware/controllers/trigger/rpm_calculator.cpp | 2 +- firmware/rusefi.cpp | 1 - unit_tests/engine_test_helper.cpp | 1 - unit_tests/test.mk | 5 +---- 10 files changed, 15 insertions(+), 26 deletions(-) rename firmware/controllers/{algo => trigger}/main_trigger_callback.h (100%) diff --git a/firmware/controllers/algo/ec2.h b/firmware/controllers/algo/ec2.h index 069c8351ed..574f4bc242 100644 --- a/firmware/controllers/algo/ec2.h +++ b/firmware/controllers/algo/ec2.h @@ -41,9 +41,6 @@ class engine_configuration2_s { public: engine_configuration2_s(); - // todo: this should go, too - engine_configuration_s *engineConfiguration; - #if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) FuelSchedule crankingInjectionEvents; FuelSchedule injectionEvents; @@ -51,19 +48,11 @@ public: float fsioLastValue[LE_COMMAND_COUNT]; - float sparkAtable[DWELL_CURVE_SIZE]; - float sparkBtable[DWELL_CURVE_SIZE]; - - Table2D sparkTable; - void precalc(); - /** * We are alternating two event lists in order to avoid a potential issue around revolution boundary * when an event is scheduled within the next revolution. */ IgnitionEventList ignitionEvents[2]; - - uint64_t stopEngineRequestTimeNt; }; diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index 601888289f..8ec7222292 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -45,6 +45,12 @@ Engine::Engine() { lastTriggerEventTimeNt = 0; isCylinderCleanupMode = false; engineCycleEventCount = 0; + stopEngineRequestTimeNt = 0; +} + +void Engine::precalc(engine_configuration_s *engineConfiguration) { + sparkTable.init(DWELL_CURVE_SIZE, sparkAtable, sparkBtable); + sparkTable.preCalc(engineConfiguration->sparkDwellBins, engineConfiguration->sparkDwell); } void Engine::init() { diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index 92a8cd97f0..3150d9d36f 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -33,6 +33,8 @@ public: engine_configuration_s *engineConfiguration; engine_configuration2_s *engineConfiguration2; + uint64_t stopEngineRequestTimeNt; + Thermistor iat; Thermistor clt; @@ -83,7 +85,11 @@ public: uint32_t before5; uint32_t before6; + float sparkAtable[DWELL_CURVE_SIZE]; + float sparkBtable[DWELL_CURVE_SIZE]; + Table2D sparkTable; + void precalc(engine_configuration_s *engineConfiguration); void updateSlowSensors(); void watchdog(); diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 24bdf5d552..a5a98c6ae2 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -673,13 +673,6 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType, Engine *e } engine_configuration2_s::engine_configuration2_s() { - engineConfiguration = NULL; - stopEngineRequestTimeNt = 0; -} - -void engine_configuration2_s::precalc() { - sparkTable.init(DWELL_CURVE_SIZE, sparkAtable, sparkBtable); - sparkTable.preCalc(engineConfiguration->sparkDwellBins, engineConfiguration->sparkDwell); } void applyNonPersistentConfiguration(Logging * logger, Engine *engine) { diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index 7eed509b26..9203c08165 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -747,7 +747,7 @@ static void disableIgnition(void) { } static void stopEngine(Engine *engine) { - engine->engineConfiguration2->stopEngineRequestTimeNt = getTimeNowNt(); + engine->stopEngineRequestTimeNt = getTimeNowNt(); } #if EFI_WAVE_CHART diff --git a/firmware/controllers/algo/main_trigger_callback.h b/firmware/controllers/trigger/main_trigger_callback.h similarity index 100% rename from firmware/controllers/algo/main_trigger_callback.h rename to firmware/controllers/trigger/main_trigger_callback.h diff --git a/firmware/controllers/trigger/rpm_calculator.cpp b/firmware/controllers/trigger/rpm_calculator.cpp index 30731d638d..23f91429a5 100644 --- a/firmware/controllers/trigger/rpm_calculator.cpp +++ b/firmware/controllers/trigger/rpm_calculator.cpp @@ -67,7 +67,7 @@ RpmCalculator::RpmCalculator() { bool RpmCalculator::isRunning(DECLARE_ENGINE_PARAMETER_F) { engine_configuration2_s *engineConfiguration2 = engine->engineConfiguration2; uint64_t nowNt = getTimeNowNt(); - if (engineConfiguration2->stopEngineRequestTimeNt != 0) { + if (engine->stopEngineRequestTimeNt != 0) { if (nowNt - lastRpmEventTimeNt < 3 * US2NT(US_PER_SECOND_LL)) { return false; } diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index d059dfe383..1b60a15ff1 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -144,7 +144,6 @@ void runRusEfi(void) { // that's dirty, this assignment should be nicer or in a better spot engine->engineConfiguration = engineConfiguration; engine->engineConfiguration2 = engineConfiguration2; - engineConfiguration2->engineConfiguration = engineConfiguration; initErrorHandling(); diff --git a/unit_tests/engine_test_helper.cpp b/unit_tests/engine_test_helper.cpp index 969bdb6000..9224c0c073 100644 --- a/unit_tests/engine_test_helper.cpp +++ b/unit_tests/engine_test_helper.cpp @@ -16,7 +16,6 @@ extern int timeNow; EngineTestHelper::EngineTestHelper(engine_type_e engineType) { ec = &persistentConfig.engineConfiguration; engine.engineConfiguration = &persistentConfig.engineConfiguration; - ec2.engineConfiguration = &persistentConfig.engineConfiguration; engine_configuration_s *engineConfiguration = ec; diff --git a/unit_tests/test.mk b/unit_tests/test.mk index c1dc9e3460..c797accc62 100644 --- a/unit_tests/test.mk +++ b/unit_tests/test.mk @@ -1,6 +1,5 @@ -TEST_SRC_C = boards.c - TEST_SRC_CPP = test_util.cpp \ + boards.cpp \ test_data_structures/test_event_registry.cpp \ test_basic_math/test_find_index.cpp \ test_basic_math/test_interpolation_3d.cpp \ @@ -14,6 +13,4 @@ TEST_SRC_CPP = test_util.cpp \ test_signal_executor.cpp \ test_sensors.cpp \ test_accel_enrichment.cpp - -