pause closed loop fuel after cuts
(cherry picked from commit a861d76da613f0337f54400d8f5cb4e61ad15406)
This commit is contained in:
parent
1d7d988c42
commit
25a3589edf
|
@ -48,7 +48,7 @@ void LimpManager::updateRevLimit(int rpm) {
|
|||
m_revLimitLow = m_revLimit - engineConfiguration->rpmHardLimitHyst;
|
||||
|
||||
m_timingRetard = interpolateClamped(m_revLimitLow, 0, m_revLimit, engineConfiguration->rpmSoftLimitTimingRetard, rpm);
|
||||
|
||||
|
||||
percent_t fuelAdded = interpolateClamped(m_revLimitLow, 0, m_revLimit, engineConfiguration->rpmSoftLimitFuelAdded, rpm);
|
||||
m_fuelCorrection = 1.0f + fuelAdded / 100;
|
||||
}
|
||||
|
@ -182,6 +182,11 @@ todo AndreiKA this change breaks 22 unit tests?
|
|||
|
||||
m_transientAllowInjection = allowFuel;
|
||||
m_transientAllowIgnition = allowSpark;
|
||||
|
||||
if (!m_transientAllowInjection || !m_transientAllowIgnition) {
|
||||
// Tracks the last time any cut happened
|
||||
m_lastCutTime.reset(nowNt);
|
||||
}
|
||||
}
|
||||
|
||||
void LimpManager::onIgnitionStateChanged(bool ignitionOn) {
|
||||
|
@ -247,3 +252,7 @@ float LimpManager::getLimitingFuelCorrection() const {
|
|||
return 1.0f; // no correction
|
||||
return m_fuelCorrection;
|
||||
}
|
||||
|
||||
float LimpManager::getTimeSinceAnyCut() const {
|
||||
return m_lastCutTime.getElapsedSeconds();
|
||||
}
|
||||
|
|
|
@ -111,6 +111,8 @@ public:
|
|||
LimpState allowInjection() const;
|
||||
LimpState allowIgnition() const;
|
||||
|
||||
float getTimeSinceAnyCut() const;
|
||||
|
||||
bool allowTriggerInput() const;
|
||||
|
||||
void updateRevLimit(int rpm);
|
||||
|
@ -150,6 +152,9 @@ private:
|
|||
// todo: migrate to engineState->desiredRpmLimit to get this variable logged
|
||||
float m_revLimit;
|
||||
float m_revLimitLow;
|
||||
|
||||
// Tracks how long since a cut (ignition or fuel) was active for any reason
|
||||
Timer m_lastCutTime;
|
||||
};
|
||||
|
||||
LimpManager * getLimpManager();
|
||||
|
|
|
@ -93,6 +93,13 @@ bool shouldUpdateCorrection(SensorType sensor) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Pause if some other cut was active recently
|
||||
auto timeSinceFuelCut = engine->module<LimpManager>()->getTimeSinceAnyCut();
|
||||
// TODO: should duration this be configurable?
|
||||
if (timeSinceFuelCut < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue