From 630f04d06c05853a6d8fc7ed84dd097417296b3a Mon Sep 17 00:00:00 2001 From: rusEfi Date: Thu, 26 Feb 2015 21:04:29 -0600 Subject: [PATCH] auto-sync --- firmware/controllers/engine_controller.cpp | 25 +++++++++++-------- firmware/controllers/engine_controller.h | 1 + .../simulator/rusEfiFunctionalTest.cpp | 2 ++ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index da281d19cd..b748574309 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -78,7 +78,7 @@ board_configuration_s *boardConfiguration = &persistentState.persistentConfigura * CH_FREQUENCY is the number of system ticks in a second */ -static VirtualTimer everyMsTimer; +static VirtualTimer periodicTimer; static LoggingWithStorage logger("Engine Controller"); @@ -200,18 +200,18 @@ static void cylinderCleanupControl(Engine *engine) { static LocalVersionHolder versionForConfigurationListeners; -static void onEvenyGeneralMilliseconds(Engine *engine); +static void periodicCallback(Engine *engine); static void scheduleNextInvocation(void) { // schedule next invocation int period = boardConfiguration->generalPeriodicThreadPeriod; if (period == 0) period = 50; // this might happen while resetting config - chVTSetAny(&everyMsTimer, period * TICKS_IN_MS, (vtfunc_t) &onEvenyGeneralMilliseconds, engine); + chVTSetAny(&periodicTimer, period * TICKS_IN_MS, (vtfunc_t) &periodicCallback, engine); } -static void onEvenyGeneralMilliseconds(Engine *engine) { +static void periodicCallback(Engine *engine) { efiAssertVoid(getRemainingStack(chThdSelf()) > 64, "lowStckOnEv"); #if EFI_PROD_CODE /** @@ -392,6 +392,15 @@ static void resetAccel(void) { } #endif +void initConfigActions(void) { + addConsoleActionSS("set_float", (VoidCharPtrCharPtr) setFloat); + addConsoleActionII("set_int", (VoidIntInt) setInt); + addConsoleActionII("set_short", (VoidIntInt) setShort); + addConsoleActionI("get_float", getFloat); + addConsoleActionI("get_int", getInt); + addConsoleActionI("get_short", getShort); +} + void initEngineContoller(Logging *sharedLogger, Engine *engine) { if (hasFirmwareError()) { return; @@ -408,6 +417,7 @@ void initEngineContoller(Logging *sharedLogger, Engine *engine) { #endif /* EFI_ANALOG_CHART */ initAlgo(sharedLogger, engineConfiguration); + initConfigActions(); #if EFI_WAVE_ANALYZER || defined(__DOXYGEN__) if (engineConfiguration->isWaveAnalyzerEnabled) { @@ -483,12 +493,7 @@ void initEngineContoller(Logging *sharedLogger, Engine *engine) { addConsoleAction("analoginfo", printAnalogInfo); - addConsoleActionSS("set_float", (VoidCharPtrCharPtr) setFloat); - addConsoleActionII("set_int", (VoidIntInt) setInt); - addConsoleActionII("set_short", (VoidIntInt) setShort); - addConsoleActionI("get_float", getFloat); - addConsoleActionI("get_int", getInt); - addConsoleActionI("get_short", getShort); + initConfigActions(); #if EFI_PROD_CODE addConsoleAction("reset_accel", resetAccel); #endif diff --git a/firmware/controllers/engine_controller.h b/firmware/controllers/engine_controller.h index 6fbdc44485..ab5307845b 100644 --- a/firmware/controllers/engine_controller.h +++ b/firmware/controllers/engine_controller.h @@ -15,6 +15,7 @@ #include "engine.h" char * getPinNameByAdcChannel(adc_channel_e hwChannel, char *buffer); +void initConfigActions(void); void initPeriodicEvents(Engine *engine); void initEngineContoller(Logging *sharedLogger, Engine *engine); diff --git a/win32_functional_tests/simulator/rusEfiFunctionalTest.cpp b/win32_functional_tests/simulator/rusEfiFunctionalTest.cpp index 1456b4ff0e..2fc74339ea 100644 --- a/win32_functional_tests/simulator/rusEfiFunctionalTest.cpp +++ b/win32_functional_tests/simulator/rusEfiFunctionalTest.cpp @@ -90,6 +90,8 @@ void rusEfiFunctionalTest(void) { initSensors(&sharedLogger PASS_ENGINE_PARAMETER); initAlgo(&sharedLogger, engineConfiguration); + initConfigActions(); + initRpmCalculator(engine); #if EFI_ANALOG_CHART