diff --git a/firmware/controllers/engine_cycle/main_trigger_callback.cpp b/firmware/controllers/engine_cycle/main_trigger_callback.cpp index 65afe37065..3097384064 100644 --- a/firmware/controllers/engine_cycle/main_trigger_callback.cpp +++ b/firmware/controllers/engine_cycle/main_trigger_callback.cpp @@ -331,34 +331,6 @@ static void handleFuel(const bool limitedFuel, uint32_t trgEventIndex, int rpm, fs->onTriggerTooth(rpm, nowNt, currentPhase, nextPhase); } -bool noFiringUntilVvtSync(vvt_mode_e vvtMode) { - auto operationMode = engine->getOperationMode(); - - // V-Twin MAP phase sense needs to always wait for sync - if (vvtMode == VVT_MAP_V_TWIN) { - return true; - } - - if (engineConfiguration->isPhaseSyncRequiredForIgnition) { - // in rare cases engines do not like random sequential mode - return true; - } - - // Odd cylinder count engines don't work properly with wasted spark, so wait for full sync (so that sequential works) - // See https://github.com/rusefi/rusefi/issues/4195 for the issue to properly support this case - if (engineConfiguration->specs.cylindersCount > 1 && engineConfiguration->specs.cylindersCount % 2 == 1) { - return true; - } - - // Symmetrical crank modes require cam sync before firing - // non-symmetrical cranks can use faster spin-up mode (firing in wasted/batch before VVT sync) - // Examples include Nissan MR/VQ, Miata NB, etc - return - operationMode == FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR || - operationMode == FOUR_STROKE_THREE_TIMES_CRANK_SENSOR || - operationMode == FOUR_STROKE_TWELVE_TIMES_CRANK_SENSOR; -} - /** * This is the main trigger event handler. * Both injection and ignition are controlled from this method. diff --git a/firmware/controllers/engine_cycle/main_trigger_callback.h b/firmware/controllers/engine_cycle/main_trigger_callback.h index f3cec46730..df66cadbd7 100644 --- a/firmware/controllers/engine_cycle/main_trigger_callback.h +++ b/firmware/controllers/engine_cycle/main_trigger_callback.h @@ -12,7 +12,6 @@ #include "event_registry.h" void mainTriggerCallback(uint32_t trgEventIndex, efitick_t edgeTimestamp, angle_t currentPhase, angle_t nextPhase); -bool noFiringUntilVvtSync(vvt_mode_e vvtMode); void startSimultaneousInjection(void* = nullptr); void endSimultaneousInjection(InjectionEvent *event); diff --git a/firmware/controllers/limp_manager.cpp b/firmware/controllers/limp_manager.cpp index cae1ee499f..e2cf795403 100644 --- a/firmware/controllers/limp_manager.cpp +++ b/firmware/controllers/limp_manager.cpp @@ -6,6 +6,34 @@ #define CLEANUP_MODE_TPS 90 +static bool noFiringUntilVvtSync(vvt_mode_e vvtMode) { + auto operationMode = engine->getOperationMode(); + + // V-Twin MAP phase sense needs to always wait for sync + if (vvtMode == VVT_MAP_V_TWIN) { + return true; + } + + if (engineConfiguration->isPhaseSyncRequiredForIgnition) { + // in rare cases engines do not like random sequential mode + return true; + } + + // Odd cylinder count engines don't work properly with wasted spark, so wait for full sync (so that sequential works) + // See https://github.com/rusefi/rusefi/issues/4195 for the issue to properly support this case + if (engineConfiguration->specs.cylindersCount > 1 && engineConfiguration->specs.cylindersCount % 2 == 1) { + return true; + } + + // Symmetrical crank modes require cam sync before firing + // non-symmetrical cranks can use faster spin-up mode (firing in wasted/batch before VVT sync) + // Examples include Nissan MR/VQ, Miata NB, etc + return + operationMode == FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR || + operationMode == FOUR_STROKE_THREE_TIMES_CRANK_SENSOR || + operationMode == FOUR_STROKE_TWELVE_TIMES_CRANK_SENSOR; +} + void LimpManager::updateState(int rpm, efitick_t nowNt) { Clearable allowFuel = engineConfiguration->isInjectionEnabled; Clearable allowSpark = engineConfiguration->isIgnitionEnabled;