mirror of https://github.com/rusefi/rusefi-1.git
Enable idle timing/ve tables based on idle phase logic (#2213)
* add helper * advance * ve Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
parent
3d913634a8
commit
868f0d47ac
|
@ -565,6 +565,10 @@ float getIdleTimingAdjustment(int rpm) {
|
||||||
return idleControllerInstance.getIdleTimingAdjustment(rpm);
|
return idleControllerInstance.getIdleTimingAdjustment(rpm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isIdling() {
|
||||||
|
return idleControllerInstance.isIdling();
|
||||||
|
}
|
||||||
|
|
||||||
static void applyPidSettings(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
static void applyPidSettings(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
getIdlePid(PASS_ENGINE_PARAMETER_SIGNATURE)->updateFactors(engineConfiguration->idleRpmPid.pFactor, engineConfiguration->idleRpmPid.iFactor, engineConfiguration->idleRpmPid.dFactor);
|
getIdlePid(PASS_ENGINE_PARAMETER_SIGNATURE)->updateFactors(engineConfiguration->idleRpmPid.pFactor, engineConfiguration->idleRpmPid.iFactor, engineConfiguration->idleRpmPid.dFactor);
|
||||||
iacPidMultMap.init(CONFIG(iacPidMultTable), CONFIG(iacPidMultLoadBins), CONFIG(iacPidMultRpmBins));
|
iacPidMultMap.init(CONFIG(iacPidMultTable), CONFIG(iacPidMultLoadBins), CONFIG(iacPidMultRpmBins));
|
||||||
|
|
|
@ -53,6 +53,11 @@ public:
|
||||||
float getIdleTimingAdjustment(int rpm);
|
float getIdleTimingAdjustment(int rpm);
|
||||||
float getIdleTimingAdjustment(int rpm, int targetRpm, Phase phase);
|
float getIdleTimingAdjustment(int rpm, int targetRpm, Phase phase);
|
||||||
|
|
||||||
|
// Allow querying state from outside
|
||||||
|
bool isIdling() {
|
||||||
|
return m_lastPhase == Phase::Idling;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// These are stored by getIdlePosition() and used by getIdleTimingAdjustment()
|
// These are stored by getIdlePosition() and used by getIdleTimingAdjustment()
|
||||||
Phase m_lastPhase = Phase::Cranking;
|
Phase m_lastPhase = Phase::Cranking;
|
||||||
|
@ -66,6 +71,8 @@ percent_t getIdlePosition();
|
||||||
|
|
||||||
float getIdleTimingAdjustment(int rpm);
|
float getIdleTimingAdjustment(int rpm);
|
||||||
|
|
||||||
|
bool isIdling();
|
||||||
|
|
||||||
void applyIACposition(percent_t position DECLARE_ENGINE_PARAMETER_SUFFIX);
|
void applyIACposition(percent_t position DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
void setManualIdleValvePosition(int positionPercent);
|
void setManualIdleValvePosition(int positionPercent);
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ static angle_t getRunningAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAME
|
||||||
float advanceAngle = advanceMap.getValue((float) rpm, engineLoad);
|
float advanceAngle = advanceMap.getValue((float) rpm, engineLoad);
|
||||||
|
|
||||||
// get advance from the separate table for Idle
|
// get advance from the separate table for Idle
|
||||||
if (CONFIG(useSeparateAdvanceForIdle)) {
|
if (CONFIG(useSeparateAdvanceForIdle) && isIdling()) {
|
||||||
float idleAdvance = interpolate2d("idleAdvance", rpm, config->idleAdvanceBins, config->idleAdvance);
|
float idleAdvance = interpolate2d("idleAdvance", rpm, config->idleAdvanceBins, config->idleAdvance);
|
||||||
|
|
||||||
auto [valid, tps] = Sensor::get(SensorType::DriverThrottleIntent);
|
auto [valid, tps] = Sensor::get(SensorType::DriverThrottleIntent);
|
||||||
|
@ -92,7 +92,6 @@ static angle_t getRunningAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAME
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if EFI_LAUNCH_CONTROL
|
#if EFI_LAUNCH_CONTROL
|
||||||
if (engine->isLaunchCondition && CONFIG(enableLaunchRetard)) {
|
if (engine->isLaunchCondition && CONFIG(enableLaunchRetard)) {
|
||||||
if (CONFIG(launchSmoothRetard)) {
|
if (CONFIG(launchSmoothRetard)) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "airmass.h"
|
#include "airmass.h"
|
||||||
#include "sensor.h"
|
#include "sensor.h"
|
||||||
|
#include "idle_thread.h"
|
||||||
|
|
||||||
EXTERN_ENGINE;
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
|
@ -23,8 +24,8 @@ float AirmassModelBase::getVe(int rpm, float load) const {
|
||||||
float ve = m_veTable->getValue(rpm, load);
|
float ve = m_veTable->getValue(rpm, load);
|
||||||
|
|
||||||
auto tps = Sensor::get(SensorType::Tps1);
|
auto tps = Sensor::get(SensorType::Tps1);
|
||||||
// get VE from the separate table for Idle
|
// get VE from the separate table for Idle if idling
|
||||||
if (tps.Valid && CONFIG(useSeparateVeForIdle)) {
|
if (isIdling() && tps && CONFIG(useSeparateVeForIdle)) {
|
||||||
float idleVe = interpolate2d("idleVe", rpm, config->idleVeBins, config->idleVe);
|
float idleVe = interpolate2d("idleVe", rpm, config->idleVeBins, config->idleVe);
|
||||||
// interpolate between idle table and normal (running) table using TPS threshold
|
// interpolate between idle table and normal (running) table using TPS threshold
|
||||||
ve = interpolateClamped(0.0f, idleVe, CONFIG(idlePidDeactivationTpsThreshold), ve, tps.Value);
|
ve = interpolateClamped(0.0f, idleVe, CONFIG(idlePidDeactivationTpsThreshold), ve, tps.Value);
|
||||||
|
|
Loading…
Reference in New Issue