From 72607fc12c5b048caad683d80a1e1bdd03a8cc60 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Fri, 28 Nov 2014 22:03:26 -0600 Subject: [PATCH] auto-sync --- firmware/controllers/algo/ec2.h | 3 +++ firmware/controllers/algo/engine_configuration.cpp | 1 + firmware/controllers/core/le_functions.cpp | 2 +- firmware/controllers/settings.cpp | 8 +++++--- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/firmware/controllers/algo/ec2.h b/firmware/controllers/algo/ec2.h index 04f5451e7c..4de7c03dae 100644 --- a/firmware/controllers/algo/ec2.h +++ b/firmware/controllers/algo/ec2.h @@ -58,6 +58,9 @@ public: * when an event is scheduled within the next revolution. */ IgnitionEventList ignitionEvents[2]; + + uint64_t stopEngineRequestTime; + bool_t isStopEngineRequestPending; }; void initializeIgnitionActions(float advance, float dwellAngle, diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index ec29d1781b..f5a3a92174 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -572,6 +572,7 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType, Engine *e engine_configuration2_s::engine_configuration2_s() { engineConfiguration = NULL; + isStopEngineRequestPending = false; } void engine_configuration2_s::precalc() { diff --git a/firmware/controllers/core/le_functions.cpp b/firmware/controllers/core/le_functions.cpp index c2e5dce782..8e2ddce4b8 100644 --- a/firmware/controllers/core/le_functions.cpp +++ b/firmware/controllers/core/le_functions.cpp @@ -22,7 +22,7 @@ static LENameOrdinalPair leMaf(LE_METHOD_MAF, "maf"); static LENameOrdinalPair leVBatt(LE_METHOD_VBATT, "vbatt"); static LENameOrdinalPair leFan(LE_METHOD_FAN, "fan"); static LENameOrdinalPair leCoolant(LE_METHOD_COOLANT, "coolant"); -static LENameOrdinalPair leAcToggle(LE_METHOD_AC_TOGGLE, "ac_toggle"); +static LENameOrdinalPair leAcToggle(LE_METHOD_AC_TOGGLE, "ac_on_switch"); static LENameOrdinalPair leFanOnSetting(LE_METHOD_FAN_ON_SETTING, "fan_on_setting"); static LENameOrdinalPair leFanOffSetting(LE_METHOD_FAN_OFF_SETTING, "fan_off_setting"); static LENameOrdinalPair leTimeSinceBoot(LE_METHOD_TIME_SINCE_BOOT, "time_since_boot"); diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index 6222e5b0f4..d185d90420 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -481,6 +481,7 @@ static void setIgnitionPin(const char *indexStr, const char *pinName) { boardConfiguration->ignitionPins[index] = pin; } +// set_idle_pin none static void setIdlePin(const char *pinName) { brain_pin_e pin = parseBrainPin(pinName); // todo: extract method - code duplication with other 'set_xxx_pin' methods? @@ -726,8 +727,9 @@ static void disableIgnition(void) { scheduleMsg(&logger, "ignition disabled"); } -static void stopEngine(void) { - // todo +static void stopEngine(Engine *engine) { + engine->engineConfiguration2->stopEngineRequestTime = getTimeNowUs(); + engine->engineConfiguration2->isStopEngineRequestPending = true; } #if EFI_WAVE_CHART @@ -795,7 +797,7 @@ void initSettings(engine_configuration_s *engineConfiguration) { addConsoleActionI("set_rpm_hard_limit", setRpmHardLimit); addConsoleActionI("set_firing_order", setFiringOrder); addConsoleActionI("set_algorithm", setAlgorithm); - addConsoleAction("stopengine", stopEngine); + addConsoleActionP("stopengine", (VoidPtr)stopEngine, engine); // todo: refactor this - looks like all boolean flags should be controlled with less code duplication addConsoleAction("enable_injection", enableInjection);