diff --git a/firmware/config/engines/mazda_miata_na8.cpp b/firmware/config/engines/mazda_miata_na8.cpp index 12a94c03ad..b8499e625e 100644 --- a/firmware/config/engines/mazda_miata_na8.cpp +++ b/firmware/config/engines/mazda_miata_na8.cpp @@ -19,7 +19,6 @@ static void commonNA8() { * 94-97 (tan) - #195500-2180 */ engineConfiguration->injector.flow = 265; - engineConfiguration->useInstantRpmForIdle = true; engineConfiguration->cylinderBore = 83; engineConfiguration->knockBandCustom = 13.81; diff --git a/firmware/config/engines/mazda_miata_vvt.cpp b/firmware/config/engines/mazda_miata_vvt.cpp index 16779eecf4..c55fc6e34e 100644 --- a/firmware/config/engines/mazda_miata_vvt.cpp +++ b/firmware/config/engines/mazda_miata_vvt.cpp @@ -276,7 +276,6 @@ static void setCommonMazdaNB() { engineConfiguration->cranking.rpm = 400; engineConfiguration->idle.solenoidFrequency = 500; engineConfiguration->rpmHardLimit = 7200; - engineConfiguration->useInstantRpmForIdle = true; engineConfiguration->enableFan1WithAc = true; engineConfiguration->isAlternatorControlEnabled = true; diff --git a/firmware/controllers/actuators/idle_state.txt b/firmware/controllers/actuators/idle_state.txt index 8a49a6ff05..122b446d93 100644 --- a/firmware/controllers/actuators/idle_state.txt +++ b/firmware/controllers/actuators/idle_state.txt @@ -26,7 +26,6 @@ bit badTps bit looksLikeRunning bit looksLikeCoasting bit looksLikeCrankToIdle -bit useInstantRpmForIdle bit isVerboseIAC bit isIdleCoasting;idle: coasting diff --git a/firmware/controllers/actuators/idle_thread.cpp b/firmware/controllers/actuators/idle_thread.cpp index ab5ad004c7..9e9900ed86 100644 --- a/firmware/controllers/actuators/idle_thread.cpp +++ b/firmware/controllers/actuators/idle_thread.cpp @@ -160,11 +160,6 @@ float IdleController::getIdleTimingAdjustment(int rpm, int targetRpm, Phase phas m_timingPid.reset(); return 0; } -#if EFI_SHAFT_POSITION_INPUT - if (engineConfiguration->useInstantRpmForIdle) { - rpm = engine->triggerCentral.triggerState.getInstantRpm(); - } -#endif // EFI_SHAFT_POSITION_INPUT // If inside the deadzone, do nothing if (absI(rpm - targetRpm) < engineConfiguration->idleTimingPidDeadZone) { @@ -284,7 +279,7 @@ float IdleController::getClosedLoop(IIdleController::Phase phase, float tpsPos, return newValue; } -float IdleController::getIdlePosition() { +float IdleController::getIdlePosition(float rpm) { #if EFI_SHAFT_POSITION_INPUT // Simplify hardware CI: we borrow the idle valve controller as a PWM source for various stimulation tasks @@ -304,15 +299,6 @@ float IdleController::getIdlePosition() { float clt = Sensor::getOrZero(SensorType::Clt); auto tps = Sensor::get(SensorType::DriverThrottleIntent); - // this variable is here to make Live View happier - useInstantRpmForIdle = engineConfiguration->useInstantRpmForIdle; - float rpm; - if (useInstantRpmForIdle) { - rpm = engine->triggerCentral.triggerState.getInstantRpm(); - } else { - rpm = Sensor::getOrZero(SensorType::Rpm); - } - // Compute the target we're shooting for auto targetRpm = getTargetRpm(clt); m_lastTargetRpm = targetRpm; @@ -378,7 +364,7 @@ float IdleController::getIdlePosition() { } void IdleController::onSlowCallback() { - float position = getIdlePosition(); + float position = getIdlePosition(engine->triggerCentral.triggerState.getInstantRpm()); applyIACposition(position); } diff --git a/firmware/controllers/actuators/idle_thread.h b/firmware/controllers/actuators/idle_thread.h index a8569c1993..3f4b891276 100644 --- a/firmware/controllers/actuators/idle_thread.h +++ b/firmware/controllers/actuators/idle_thread.h @@ -39,7 +39,7 @@ public: void init(); - float getIdlePosition(); + float getIdlePosition(float rpm); // TARGET DETERMINATION int getTargetRpm(float clt) override; diff --git a/firmware/controllers/algo/advance_map.cpp b/firmware/controllers/algo/advance_map.cpp index a8bb4922d9..c13e157a63 100644 --- a/firmware/controllers/algo/advance_map.cpp +++ b/firmware/controllers/algo/advance_map.cpp @@ -92,7 +92,9 @@ angle_t getAdvanceCorrections(int rpm) { ); } - engine->engineState.timingPidCorrection = engine->module()->getIdleTimingAdjustment(rpm); + float instantRpm = engine->triggerCentral.triggerState.getInstantRpm(); + + engine->engineState.timingPidCorrection = engine->module()->getIdleTimingAdjustment(instantRpm); #if EFI_TUNER_STUDIO engine->outputChannels.multiSparkCounter = engine->engineState.multispark.count; diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index b230045011..8c94713088 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -461,7 +461,7 @@ bit useEeprom bit cj125isUrDivided;+Is your UR CJ125 output wired to MCU via resistor divider?\nLooks like 3v range should be enough, divider generally not needed. bit useCicPidForIdle;+Switch between Industrial and Cic PID implementation bit useTLE8888_cranking_hack; -bit useInstantRpmForIdle; +bit unused120b18; bit useSeparateIdleTablesForCrankingTaper;+This uses separate ignition timing and VE tables not only for idle conditions, also during the postcranking-to-idle taper transition (See also afterCrankingIACtaperDuration). bit launchControlEnabled; bit rollingLaunchEnabled; diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index a0397e6e49..601274a702 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -2882,7 +2882,6 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00" field = "Use idle VE table", useSeparateVeForIdle field = "Use idle tables for cranking taper", useSeparateIdleTablesForCrankingTaper field = "Use coasting idle table", useIacTableForCoasting - field = useInstantRpmForIdle, useInstantRpmForIdle field = "Detailed status in console", isVerboseIAC dialog = idleSettings, "", yAxis diff --git a/unit_tests/tests/test_idle_controller.cpp b/unit_tests/tests/test_idle_controller.cpp index e851456109..60c764ed25 100644 --- a/unit_tests/tests/test_idle_controller.cpp +++ b/unit_tests/tests/test_idle_controller.cpp @@ -390,7 +390,6 @@ TEST(idle_v2, IntegrationManual) { Sensor::setMockValue(SensorType::DriverThrottleIntent, expectedTps.Value); Sensor::setMockValue(SensorType::Clt, expectedClt); Sensor::setMockValue(SensorType::VehicleSpeed, 15.0); - Sensor::setMockValue(SensorType::Rpm, 950); // Target of 1000 rpm EXPECT_CALL(dut, getTargetRpm(expectedClt)) @@ -410,7 +409,7 @@ TEST(idle_v2, IntegrationManual) { // getClosedLoop() should not be called! - EXPECT_EQ(13, dut.getIdlePosition()); + EXPECT_EQ(13, dut.getIdlePosition(950)); } TEST(idle_v2, IntegrationAutomatic) { @@ -424,7 +423,6 @@ TEST(idle_v2, IntegrationAutomatic) { Sensor::setMockValue(SensorType::DriverThrottleIntent, expectedTps.Value); Sensor::setMockValue(SensorType::Clt, expectedClt); Sensor::setMockValue(SensorType::VehicleSpeed, 15.0); - Sensor::setMockValue(SensorType::Rpm, 950); // Target of 1000 rpm EXPECT_CALL(dut, getTargetRpm(expectedClt)) @@ -447,7 +445,7 @@ TEST(idle_v2, IntegrationAutomatic) { .WillOnce(Return(7)); // Result should be open + closed - EXPECT_EQ(13 + 7, dut.getIdlePosition()); + EXPECT_EQ(13 + 7, dut.getIdlePosition(950)); } TEST(idle_v2, IntegrationClamping) { @@ -461,7 +459,6 @@ TEST(idle_v2, IntegrationClamping) { Sensor::setMockValue(SensorType::DriverThrottleIntent, expectedTps.Value); Sensor::setMockValue(SensorType::Clt, expectedClt); Sensor::setMockValue(SensorType::VehicleSpeed, 15.0); - Sensor::setMockValue(SensorType::Rpm, 950); // Target of 1000 rpm EXPECT_CALL(dut, getTargetRpm(expectedClt)) @@ -484,5 +481,5 @@ TEST(idle_v2, IntegrationClamping) { .WillOnce(Return(75)); // Result would be 75 + 75 = 150, but it should clamp to 100 - EXPECT_EQ(100, dut.getIdlePosition()); + EXPECT_EQ(100, dut.getIdlePosition(950)); }