idle always uses instant rpm (#4499)

* idle always uses instant rpm

* configs

* fully inject rpm
This commit is contained in:
Matthew Kennedy 2022-08-29 19:18:06 -07:00 committed by GitHub
parent 334b54c783
commit cbe70f8dec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 10 additions and 29 deletions

View File

@ -19,7 +19,6 @@ static void commonNA8() {
* 94-97 (tan) - #195500-2180 * 94-97 (tan) - #195500-2180
*/ */
engineConfiguration->injector.flow = 265; engineConfiguration->injector.flow = 265;
engineConfiguration->useInstantRpmForIdle = true;
engineConfiguration->cylinderBore = 83; engineConfiguration->cylinderBore = 83;
engineConfiguration->knockBandCustom = 13.81; engineConfiguration->knockBandCustom = 13.81;

View File

@ -276,7 +276,6 @@ static void setCommonMazdaNB() {
engineConfiguration->cranking.rpm = 400; engineConfiguration->cranking.rpm = 400;
engineConfiguration->idle.solenoidFrequency = 500; engineConfiguration->idle.solenoidFrequency = 500;
engineConfiguration->rpmHardLimit = 7200; engineConfiguration->rpmHardLimit = 7200;
engineConfiguration->useInstantRpmForIdle = true;
engineConfiguration->enableFan1WithAc = true; engineConfiguration->enableFan1WithAc = true;
engineConfiguration->isAlternatorControlEnabled = true; engineConfiguration->isAlternatorControlEnabled = true;

View File

@ -26,7 +26,6 @@ bit badTps
bit looksLikeRunning bit looksLikeRunning
bit looksLikeCoasting bit looksLikeCoasting
bit looksLikeCrankToIdle bit looksLikeCrankToIdle
bit useInstantRpmForIdle
bit isVerboseIAC bit isVerboseIAC
bit isIdleCoasting;idle: coasting bit isIdleCoasting;idle: coasting

View File

@ -160,11 +160,6 @@ float IdleController::getIdleTimingAdjustment(int rpm, int targetRpm, Phase phas
m_timingPid.reset(); m_timingPid.reset();
return 0; 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 inside the deadzone, do nothing
if (absI(rpm - targetRpm) < engineConfiguration->idleTimingPidDeadZone) { if (absI(rpm - targetRpm) < engineConfiguration->idleTimingPidDeadZone) {
@ -284,7 +279,7 @@ float IdleController::getClosedLoop(IIdleController::Phase phase, float tpsPos,
return newValue; return newValue;
} }
float IdleController::getIdlePosition() { float IdleController::getIdlePosition(float rpm) {
#if EFI_SHAFT_POSITION_INPUT #if EFI_SHAFT_POSITION_INPUT
// Simplify hardware CI: we borrow the idle valve controller as a PWM source for various stimulation tasks // 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); float clt = Sensor::getOrZero(SensorType::Clt);
auto tps = Sensor::get(SensorType::DriverThrottleIntent); 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 // Compute the target we're shooting for
auto targetRpm = getTargetRpm(clt); auto targetRpm = getTargetRpm(clt);
m_lastTargetRpm = targetRpm; m_lastTargetRpm = targetRpm;
@ -378,7 +364,7 @@ float IdleController::getIdlePosition() {
} }
void IdleController::onSlowCallback() { void IdleController::onSlowCallback() {
float position = getIdlePosition(); float position = getIdlePosition(engine->triggerCentral.triggerState.getInstantRpm());
applyIACposition(position); applyIACposition(position);
} }

View File

@ -39,7 +39,7 @@ public:
void init(); void init();
float getIdlePosition(); float getIdlePosition(float rpm);
// TARGET DETERMINATION // TARGET DETERMINATION
int getTargetRpm(float clt) override; int getTargetRpm(float clt) override;

View File

@ -92,7 +92,9 @@ angle_t getAdvanceCorrections(int rpm) {
); );
} }
engine->engineState.timingPidCorrection = engine->module<IdleController>()->getIdleTimingAdjustment(rpm); float instantRpm = engine->triggerCentral.triggerState.getInstantRpm();
engine->engineState.timingPidCorrection = engine->module<IdleController>()->getIdleTimingAdjustment(instantRpm);
#if EFI_TUNER_STUDIO #if EFI_TUNER_STUDIO
engine->outputChannels.multiSparkCounter = engine->engineState.multispark.count; engine->outputChannels.multiSparkCounter = engine->engineState.multispark.count;

View File

@ -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 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 useCicPidForIdle;+Switch between Industrial and Cic PID implementation
bit useTLE8888_cranking_hack; 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 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 launchControlEnabled;
bit rollingLaunchEnabled; bit rollingLaunchEnabled;

View File

@ -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 VE table", useSeparateVeForIdle
field = "Use idle tables for cranking taper", useSeparateIdleTablesForCrankingTaper field = "Use idle tables for cranking taper", useSeparateIdleTablesForCrankingTaper
field = "Use coasting idle table", useIacTableForCoasting field = "Use coasting idle table", useIacTableForCoasting
field = useInstantRpmForIdle, useInstantRpmForIdle
field = "Detailed status in console", isVerboseIAC field = "Detailed status in console", isVerboseIAC
dialog = idleSettings, "", yAxis dialog = idleSettings, "", yAxis

View File

@ -390,7 +390,6 @@ TEST(idle_v2, IntegrationManual) {
Sensor::setMockValue(SensorType::DriverThrottleIntent, expectedTps.Value); Sensor::setMockValue(SensorType::DriverThrottleIntent, expectedTps.Value);
Sensor::setMockValue(SensorType::Clt, expectedClt); Sensor::setMockValue(SensorType::Clt, expectedClt);
Sensor::setMockValue(SensorType::VehicleSpeed, 15.0); Sensor::setMockValue(SensorType::VehicleSpeed, 15.0);
Sensor::setMockValue(SensorType::Rpm, 950);
// Target of 1000 rpm // Target of 1000 rpm
EXPECT_CALL(dut, getTargetRpm(expectedClt)) EXPECT_CALL(dut, getTargetRpm(expectedClt))
@ -410,7 +409,7 @@ TEST(idle_v2, IntegrationManual) {
// getClosedLoop() should not be called! // getClosedLoop() should not be called!
EXPECT_EQ(13, dut.getIdlePosition()); EXPECT_EQ(13, dut.getIdlePosition(950));
} }
TEST(idle_v2, IntegrationAutomatic) { TEST(idle_v2, IntegrationAutomatic) {
@ -424,7 +423,6 @@ TEST(idle_v2, IntegrationAutomatic) {
Sensor::setMockValue(SensorType::DriverThrottleIntent, expectedTps.Value); Sensor::setMockValue(SensorType::DriverThrottleIntent, expectedTps.Value);
Sensor::setMockValue(SensorType::Clt, expectedClt); Sensor::setMockValue(SensorType::Clt, expectedClt);
Sensor::setMockValue(SensorType::VehicleSpeed, 15.0); Sensor::setMockValue(SensorType::VehicleSpeed, 15.0);
Sensor::setMockValue(SensorType::Rpm, 950);
// Target of 1000 rpm // Target of 1000 rpm
EXPECT_CALL(dut, getTargetRpm(expectedClt)) EXPECT_CALL(dut, getTargetRpm(expectedClt))
@ -447,7 +445,7 @@ TEST(idle_v2, IntegrationAutomatic) {
.WillOnce(Return(7)); .WillOnce(Return(7));
// Result should be open + closed // Result should be open + closed
EXPECT_EQ(13 + 7, dut.getIdlePosition()); EXPECT_EQ(13 + 7, dut.getIdlePosition(950));
} }
TEST(idle_v2, IntegrationClamping) { TEST(idle_v2, IntegrationClamping) {
@ -461,7 +459,6 @@ TEST(idle_v2, IntegrationClamping) {
Sensor::setMockValue(SensorType::DriverThrottleIntent, expectedTps.Value); Sensor::setMockValue(SensorType::DriverThrottleIntent, expectedTps.Value);
Sensor::setMockValue(SensorType::Clt, expectedClt); Sensor::setMockValue(SensorType::Clt, expectedClt);
Sensor::setMockValue(SensorType::VehicleSpeed, 15.0); Sensor::setMockValue(SensorType::VehicleSpeed, 15.0);
Sensor::setMockValue(SensorType::Rpm, 950);
// Target of 1000 rpm // Target of 1000 rpm
EXPECT_CALL(dut, getTargetRpm(expectedClt)) EXPECT_CALL(dut, getTargetRpm(expectedClt))
@ -484,5 +481,5 @@ TEST(idle_v2, IntegrationClamping) {
.WillOnce(Return(75)); .WillOnce(Return(75));
// Result would be 75 + 75 = 150, but it should clamp to 100 // Result would be 75 + 75 = 150, but it should clamp to 100
EXPECT_EQ(100, dut.getIdlePosition()); EXPECT_EQ(100, dut.getIdlePosition(950));
} }