diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index 546e26742a..4bed869a76 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -481,6 +481,13 @@ operation_mode_e Engine::getOperationMode(DECLARE_ENGINE_PARAMETER_SIGNATURE) { return doesTriggerImplyOperationMode(engineConfiguration->trigger.type) ? triggerCentral.triggerShape.getOperationMode() : engineConfiguration->ambiguousOperationMode; } +int Engine::getRpmHardLimit(DECLARE_ENGINE_PARAMETER_SIGNATURE) { + if (engineConfiguration->useFSIO6ForRevLimiter) { + return fsioState.fsioRpmHardLimit; + } + return CONFIG(rpmHardLimit); +} + /** * The idea of this method is to execute all heavy calculations in a lower-priority thread, * so that trigger event handler/IO scheduler tasks are faster. diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index a5c3371399..8614e2580b 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -241,6 +241,7 @@ public: bool isRunningPwmTest = false; + int getRpmHardLimit(DECLARE_ENGINE_PARAMETER_SIGNATURE); FsioState fsioState; diff --git a/firmware/controllers/algo/engine_parts.h b/firmware/controllers/algo/engine_parts.h index 462bf1061a..703bee557b 100644 --- a/firmware/controllers/algo/engine_parts.h +++ b/firmware/controllers/algo/engine_parts.h @@ -87,6 +87,8 @@ public: float fsioIdleOffset = 0; float fsioIdleMinValue = 0; + float fsioRpmHardLimit; + #if EFI_UNIT_TEST float mockFan = 0; float mockRpm = 0; diff --git a/firmware/controllers/core/fsio_impl.cpp b/firmware/controllers/core/fsio_impl.cpp index a8aa8fb08e..d8c8c9747a 100644 --- a/firmware/controllers/core/fsio_impl.cpp +++ b/firmware/controllers/core/fsio_impl.cpp @@ -516,6 +516,10 @@ void runFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) { updateValueOrWarning(MAGIC_OFFSET_FOR_TIMING_FSIO, "timing", &ENGINE(fsioState.fsioTimingAdjustment) PASS_ENGINE_PARAMETER_SUFFIX); } + if (engineConfiguration->useFSIO6ForRevLimiter) { + updateValueOrWarning(6 - 1, "rpm limit", &ENGINE(fsioState.fsioRpmHardLimit) PASS_ENGINE_PARAMETER_SUFFIX); + } + if (engineConfiguration->useFSIO8ForServo1) { useFsioForServo(0 PASS_ENGINE_PARAMETER_SUFFIX); } diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index 8f3e82ba16..929ff8bbe5 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -717,6 +717,6 @@ int getRusEfiVersion(void) { if (initBootloader() != 0) return 123; #endif /* EFI_BOOTLOADER_INCLUDE_CODE */ - return 20200531; + return 20200601; } #endif /* EFI_UNIT_TEST */ diff --git a/firmware/controllers/engine_cycle/main_trigger_callback.cpp b/firmware/controllers/engine_cycle/main_trigger_callback.cpp index 1457bd835d..7421083e80 100644 --- a/firmware/controllers/engine_cycle/main_trigger_callback.cpp +++ b/firmware/controllers/engine_cycle/main_trigger_callback.cpp @@ -391,8 +391,8 @@ static void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEvent // TODO: add 'pin shutdown' invocation somewhere - coils might be still open here! return; } - bool limitedSpark = rpm > CONFIG(rpmHardLimit); - bool limitedFuel = rpm > CONFIG(rpmHardLimit); + bool limitedSpark = rpm > engine->getRpmHardLimit(PASS_ENGINE_PARAMETER_SIGNATURE); + bool limitedFuel = rpm > engine->getRpmHardLimit(PASS_ENGINE_PARAMETER_SIGNATURE); if (CONFIG(boostCutPressure) != 0) { if (getMap(PASS_ENGINE_PARAMETER_SIGNATURE) > CONFIG(boostCutPressure)) {